Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Can you use a SERIAL field? That will give you the next number automatically.
"Astemborski, Jon" <JAstemborski@biztravel.com> on 26/09/2000 02:44:05
To: "'informix-list@iiug.org'" <informix-list@iiug.org>
cc: (bcc: Sue Davidson/EXE)
Subject: unique id
I have a restraint on a particular field in a table I am updating. The
field can not be null and is part of the table's unique key. I developed a
function that I had hoped would evaluate the userid and then return the
max+1 recordid with in that userid.
CREATE FUNCTION bizrecid1(userid2 integer)
RETURNING integer; DEFINE recordid1 integer;
SELECT max(recordid) + 1 recordid1 FROM bizguaranteereq
where userid=userid2;
RETURN recordid1;
END FUNCTION;
Then I had hoped to reference this function in a sql statement that updated
a particular table but the function returned an error -111( no record
found). Has anyone created a function that creates a uniqueid based on
input from the current record.
Jon Astemborski
Rosenbluth Interactive
Jastemborski@biztravel.com
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.