關于PLSQL循環導入數據的問題
代碼如下:
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; ? ? ?
想實現的是:在test_student表中stuname列循環插入數據,插入的時候隨機從test_hanzibiao表中提取xingshi 和hzb1列。
現在的問題是:運行后stuname列直接所有數據都是一樣的。求幫助