Marcel,

A sequence represents a unique identifier. You can call the function
'nextval' to get the next unique value in the sequence.  See related
functions here:

http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html

In this code, I get the next sequence, insert it into a table, and
then return the value to the calling function:

DECLARE
    nextseq integer;

BEGIN
   nextseq := nextval('entry_id_seq');
        
        INSERT INTO my_table (
            entry_id,
            entry_text,
        ) VALUES (
            nextseq,
            p_entry_text,  -- input param
        );

On 4/4/07, Peter Eisentraut <[EMAIL PROTECTED]> wrote:
marcel.beutner wrote:
> I've searched in the groups already, but couldn't find any helpful
> information - only to use a sequence, which returns just a number and
> not a unique identifier.

Which properties do your unique identifiers posses that are not
satisfied by a number returned by a sequence?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to