Hi Frank

I use the following constructs to generate an objectid's in my database:

CREATE SEQUENCE public.tsfraction MAXVALUE 999999;

CREATE FUNCTION getobjectid() RETURNS text
AS '
        select((select(to_char(current_timestamp, \'yyyy-mm-dd-hh-mm-ss\'))) || 
(select(to_char((nextval(\'tsfraction\')),\'-FM000000MI\')))) as return;
'
LANGUAGE 'sql';

CREATE TABLE public.object
(
        objectid text NOT NULL DEFAULT getobjectid(),
        -- other columns omited
        CONSTRAINT pk_object PRIMARY KEY (objectid)
) WITH OIDS;



Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: [EMAIL PROTECTED]
web: www.askesis.nl

---------------------------(end of broadcast)---------------------------
TIP 3: 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