i am getting error while calling below procedure
create or replace procedure get_net_profit_based_on_partition_value(part_value varchar)
returns table (branch_id integer, city varchar, net_profit float, net_profit_part float )
language sql
as
declare
res resultset default (select branch_id, city,net_profit, 100 * ratio_to_report(net_profit) over (partition by :part_value) as net_profit_part from store_sales order by city);
begin
return table(res);
end;
and when calling the procedure
call get_net_profit_based_on_partition_value('city');
Getting below error:
000603 (XX000): SQL execution internal error:
Processing aborted due to error 300002:3405954919; incident 7068082.
I already checked that this select statement alone would work, but its failing in the procedure
Can anybody help on this?
Because your input variable is referencing an object, not a value, I think you need to use the keyword "identifier" eg
res resultset default (select branch_id, city,net_profit, 100 * ratio_to_report(net_profit) over (partition by identifier(:part_value)) as net_profit_part from store_sales order by city);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.