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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-odbc by date

  From Date Subject
Next Message Dave Page 2004-11-12 08:37:48 Re: ODBC Driver stability
Previous Message Dan Perlman 2004-11-11 19:06:44 Unsubscribe