Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Error: 'ORA-01400: cannot insert NULL into ('
Anno Domini 21-1-2006 4:30, Mladen Gogala sprak aldus:
> On Fri, 20 Jan 2006 16:26:20 -0800, srhari wrote:
>
>
>> I'm trying to insert a record into a table, but getting the error -
>> 'ORA-01400: cannot insert NULL into (....'. The table structure is:
>>
>> recnum number primary key,
>> ap# varchar2,
>> program varchar2
>>
>
> create sequence tblname_seq start with 1 nomaxvalue nocycle cache 256;
>
> create or replace trigger tbl_populate_pk
> before insert on <table name>
> for each row
> begin
> select tblname_seq.nextval
> into :new.recnum
> from dual;
> end;
> /
>
>
insert into history values (tblname_seq.nextval, 'something','anything')
no need for triggers Received on Sat Jan 21 2006 - 08:47:46 CST
![]() |
![]() |