我想以后我做的情况下statment做一个选择不甲骨文的PL/SQL
即
select x from dual (x is actually a variable in a report writer tool)
case when x = 'equipment'
select * from inside_sales
else
select * from outside_sales
end
不能使用PL/SQL
任何帮助,将不胜感激
我想以后我做的情况下statment做一个选择不甲骨文的PL/SQL
即
select x from dual (x is actually a variable in a report writer tool)
case when x = 'equipment'
select * from inside_sales
else
select * from outside_sales
end
不能使用PL/SQL
任何帮助,将不胜感激
我想你想要这样的:
select * from inside_sales where x = 'equipment'
union all
select * from outside_sales where x <> 'equipment';
注意:如果x
可以是NULL
,则第二种情况会稍微复杂一些。
'when'似乎不正确的,当很多没有'CASE' – Phil
就是这样。但如何处理检索到的数据?
create function sales_report (is_x IN varchar2)
return // what to return?
is
row_i_s inside_sales%rowtype;
row_o_s ouside_sales%rowtype;
begin
case is_x
when 'equipment'
then
select *
into row_i_s
from inside_sales;
else
select *
into row_o_s
from outside_sales;
end;
return // what to return?
end;
这将有助于如果你能告诉一些示例数据和您想要的结果 – Phil