ORA-01400 Error in application
656867Sep 8 2008 — edited Sep 11 2008Hello:
I'm receiving the following error when I try to create a new client.
ORA-01400: cannot insert null into ("client.id")
This is my table structure:
id Number Not Null PK
clientid varchar2
client_code varchar2
client_name varchar2
I created a report which displays all the clients from the table. I also have a CREATE button on the report so my users can create new clients. The CREATE button branches to the next page which is a form.
I click CREATE and the form appears. The form displays all the fields except for id which is the primary key and in the Items area of Page Rendering it appears as Hidden.
I attempt to add a client, I click Create, and I receive the above message.
I changed the id item from Hidden to Text Field and attempted another create and this time it worked.
The id field should also be auto-incremented which I am unable to figure out how to set it. I have a sequence created, ID2_SEQ.NEXTVAL, which when I do an actual insert statement via SQL*Plus the ID field does increment by one.
When I created the report, I couldn't find a way to reference that sequence for the CREATE button. I think that my error message may have something to do with the fact that I'm not inserting a value for the primary key. Yet, in APEX I read that the primary key is not supposed to be editable. I am totally confused here.
Basically, when the user clicks CREATE I want the following INSERT statement to work:
INSERT INTO client (id, clienid,client_code,client_name) VALUES (id2.seq.nextval, :P1_clientid, :P1_client_code, :P1_client_name);
The documentation for APEX is not very clear on how to do this.
Can someoene help me out? This shouldn't be this complicated.
Thanks for all the help.