甲骨文:向驳回器添加新行
我有一个程序,该过程将避难所作为OUT参数返回。
我需要将其包装在一个新的过程中,并添加新的行,这取决于一个反驳者字段。 由于所有光标都是不可变的,因此我遇到了这个问题。也许创建临时表?
DECLARE
initial_cursor SYS_REFCURSOR;
result_cursor SYS_REFCURSOR;
BEGIN
initial_procedure(initial_cursor);
-- add a new row which depends on initial cursors row and wrap it into result cursor.
END;
让我们考虑到初始光标仅由布尔值组成,而新的行将为varchar“ true”或“ false”(如果光标值为0,则“ false”,否则“ true”)
I have a procedure which returns refcursor as OUT parameter.
I need to wrap it inside a new procedure and add new row which depends on one of the refcursors field.
As all cursors are immutable I am stuck with this problem. Maybe create temporary table?
DECLARE
initial_cursor SYS_REFCURSOR;
result_cursor SYS_REFCURSOR;
BEGIN
initial_procedure(initial_cursor);
-- add a new row which depends on initial cursors row and wrap it into result cursor.
END;
Lets consider that initial cursor will consist only of boolean values and new row will be varchar 'TRUE' or 'FALSE' (if cursor value is 0 then 'FALSE', else 'TRUE')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建一个 PIPELINED 函数来读取游标并输出带有额外行的行:
然后您可以使用它来创建第二个游标:
输出:
db<>fiddle 此处
You can create a
PIPELINED
function to read the cursor and output the rows with an extra row:and then you can use that to make the second cursor:
Which outputs:
db<>fiddle here