-
Creating a Unique Identifier of a Sequence and a Character
Hi all,
I'm attempting to create a unique identifier field in a table that consists of a character (representing the Oracle instance) and the value of a sequence. In essence, when a value is inserted into the table by an application, the unique field value will be:
Character + nextval from a sequence.
Thus, I'm trying to create a sequence that contains the character and the numbers generated by the sequence.
Does anyone know how this can be done?
Thanks!
-
create a before insert trigger, supply the :NEW as 'character '||sequence.nextval
-
Sounds like a concatenated field... Don't do this, its really poor data modelling.
Just use 2 fields. Inserting the db name/instance id as one value and the Sequence into a seperate fields...
If you need the data concatenated use a view or select it as field1||field2 ...
Just my .02
-
. . . and with 2 fields you can still specify (col1, col2) as primary key or unique index.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|