0

我有 3 个功能:-

select function1(param1) from dual;
select function2(param2) from dual;
select function3(param3) from dual;

我想在 1 个包装中使用其中的 3 个。

Create or replace package body PACKAGE_ABC

as procedure proc_abc(param1 varchar,param2 varchar,param3 varchar)

as 

cursor cur1
is 
select meaning from
table1
where meaning=(select function1(param1) from dual)

cursor cur2
is 
select meaning from
table2
where meaning=(select function2(param2) from dual)

cursor cur3
is 
select meaning from
table3
where meaning=(select function3(param3) from dual)

Begin
for cursor_var in cur1
loop
fnd_output.put_line(cursor_var.meaning )
end loop;
for cursor_var2 in cur2
loop
fnd_output.put_line(cursor_var2.meaning )
end loop;

for cursor_var3 in cur3
loop
fnd_output.put_line(cursor_var3.meaning )
end loop;

end proc_abc;
end package_abc;

无论如何,我可以在一个 for 循环中使用 3 个 funcns ...... 3 个游标选择语句使用同一个表,但正在获取差异值

4

1 回答 1

0

如果我理解这个问题,听起来你只是希望你的查询是

SELECT meaning
  FROM table1
 WHERE meaning IN (function1(param1), function2(param2), function3(param3))

当然,这有几个问题

  • 在您发布的代码param1param2, 和param3都未声明。所以如果你试图编译它,你会得到语法错误。
  • 如果您只选择该meaning列并且您正在对该列进行过滤meaning,则没有理由table1在您的查询中引用。您只需要从中选择函数调用的结果dual
于 2013-03-20T17:37:38.510 回答