猿问

关于for循环嵌套获取上一层循环的数据的问题?

for aa in (select * from tb) 
loop 
for bb in (select column_name from user_tab_columns where table_name ='tb' order by column_id ) 
loop 
v_name:= aa.bb.column_name --这样会报错 求指教该如何写

潇潇雨雨
浏览 921回答 1
1回答

慕少森

LOOP SAVEPOINT signsavepoint; BEGIN OPEN c_truck; eventkeylist := ''; truckeylist := ''; LOOP FETCH c_truck INTO backtruckkey, backeventlogkey; EXIT WHEN c_truck%NOTFOUND; IF eventkeylist = '' AND truckeylist = '' THEN eventkeylist := '''' || eventkeylist || ''''; truckeylist := '''' || backtruckkey || ''''; ELSE eventkeylist := ',''' || eventkeylist || ''''; truckeylist := ',''' || backtruckkey || ''''; END IF; END LOOP; CLOSE c_truck; END; END LOOP; 给个简单的例子作为参考
随时随地看视频慕课网APP

相关分类

Oracle
我要回答