Re: Problem with curval

Поиск
Список
Период
Сортировка
От Jeff Eckermann
Тема Re: Problem with curval
Дата
Msg-id 20041111211920.17325.qmail@web20827.mail.yahoo.com
обсуждение исходный текст
Ответ на Problem with curval  (Mike Fahey <mfahey@enter.net>)
Список pgsql-odbc
--- Mike Fahey <mfahey@enter.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@enter.net
>
********************************************************************
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>




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



В списке pgsql-odbc по дате отправления:

Предыдущее
От: "Dan Perlman"
Дата:
Сообщение: Unsubscribe
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: ODBC Driver stability