Hi I am trying to return table from procedure.
Below is my code:
create or replace function schema1.filter_data(filter_conditions text)
RETURNS VOID
language plpgsql
AS $function$
DECLARE
v_sql text default '';
BEGIN
V_SQL = 'CREATE TEMP TABLE TEST ON COMMIT DROP AS
PERFORM *
FROM schema1.data
where '||filter_conditions||'
';
execute V_SQL;
return ;
end;
$function$
Once i call using:
select * from filter_data($$"Country" in ('China', 'Hongkong') and "date"='2024-01-11'$$)
The result that i am getting is:
Any modification required in my code?Thanks in advance