Define - help (merged) [message #517438] |
Tue, 26 July 2011 02:22 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sathik
Messages: 196 Registered: August 2009 Location: INDIA
|
Senior Member |
|
|
Hi All,
To add application name in a spool file, I am using the below way.
sqlplus username/pwd@tns @xyz.sql APP0115
SQL> define appname="'&1'"
Enter value for 1: APP0115
SQL> prompt &appname
'APP0115'
SQL> spool &appname._html_jobs.csv;
SP2-0768: Illegal SPOOL command
Usage: SPOOL { <file> | OFF | OUT }
where <file> is file_name[.ext] [CRE[ATE]|REP[LACE]|APP[END]]
But I am getting the above error in the spool file clause because of single quote printing infront of the spool file. But the method of defining a character is "'&1'". So I cannot avoid this single quote in the define clause.
'APP0115'
can anybody help me to print the appname like APP0115 instead 'APP0115'.then only I can use this in the spool file clause?
|
|
|
|
define - help [message #517455 is a reply to message #517438] |
Tue, 26 July 2011 03:03 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sathik
Messages: 196 Registered: August 2009 Location: INDIA
|
Senior Member |
|
|
To add application name in a spool file, I am using the below way.
sqlplus username/pwd@tns @xyz.sql APP0115
SQL> define appname="'&1'"
Enter value for 1: APP0115
SQL> prompt &appname
'APP0115'
SQL> spool &appname._html_jobs.csv;
SP2-0768: Illegal SPOOL command
Usage: SPOOL { <file> | OFF | OUT }
where <file> is file_name[.ext] [CRE[ATE]|REP[LACE]|APP[END]]
But I am getting the above error in the spool file clause because of single quote printing infront of the spool file. I know the method of defining a character is "'&1'". So If I avoid this single quote in the define clause, I am getting the below error.
SQL> define appname="&1"
Enter value for 1: APP0115
SQL> prompt &appname
APP0115
SQL> spool &appname._html_jobs.csv;
SQL> select &appname from dual;
old 1: select &appname from dual
new 1: select APP0115 from dual
select APP0115 from dual
*
ERROR at line 1:
ORA-00904: "APP0115": invalid identifier
SQL> spool off;
can anybody help me to print the appname like APP0115 instead 'APP0115'.then only I can use this in the spool file clause?
|
|
|
Re: define - help [message #517456 is a reply to message #517455] |
Tue, 26 July 2011 03:06 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
select '&appname' from dual;
It is a follow-up to your previous question, so please post it and your next questions on the subject in the previous topic which is in "Client Tools" section.
Regards
Michel
|
|
|