Oracle

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesOracle

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old January 4th, 2012, 10:17 AM
lerono lerono is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jan 2012
Posts: 1 lerono User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 23 sec
Reputation Power: 0
ORA-01400: cannot insert NULL

I am working on a project, the insert statement is not functioning properly and I cannot find the error The error is in the insert statement for CustOrder. The error states that NULL cannot be inserted into CustOrder.CustID. I have declared CustID and its reference. I have looked over the code several times and I cannot find the problem.

If it makes a difference I am using APEX. The company has not database or program to work with a database so I am building everything from scratch.

Any advice is greatly appreciated. Thanks in advance!



Code:
declare
  l_CustOrderID number;
  l_CustID number := :P11_CustID;

begin


if :P11_CUSTOMER_OPTIONS = 'NEW' then
  l_CustID := :P18_CustID;
end if;

-- Fetch values that need to be inserted into the Order Header
select CustOrder_seq.nextval into l_CustOrderID from dual;

-- Insert a row into the Order Header table
insert into CustOrder values(l_CustOrderID, sysdate, l_CustID, NULL, NULL);
commit;
-- Loop through the ORDER collection and insert rows into the Order Line Item table
for x in (select c001, c003, sum(c004) c004 from apex_collections 
  where collection_name = 'ORDER' group by c001, c003)
loop
  insert into OrderLine values 
    (NULL, l_CustOrderID, x.c001, to_number(x.c004), to_number(x.c003));
end loop;

-- Truncate the collection after the order has been placed
apex_collection.truncate_collection(p_collection_n  ame => 'ORDER');

-- Set the item P14_ORDER_ID to the order which was just placed
:P14_CustOrderID := l_CustOrderID;
end; 

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesOracle > ORA-01400: cannot insert NULL


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap