Re: trying to learn plpqsql... so please forgive..

From: Luis Sousa <llsousa(at)ualg(dot)pt>
To: Michiel Lange <michiel(at)minas(dot)demon(dot)nl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: trying to learn plpqsql... so please forgive..
Date: 2002-11-20 09:44:53
Message-ID: 3DDB5995.7060403@ualg.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> When I do an 'INSERT INTO <table> VALUES <row1,row2,row3>'
> and on the table is a serial primary key named p_key.
> As I want this number to be auto-generated, but use it as a 'customer
> number', I want to create this function to return the value of this
> insert.

Try this:

SELECT currval(<sequence name from table>);

Luis Sousa

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Henshall, Stuart - Design & Print 2002-11-20 09:48:13 Re: trying to learn plpqsql... so please forgive..
Previous Message Thrasher 2002-11-20 09:44:49 Date trunc in UTC