Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Autoincrement Sequence with String and number

665974Oct 19 2008 — edited Oct 19 2008
Hi,

I have a db for a small company where there are different kinds of employees.

As a primary key of each table (for each type of employee), I would like to have a combination of a string and integer.

e.g. if the employee is a car mechanic then the primary key should be something like: CM001, CM002, ....
if the employee is from the it department then the primary key should be like: IT001, IT002, ....

I have found a few script for sequences and triggers to use the auto-increment, but I could not find anything about concatenating a string in front of the integer.

any help appreciated.
thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 16 2008
Added on Oct 19 2008
4 comments
630 views