我想以後我做的情況下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