Oracle-如何在循环中附加值并访问外部循环?
我的光标记录将就像以下
队列 | 步骤 |
---|---|
1 | A |
2 | B |
3 | C |
4 | D |
5 | R |
循环 将cusor1获取到rec1 当找不到cursor1时退出 strval:='val ='|| rec1.queue ||' '|| rec1.Steps; 结束循环;
我期望的输出是
val = 1a 2b 3c 4d 5r
My cursor records will be like this
Queue | steps |
---|---|
1 | A |
2 | B |
3 | C |
4 | D |
5 | R |
Loop Fetch cusor1 into rec1 Exit when cursor1%not found strval := 'val =' || rec1.queue||' '||rec1.steps; End loop;
The output I am expecting is
Val = 1A 2B 3C 4D 5R
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
跳过光标并使用
listAgg
:如果您必须使用光标,则:
两者都输出:
db<> fiddle
Skip the cursor and use
LISTAGG
:If you must use a cursor then:
Which both output:
db<>fiddle here
尝试下面尝试。
Try like below.