Link to home
Start Free TrialLog in
Avatar of mcanetvenkat
mcanetvenkat

asked on

How to auto increment in pl sql collumn (LIKE SQL we have identity like wise in pl sql what ?)


How to auto increment in pl sql collumn (LIKE SQL we have identity like wise in pl sql what ?)

EXample i have emp table i have three column empid,empname,empaddress

I need to this empid column autoincerment.

In my pl sql .

Avatar of Ivo Stoykov
Ivo Stoykov
Flag of Bulgaria image

Hello mcanetvenkat,

you have to use sequence for this

HTH

I
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could create a sequence and use the sequence directly in your insert statement

CREATE SEQUENCE emp_seq START WITH 1 INCREMENT BY 1;

  INSERT INTO emp( empid, empname, empaddress )
  VALUES ( emp_seq.NEXTVAL, 'Name','Address' );
Force accepted

AnnieMod
Cleanup Admin