RE: using a parameter as variable

RE: using a parameter as variable

 

  

You can try ACCEPT !!!

accept file_loc prompt 'File location to spool (optional) : '

test.sql will hold the below sql query

select '&file_loc'||DECODE('&file_loc',null,'', '\')||
host_name||'_'||instance_name||'_db.doc' flnm
from v$instance;


In sqlplus -
accept file_loc prompt 'File location to spool (optional) : '
File location to spool (optional) : c:\temp

@temp.sql
old 1: select '&file_loc'||DECODE('&file_loc',null,'', '\')||
new 1: select 'c:\temp'||DECODE('c:\temp',null,'', '\')||
c:\temp\hostname_sai_db.doc

Hope this helps !!!

Kishore



-----Original Message-----
From: Harro M. Wiersma [mailto:Harro.[Email Address Removed] Thursday, October 30, 2003 3:26 PM
To: LazyDBA.com Discussion
Subject: using a parameter as variable


Hi Folks,

I'm trying to use a parameter which I give while executing a sql file in
that same
sqlfile ( sqlplus system/password @e:\hot-backup.sql f:\backup ) where I
want
to use the f:\backup param in the script. I allready tried it with

variable c_backup_dir varchar2(255)
begin
:c_backup_dir := '&1';
end;

and changed the &1 in %1 and &&1, but I still do not get f:\backup in my
script.
our developper doesn't know either ... who can help me?

Harro

====================================================================
De informatie verzonden door middel van dit bericht is uitsluitend bestemd
voor de geadresseerde(n). Gebruik van deze informatie door anderen dan de
geadresseerde(n) is verboden. Openbaarmaking, vermenigvuldiging,
verspreiding en/of verstrekking van deze informatie aan derden is niet
toegestaan. Westland Energie staat niet in voor de juiste en volledige
overbrenging van de inhoud van een verzonden bericht, noch voor de tijdige
ontvangst daarvan. Aan de inhoud van dit bericht kunnen geen rechten worden
ontleend.
====================================================================
No rights may be derived from the contents of this message. The information
in this message is intended only for the addressee. Westland Energie cannot
vouch for the correctness and completeness of the contents of messages, nor
for the timely receipt thereof.
====================================================================


****************************************************************************
This communication contains information, which is confidential and may also
be privileged. It is for the exclusive use of the intended recipient(s). If
you are not the intended recipient(s), please note that any distribution,
printing, copying or use of this communication or the information in it is
strictly prohibited. If you have received this communication in error,
please notify the sender immediately and then destroy any copies of it.
****************************************************************************
Oracle LazyDBA home page