Skip site navigation (1) Skip section navigation (2)

Re: Problem with curval

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: Mike Fahey <mfahey(at)enter(dot)net>,Postgres list <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Problem with curval
Date: 2004-11-11 21:19:20
Message-ID: 20041111211920.17325.qmail@web20827.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-odbc
--- Mike Fahey <mfahey(at)enter(dot)net> wrote:

> 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;

myvalue record;

> 
> BEGIN
> 
> for myvalue in execute  '' select  currval('''' ''
>  || intable || ''_'' || incolumn
>  || ''_seq'''')
> '' Loop

as myalias'' Loop

>     return myvalue;

return myvalue.myalias;

(you may need to do some casting, but I suspect that
plpgsql will take care of that for you)

> 
> 
> 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
>
********************************************************************
> 
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo(at)postgresql(dot)org
> 



		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


In response to

pgsql-odbc by date

Next:From: Dave PageDate: 2004-11-12 08:37:48
Subject: Re: ODBC Driver stability
Previous:From: Dan PerlmanDate: 2004-11-11 19:06:44
Subject: Unsubscribe

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group