By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,335 Members | 2,718 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,335 IT Pros & Developers. It's quick & easy.

"is not scalar Variable" Error

P: 7
Hi all
This my procedure, when i try to run the procedure it says
"coitem_linenumber" is not a scalar variable.

Can any one say what is the error and how i can correct it

Expand|Select|Wrap|Line Numbers
  1. declare
  2. wotype CHARACTER;
  3. id integer;
  4. so_no ALIAS FOR $1;
  5. _wono integer;
  6. _wolno integer;
  7. woisid integer;
  8. wostdate date;
  9. wosdate date;
  10. woqty integer;
  11. wopno text;
  12. woprj integer;
  13. woordid integer;
  14. BEGIN
  15. select max(wo_id) into id from wo;
  16. wotype := 'W';
  17. LOOP
  18. IF id=0 THEN id=1;
  19. ELSE id=id+1; 
  20. END IF;
  21. UPDATE coitem SET coitem_order_type=wotype,coitem_order_id=id 
  22. WHERE (coitem_cohead_id=(SELECT cohead_id from cohead where(cohead.cohead_number=so_no))); 
  23. select 
  24. cohead_number into _wono,
  25. coitem_linenumber into _wolno, 
  26. coitem_itemsite_id into woisid,
  27. coitem_lastupdated into wostdate,
  28. coitem_scheddate into wosdate,
  29. coitem_ordqty into woqty,
  30. (cust_number||'-'||cust_name) into wopno, 
  31. cohead_prj_id into woprj 
  32. from custinfo,cohead,coitem 
  33. where ((cust_id=cohead_cust_id) and (cohead_id=coitem_cohead_id) and (coitem_order_id=id));
  34. select max(evntlog_order_id) into wo_ordid from eventlog where(eventlog_number=(wo_no||'-'||wo_lno));
  35. Insert into wo values(id,wo_no,wo_lno,'R',wo_isid,wo_stdate,wo_sdate,'S',wo_ordid,wo_qty,0,'','','',0,0,wo_pno,wo_prj,1,0) ;
  36. END LOOP;
  37. END;
  38.  
Jul 20 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 534
Please read the Posting Guidelines at the top of the page and use the CODE tags for your future postings.

What datatype is your coitem_linenumber field?
Jul 20 '07 #2

P: 7
ok sir,

the datatype for coitem_linenumber is integer


Please read the Posting Guidelines at the top of the page and use the CODE tags for your future postings.

What datatype is your coitem_linenumber field?
Jul 20 '07 #3

Expert 100+
P: 534
Looking at your code I see this:
Expand|Select|Wrap|Line Numbers
  1. ... ... ... ...
  2. SELECT
  3. cohead_number INTO _wono,
  4. coitem_linenumber INTO _wolno,
  5. coitem_itemsite_id INTO woisi
  6. ... ... ... ...
  7.  
I don't think this is right, the manual on SELECT INTO says:
------------------------------------------------------------------------------------------------
The result of a SELECT command yielding multiple columns (but only one row)
can be assigned to a record variable, row-type variable, or list of scalar variables.
This is done by:
SELECT INTO target select_expressions FROM ...;
-----------------------------------------------------------------------------------------------
So it seems you need to either use a list of variables with a single INTO -
Expand|Select|Wrap|Line Numbers
  1. select into var1, var2, var3   field1, field2, field3  FROM  tab-name ...
  2.  
or, considering you have a fair number of fields, it might be better just to select into var type RECORD and get what you need from there

See SELECT INTO for details
Jul 20 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.