Re: Unique identifiers
Posted in 1996
In reply to Christian Hoj's email about Unique identifiers, on 5 Oct 96
Hi Christian,
> Hi there!
>
> Does Informix have a built-in function to generate unique ID-numbers? I
> need to be sure that I get a different number each time I call the
> function, because the values are to be entered into a column with an
> unique index.
>
> Christian Hoj
> SAXoTECH
> Denmark
If your table schema is not yet created , then you can create one where ID
number is serial datatype. This would ensure that a unique ID number is
created everytime that you insert. You might also create unique index on
this field.
e.g.
Create table test_tab
(
ID_number serial,
Name char (30)
)
and to insert :
Insert into test_tab values ( 0, "John Doe" )
This will assign the next highest number to ID_Number automatically.
However, if you have already decided upon using integer for ID, then I
think you will have to write a stored procedure which picks up generates a
serial in another table and returns it to calling program etc.
HTH,
Ravi....
--
Ravi Joseph Pinto, mailto:ravi@in.dhl.com
Consultant, Astra Infotech, voice :91-22-8503000
Mumbai, India extn. 1531
Standard disclaimers apply.