Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

precision too large error

Posted on 2008-10-07
7
Medium Priority
?
590 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 15

Accepted Solution

by:
Shaju Kumbalath earned 2000 total points
ID: 22657462
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
ID: 22657487
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
ID: 22657492
how can i get a value from sequence in PL/Sql?
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 15

Expert Comment

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

Expert Comment

by:Shaju Kumbalath
ID: 22657530
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
ID: 22657555
155493
0
 

Author Closing Comment

by:anju_a_sagar
ID: 31503742
thanks
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

618 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