pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mike Fahey <mfahey@enter.net>
To: Postgres list <pgsql-odbc@postgresql.org>
Subject: Problem with curval
Date: Thu, 11 Nov 2004 10:35:49 -0500
Message-ID: <419386D5.9060502@enter.net> (raw)

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@enter.net
********************************************************************




view thread (3+ messages)  latest in thread

Message-ID: <419386D5.9060502@enter.net>
Permalink:  ../419386D5.9060502@enter.net/
Also on:    postgresql.org/message-id/419386D5.9060502@enter.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: mfahey@enter.net
  Subject: Re: Problem with curval
  In-Reply-To: <419386D5.9060502@enter.net>
  References: <419386D5.9060502@enter.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox