Im not sure if this is what you are looking
for. But I use postgres this way to know which record I have sent.
Its a very simple function and should be self explanitory. I think the GET
DIAGNOSTICS is the key for you in this case.
-- Function: public.return_mortgage_id(varchar,
varchar)
CREATE FUNCTION public.return_mortgage_id(varchar, varchar) RETURNS int8 AS
'
DECLARE
oid1 INTEGER;
retval integer;
BEGIN
insert into mortgage(contact_firstname, contact_lastname,
date_submitted)
values($1,$2, now());
GET DIAGNOSTICS oid1 =
RESULT_OID;
select id into retval
from mortgage
where oid = oid1;
return retval;
end;' LANGUAGE 'plpgsql'
IMMUTABLE;
Hope that helps
Chad |
Title: Urgent Help : Use of return from function/procedure.
- [SQL] Urgent Help : Use of return from function/procedure. Anagha Joshi
- Re: [SQL] Urgent Help : Use of return from function/pr... Richard Huxton
- [SQL] Join or Where? Chad Thompson
- [SQL] Join or Where? Együd Csaba
- Re: [SQL] Join or Where? Richard Huxton