-
Diffrence between & && in spool file name
Hi All,
What is the difference between & and && in sql*plus spool file
e.g
&myfile.txt
&&myfile.txt
Thanks
-
is it @ or &?
@ pathname Run an SQL Script (see START)
@MyScript.sql parameter1 parameter2 parameter3
In the SQL-Script, refer to the parameters as &1, &2, and &3.
@@ pathname Run a nested SQL Script.
/ Execute (or re-execute) commands in the SQL*Plus buffer
does not list commands before running
Cheers!
OraKid.
-
Hello balajiyes,
I think I have cleared mentioned spool 'file name'
let's say you spooling output into a spool file and you wana datestamp before the file name like below example.
column col1 new_value myfile noprint
select to_char(sysdate,'YYYYMMDD') col1 from dual;
spool c:\&myfile.txt OR spool c:\&&myfile.txt
.
.
spool off
Now the question is what is the difference between & and && in sql*plus spool file, see below
spool c:\&myfile.txt;
and
spool c:\&&myfile.txt;
Thanks in advance.
-
-
Hi,
The problem am facing is according to the below example
column col1 new_value myfile noprint
select to_char(sysdate,'YYYYMMDD') col1 from dual;
---------------------------
(If I use single &, then I get on my c:\ file name as &myfile.txt)
spool c:\&myfile.txt
.
.
spool off
---------------------------
---------------------------
(If I use double &&, then I get on my c:\ file name as &20031230.txt)
spool c:\&&myfile.txt
.
.
spool off
---------------------------
I don't know what part I am missing, what I should perform in order to get the the proper file name like 20031230.txt
Thanks.
-
This is a cut from one of the scripts that I have written and
it gives me the results you are looking for...
column DAY_NAME new_value file_day noprint
select trunc(SYSDATE) DAY_NAME FROM DUAL;
spool c:\File_&&whichday..txt
HTH
Gregg
-
It looks to me as if the \ is acting as an "escape" character, preventing the following & being interpreted as the "define" character. What happens if you do a "set escape off" first?
You can use the escape character before the substitution character (set through SET DEFINE) to indicate that SQL*Plus should treat the substitution character as an ordinary character rather than as a request for variable substitution.
I don't fully follow Gregg's example - but it avoids the problem because the & does not follow the \.
-
Hello Dapi,
Excellent!!! it works with SET ESCAPE OFF.
Thanks for your help to resolve this issue.
-
&& stores the variable in sqlplus session, & does not
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|