Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

passing arguments in spool file

913578Mar 14 2014 — edited Mar 14 2014

Hi,

I am suppose to generate a spool file, which takes two parameters

1. txt file the file where spooled data to be stroed

2. S or C where S=space C=Concate(Pipe symbol)  this is the value/data separator i am passing at run time

the execution command is like this.

SQL> @spool.sql  data.txt C

I have written spool.sql  file like this.

--------------------------------------------------

set header off;

set feedback off;  ect......

spool &1

variable v_input varchar2(2);

begin

if &2='S' then

:v_input:=' ';

else

:v_input:='|';

end if;

end;

/

select empno|| :v_input || ename || :v_input || sal ||:v_input || hiredate from emp;

spool off;

when i run the execution command, getting error like.

identifier 'S' must be declared.

please suggest me am i doing any thng wrong here.

This post has been answered by 913578 on Mar 14 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 11 2014
Added on Mar 14 2014
2 comments
967 views