Home » SQL & PL/SQL » Client Tools » DEFINE in TOAD vs SQLPLUS
DEFINE in TOAD vs SQLPLUS [message #18059] Tue, 08 February 2005 13:32 Go to next message
rishank
Messages: 3
Registered: February 2005
Junior Member
hi

my code looks like this

DEFINE p_ann_sal= 6000;
DECLARE
v_sal NUMBER (9,2) := &p_annual_sal;
BEGIN
v_sal := v_sal/12;

DBMS_OUTPUT.PUT_LINE (TO_CHAR(V_SAL));
END;

When I run it using sqlplus its working fine, asking for the input variable at runtime and works well
But I'm unable to enter the input value at runtime in TOAD. I'm using the SQL window of TOAD to run the code.

Thanks
rishank.
Re: DEFINE in TOAD vs SQLPLUS [message #18063 is a reply to message #18059] Tue, 08 February 2005 14:49 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8922
Registered: November 2002
Location: California, USA
Senior Member
&p_annual_sal is a SQL*Plus substitution variable and therefore only works from SQL*Plus or something that runs SQL*Plus, so it won't work if Toad is just running SQL, not SQL*Plus.
Re: DEFINE in TOAD vs SQLPLUS [message #18090 is a reply to message #18063] Wed, 09 February 2005 06:06 Go to previous messageGo to next message
rishank
Messages: 3
Registered: February 2005
Junior Member
thanks Barbara for the info.
Re: DEFINE in TOAD vs SQLPLUS [message #18138 is a reply to message #18059] Thu, 10 February 2005 23:12 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
I guess it depends on your version/settings. You can let TOAD scan for bind variables.

If you execute your program as a script (F5) instead of hitting F9 (run), a lot of SQL*Plus commands are supported, including DEF(INE)

MHE
Previous Topic: compile debug with sql navigator v4.x
Next Topic: How to nter in isqlplus enviornment
Goto Forum:
  


Current Time: Tue Aug 04 15:47:27 CDT 2020