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!

Auto Increment column query

user16854Jun 8 2011 — edited Jun 8 2011
I have a very simple table used for debugging:
CREATE TABLE APPS.XX_DEBUG_TMP
(
  TEMP_VALUE  VARCHAR2(255 BYTE),
  TEMP_DATE   DATE
)
Then I can use it to store values as my pl/sql is processed - e.g.:
INSERT INTO XX_DEBUG_TMP (TEMP_VALUE,TEMP_DATE) VALUES ('line 740 l_username value check:' || l_username,SYSDATE);  COMMIT;
Trouble is that if a load of debug statements get processed with the same timestamp, I can't see which came first.

Can I modify my table creation SQL to include an ID column which just increments for each row that is added to the table?

I'm familiar with how to do it in MySQL (sorry - I know this is an Oracle forum - but am just putting this here to show what I mean):
CREATE TABLE  `XX_DEBUG_TMP` (
 `TEMP_ID` MEDIUMINT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
 `TEMP_VALUE` VARCHAR( 255 ) NOT NULL ,
 `TEMP_DATE` DATETIME NOT NULL
) ENGINE = MYISAM ;
Is it that simple with Oracle? Probably not!

Any advice much appreciated.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 6 2011
Added on Jun 8 2011
3 comments
2,021 views