[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 592
  • Last Modified:

precision too large error

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
anju_a_sagar
Asked:
anju_a_sagar
  • 4
  • 3
1 Solution
 
Shaju KumbalathCommented:
select new_order_id.nextval from dual;
CHECK THE OUTPUT OF ABOVE QUERY  , IT SHOULD NOT BE GREATER THAN COLUMN LENGTH ORDER_ID;
 
0
 
anju_a_sagarAuthor Commented:
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
 
anju_a_sagarAuthor Commented:
how can i get a value from sequence in PL/Sql?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Shaju KumbalathCommented:
u have done that many selection on that sequence;
 
0
 
Shaju KumbalathCommented:
sequence value  increases  by 1 each time the loop executes. check how many rows are returned by ur cursor
0
 
anju_a_sagarAuthor Commented:
155493
0
 
anju_a_sagarAuthor Commented:
thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now