I was not looking to pass the variable in when calling the script, but to
explicitly set it at the beginning of the script so that I could use it over
again in multiple statements. Kind of like what the preprocessor does, it
replaces all instances of the defined variable with a constant. The DEFINE
To expand on your description of define, I thought Erik may be looking
for a way to pass the variables in. Maybe this will be of some use.
sqlplus id/pwd @test 'a b c' 'd e f'
Where test.sql is:
define field1 = '&1'
define field2 = '&2'
select '&field1', '&field2' from dual;
HTH,
John
>>> [E
If you pass arguments to your script, they would get reflected in the
substitution variables defined in the script.
test1.sql:
*
Disclaimer
This message (including any attachments) contains
confidential information intended for a specific
I'm not sure this is what you wnat, but here is a short example of the use
of DEFINE / UNDEFINE and && (Accept once but use many times inside script
without re-prompt)
--
define testtyp = Repair
/
select * from buy_type where buy_typ = '&&tes
AM
> To: Multiple recipients of list ORACLE-L
> Subject: SQLPlus Substitution Variables
>
>
> I am using substitution variables in SQLPlus, but don't want
> to be prompted
> for their values. I want to set them at the start of the
> script. Kind of
> like a prepr
You can use the SQL*Plus commands DEFINE to provide values for variables
and UNDEFINE to "reset" them.
Karen
Original Message:
-
Date: Wed, 15 Jan 2003 07:04:18 -0800
To: [EMAIL PROTECTED]
I am using substitution variables in SQLPlus, but don't want to be prompted
for their val
TECTED]>
cc:
Subject:SQLPlus Substitution Variables
I am using substitution variables in SQLPlus, but don't want to be
prompted
for their values. I want to set them at the start of the script. Kind of
like a preprocessor directive. Is this possible?
Erik
--
Please see the
Yes.
SQL> define tname = t1
SQL> select * from &tname where rownum < 2;
old 1: select * from &&tname where rownum < 2
new 1: select * from t1 where rownum < 2
EMPNUM SEQNUM LAST_BID
-- -- --
100 1 0
SQL> undefine tname
SQL> /
Enter
That's not quite what he asked for...
Erik, you're looking for the DEFINE command, and you don't really need to
use '&&' either (unless you want to reuse the script without the DEFINE),
e.g.:
define datestamp = "sysdate - 1"
select count(*) from logtab2003
where datestamp = to_char(&datestamp, '
Use && instead of & and you should not get prompted if the variable has a
value set.
-Original Message-
Sent: 15 January 2003 15:04
To: Multiple recipients of list ORACLE-L
I am using substitution variables in SQLPlus, but don't want to be prompted
for their values. I want to set them a
SET SCAN OFF
- Original Message -
To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 3:04 PM
> I am using substitution variables in SQLPlus, but don't want to be
prompted
> for their values. I want to set them at the start of the script. Kind
You can explicitly assign the values in the script or you can use parameters
and pass in the values. Make sure you use the && and not &.
Dan Fink
-Original Message-
Sent: Wednesday, January 15, 2003 8:04 AM
To: Multiple recipients of list ORACLE-L
I am using substitution variables in SQ
I am using substitution variables in SQLPlus, but don't want to be prompted
for their values. I want to set them at the start of the script. Kind of
like a preprocessor directive. Is this possible?
Erik
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Erik Williams
INE
13 matches
Mail list logo