Home » SQL & PL/SQL » SQL & PL/SQL » bind variable error...WHY? (oracle 10g release 2)
bind variable error...WHY? [message #309253] Wed, 26 March 2008 22:30 Go to next message
horax
Messages: 34
Registered: March 2008
Member
SQL/PLUS keeps telling me my variable is not declared, but I decalred it!

Please help me with this...

I placed the ERROR in the code where it normally occurs.

VARIABLE g_totalp_num NUMBER(5)

BEGIN
  :g_totalp_num := 103;
END;
/

REMARK--SP2-0552: Bind variable "G_TOTALP_NUM" not declared.

DECLARE
  lv_custRating_txt  VARCHAR2(6);
BEGIN
  CASE
    WHEN lv_Totalp_num <= 100 THEN  lv_custRating_txt := 'Low';
    WHEN lv_Totalp_num < 200 THEN  lv_custRating_txt := 'Mid';
    ELSE lv_custRating_txt := 'High';
  END CASE;
  
  dbms_Output.Put_Line(lv_Totalp_num);
  
  dbms_Output.Put_Line(lv_custRating_txt);
END;
/
Re: bind variable error...WHY? [message #309255 is a reply to message #309253] Wed, 26 March 2008 22:38 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
SQL*Plus is NOT PL/SQL & are executed by different language "engines"

Re: bind variable error...WHY? [message #309256 is a reply to message #309253] Wed, 26 March 2008 22:38 Go to previous message
horax
Messages: 34
Registered: March 2008
Member
Never mind...figured it out.

I had misspelled my varible as g_total_num instead of g_totalp_num.

Thanks anyways!

PS- I was just showing what I had typed into SQL/PLUS in the code, when in reality I had done them in separate blocks.

[Updated on: Wed, 26 March 2008 22:39]

Report message to a moderator

Previous Topic: REF to table of object
Next Topic: INSERT STATEMENT with Username included, Can I ?
Goto Forum:
  


Current Time: Fri Dec 09 08:04:43 CST 2016

Total time taken to generate the page: 0.07384 seconds