I have a function(funct_A) that returns a varchar in quotes Select funct_A from dual returns 'A1234';
I want to use the result from funct_A in an IN clause
This returns 100 --> select count(E.tickets) from event E where E.ticket_number in ('A1234').
This returns 0 --> select count(E.tickets) from event E where E.ticket_number in (funct_A).
How is this accomplished?
How is this accomplished.
You probably wouldn't. If your function always returns a single value, you'd just use an equality condition rather than an IN
. Assuming your actual goal, though, is for the function to return multiple values, you likely want a pipelined table function instead
create or replace type ticket_tbl is table of varchar2(10);
create or replace function funcA
return ticket_tbl
pipelined
is
begin
pipe row ('A1234');
pipe row ('B5678' );
end;
/
select *
from event e
where e.ticket_number in (select column_value
from table( funcA ) );
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.