this is what i have:
CREATE TABLE EMP (
EMPNO NUMBER(4) NOT NULL,
To insert into this table, I have to put in the primary key. I can use a sequence.
Insert into emp(empno, empname)
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)
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,
I get an error saying something like column not allowed.
Any ideas, folks?
Click Here to Expand Forum to Full Width