Problem with curval

From: Mike Fahey <mfahey(at)enter(dot)net>
To: Postgres list <pgsql-odbc(at)postgresql(dot)org>
Subject: Problem with curval
Date: 2004-11-11 15:35:49
Message-ID: 419386D5.9060502@enter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

This wont work because myvalue must be a record or row variable.

I'm guessing its nearly impossible to get the last inserted id from
access 2003 using
postgres odbc.

select @@IDENTITY always returns "2".

Thoughts?

create function last_insert_id(varchar,varchar ) returns integer
as '
declare
intable alias for $1;
incolumn alias for $2;
myvalue integer;

BEGIN

for myvalue in execute '' select currval('''' ''
|| intable || ''_'' || incolumn
|| ''_seq'''')
'' Loop
return myvalue;

END loop;
END;

'
language plpgsql;

--
With best regards,

Mike Fahey - Systems Administration
********************************************************************
ENTER.NET - "The Road to the Internet Starts Here!" (tm)
(610) 437-2221 * http://www.enter.net/ * email:support(at)enter(dot)net
********************************************************************

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Johann Zuschlag 2004-11-11 15:47:12 Re: 08.00.0002 useless :-)
Previous Message Mike Fahey 2004-11-11 14:33:23 www.postgresql.org down