Re: Auto incrementing key



chanakam2000@xxxxxxxxx wrote:
Hi,

Please help me,

I'm new to oracle environment.
I want to make a kind of auto generated primary key for my table.
I can make auto key with sequences and triggers. But only numeric
keys
But i want the key with some character value.

Ex : for student_id column my preffered value sequence is

S-00001
S-00002
S-00003 ..... & so on

I searched lot in internet. But could not find goood solution.
Please give me some idea.

If this is not possible please give me idea to generate sequence like
00001,00002,00003....

By using sequence i could only generate 1,2,3 & not 000001 ..etc

If you don't mind please emil me to chanakam2000@xxxxxxxxx or else
please answer to this group. I can visit.

Hoping your kind help!

Oracle is NOT a Microsoft product and you MUST read the docs.

Oracle uses an object type named SEQUENCE for this purpose. Go to
Morgan's Library at www.psoug.org and you will find working demos.

BTW: It is very very bad form to ever create a key of the type 'S-00001'
you demonstrate above. Don't do it. If you need the "S" put it into a
separate column and leave out the hyphen.
--
Daniel A. Morgan
http://www.psoug.org
damorgan@xxxxxxxxxxxxxxxx
(replace x with u to respond)
.



Relevant Pages

  • Re: Auto incrementing key
    ... | I'm new to oracle environment. ... | I want to make a kind of auto generated primary key for my table. ... | If this is not possible please give me idea to generate sequence like ...
    (comp.databases.oracle.misc)
  • Re: Auto incrementing key
    ... I'm new to oracle environment. ... I want to make a kind of auto generated primary key for my table. ... If this is not possible please give me idea to generate sequence like ...
    (comp.databases.oracle.misc)
  • Re: Turn off Auto Fill In???
    ... auto fill that enters the next records number in the sequence ... Form on the table (or on a query based on the table). ... Form doesn't have this obnoxious behavior but will let you update the ...
    (microsoft.public.access.queries)
  • Re: Auto incrementing key
    ... | I want to make a kind of auto generated primary key for my table. ... | If this is not possible please give me idea to generate sequence like ... Let me give you one more advice: don't multipost on c.d.o.* ...
    (comp.databases.oracle.server)

Loading