Obsidian/Recognition/Programing/MariaDB/Multi 업데이트.md

405 B

update table_items  a,
 (
	select concat('TB_', lpad(rownum * 10, 4, '0')) as keyseq -- 임시키생성
			, nvl(TableID,concat('TB_', lpad(rownum * 10, 4, '0'))) as tid -- 값이 없는경우 임시키로 대체
			, TableNm 
			, seq
			, next_seq
	from tmp_titems ) b
set a.Table_seq = b.keyseq,
    a.tableID = b.tid,
    a.tableNm = b.tableNm 
where a.seq >= b.seq
and a.seq <= b.next_seq