this is what i have:
CREATE TABLE EMP (
EMPNO NUMBER(4) NOT NULL,
EMPNAME VARCHAR2(25));
To insert into this table, I have to put in the primary key. I can use a sequence.
Insert into emp(empno, empname)
values(emp_seq.nextval, 'aruna');
In SQL SERver we have the @@IDENTITY key. Also, when we have a column as a primary key, we do not need to specifically insert it into the table.
Thus, if the above were in SQL Server, i would say:
Insert into EMP(empname)
values('aruna')
How can I in oracle, setup my primary key column such that it enters a unique value by default similar to in SQL Server.
I tried this:
create table emp(
empno number(4) DEFAULT emp_seq.nextval NOT NULL,
empname varchar2(25));
I get an error saying something like column not allowed.
Any ideas, folks?
Thanks,
Aruna