i know there are many post about this but i don’t find a solution for my problem. I create a function and on calling get the error: query has no destination for result data.
I don’t know what’s wrong and i’m going around in circles. Can anyone help me?
create or replace function get_tablename_and_id_from_property(customer_number varchar, res_id varchar)
returns table(Id varchar, Tablename varchar)
language plpgsql
as
$BODY$
declare partner_id varchar;
begin
partner_id := (select rp.id from res_partner as rp where rp.internal_customer_ref = customer_number);
select split_part(ip.value_reference, ',', 1) as "Tablename", split_part(ip.value_reference, ',', 2) as "Id"
from ir_property as ip
where lower(ip.name) like '%@res_id%'
and ip.res_id = 'res.partner,@partner_id';
end
$BODY$;