How to find out if a column is an auto increment field in oracle?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t. Oracle doesn’t have auto-increment fields.
Oracle supports sequences, which are separate database objects for generating numbers. These seuqences can be used in the insert statement or in a before insert trigger to generate a primary key value for the new record.
The fields themselves are just normal field and there is no relation between the sequence and the field.
So the only hope is to parse a trigger and see if you can find evidence of it being filled there using a sequence. That would be a tough job, though, and I doubt if you can make this reliable enough. After all, the trigger could fire a function which returns the value, so you have to go all the way if you want to be sure.