Home » SQL & PL/SQL » SQL & PL/SQL » How to generate a number......
How to generate a number...... [message #547] Tue, 19 February 2002 10:15 Go to next message
Satya
Messages: 36
Registered: January 2001
Member
hai,

I am creating a table which has a column which should generate a number automatically when i am inserting a row. what is the datatype should i use.
In postgresql there is datatype "SERIAL", is there anything like that in oracle. If no how to achieve it.

Thanqs in advance.
bye
satya
Re: How to generate a number...... [message #548 is a reply to message #547] Tue, 19 February 2002 10:52 Go to previous messageGo to next message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
http://www.orafaq.net/msgboard/sql/messages/11778.htm
Re: How to generate a number...... [message #558 is a reply to message #547] Wed, 20 February 2002 07:16 Go to previous messageGo to next message
sri
Messages: 154
Registered: February 2000
Senior Member
fIRST U CREATE SEQUNCE FOR SERIAL NO'S.
WHILE INSERTING IN TABLE USE SEQ_NAME.NEXT_VALUE
Re: How to generate a number...... [message #4380 is a reply to message #558] Wed, 04 December 2002 01:16 Go to previous message
meng
Messages: 1
Registered: December 2002
Junior Member
But the problem is when the INSERTING fails,
the SEQUNCE has increased its value.

So you can not guarantee to always get a consecutive number.
Previous Topic: Regarding sending an email using pl/sql
Next Topic: user sys to query tables created by other user
Goto Forum:
  


Current Time: Wed May 15 17:40:22 CDT 2024