Solved

precision too large error

Posted on 2008-10-07
7
579 Views
Last Modified: 2013-12-07
dear all,
This is my code and its showing numeric or value error : number precision too large  at line 18 , I cant find any mistake.
declare
cust_id_var ph2_item.customer_id% TYPE :=0;
ship_date_var ph2_item.ship_date% TYPE :=to_date('01-jan-90','dd-mon-yy') ;
item_id_var ph2_item.item_id% TYPE;
new_item_id ph2_item.item_id% TYPE;
new_ord_id ph2_item.order_id% TYPE;
cursor consolidation_cursor is
select n.no_of_sites ,p.customer_id,p.order_id, p.item_id, p.order_date, p.ship_date FROM ph2_item p, no_of_sites n ORDER BY p.order_date, p.customer_id, p.ship_date, p.order_id, p.item_id for UPDATE OF p.order_id, p.item_id;
begin
for con_cursor in consolidation_cursor loop
if ( con_cursor.customer_id = cust_id_var AND
con_cursor.ship_date=ship_date_var AND
con_cursor.no_of_sites>1 )
or
(con_cursor.item_id > item_id_var)  THEN
new_item_id := new_item_id + 1;
else
select new_order_id.nextval into new_ord_id from dual;
new_item_id:=1;
end if;

cust_id_var := con_cursor.customer_id;
ship_date_var :=  con_cursor.ship_date;
item_id_var:= con_cursor.item_id;

update ph2_item
SET item_id = new_item_id,
order_id = new_ord_id
WHERE CURRENT OF consolidation_cursor;
end LOOP;

end;
/

Many thanks
0
Comment
Question by:anju_a_sagar
  • 4
  • 3
7 Comments
 
LVL 15

Accepted Solution

by:
Shaju Kumbalath earned 500 total points
Comment Utility
select new_order_id.nextval from dual;
CHECK THE OUTPUT OF ABOVE QUERY  , IT SHOULD NOT BE GREATER THAN COLUMN LENGTH ORDER_ID;
 
0
 

Author Comment

by:anju_a_sagar
Comment Utility
its 10025, yes it is greater
but i created a seq like this
CREATE  SEQUENCE
             new_order_id
           START WITH 622 INCREMENT BY 1;
 Why it is returning this number    
0
 

Author Comment

by:anju_a_sagar
Comment Utility
how can i get a value from sequence in PL/Sql?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 15

Expert Comment

by:Shaju Kumbalath
Comment Utility
u have done that many selection on that sequence;
 
0
 
LVL 15

Expert Comment

by:Shaju Kumbalath
Comment Utility
sequence value  increases  by 1 each time the loop executes. check how many rows are returned by ur cursor
0
 

Author Comment

by:anju_a_sagar
Comment Utility
155493
0
 

Author Closing Comment

by:anju_a_sagar
Comment Utility
thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now