Re: Auto incrementing key
- From: yf110@xxxxxxxxxxxxxxxxxxx (Malcolm Dew-Jones)
- Date: 9 Apr 2006 14:51:56 -0800
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.
pseudo code - I doubt you really want this, but here goes anyway...
number x = my_sequence.next_value
string my_key = 'S-' || format_number('99999',x)
You need to read the docs for the real names and inputs of the various
functions.
: If this is not possible please give me idea to generate sequence like
: 00001,00002,00003....
A sequence returns a number. How you format the number is up to you.
Oracle has many functions that might help.
.
- References:
- Auto incrementing key
- From: chanakam2000
- Auto incrementing key
- Prev by Date: Re: Cursor Parameter Problems/Question
- Next by Date: Re: calling dbms_redefinition via a stored procedure.
- Previous by thread: Re: Auto incrementing key
- Next by thread: External Tables
- Index(es):
Relevant Pages
|
Loading