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
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
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 of
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 at
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,
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 value
define myvar='whats up, doc?'
select 'myvar' from dba_objects;
Erik Williams [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
01/15/2003 07:04 AM
Please respond to ORACLE-L
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
cc:
Subject:SQLPlus
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
Something like this, perhaps.
accept var1 char prompt 'What grantee? ';
select *
from dba_sys_privs
where grantee = upper('var1');
-Original Message-
From: Erik Williams [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 10:04 AM
To: Multiple recipients of list ORACLE-L
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 =
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
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
[EMAIL
12 matches
Mail list logo