關(guān)于PLSQL循環(huán)導(dǎo)入數(shù)據(jù)的問(wèn)題
代碼如下:
begin
?for c in (select * from test_student) loop
? ?update test_student t
? ? ? set t.stuname =
? ? ? ? ? (select *
? ? ? ? ? ? ?from (select xingshi || hzb1
? ? ? ? ? ? ? ? ? ? ?from test_hanzibiao
? ? ? ? ? ? ? ? ? ? order by dbms_random.value)
? ? ? ? ? ? where rownum = 1)
?end loop;
end; ? ? ?
想實(shí)現(xiàn)的是:在test_student表中stuname列循環(huán)插入數(shù)據(jù),插入的時(shí)候隨機(jī)從test_hanzibiao表中提取xingshi 和hzb1列。
現(xiàn)在的問(wèn)題是:運(yùn)行后stuname列直接所有數(shù)據(jù)都是一樣的。求幫助