Home » SQL & PL/SQL » SQL & PL/SQL » Calling .sql file from .ksh file (10g Release 2)
Calling .sql file from .ksh file [message #597379] Fri, 04 October 2013 03:25 Go to next message
arunprakash647
Messages: 5
Registered: August 2013
Junior Member
scripts.sql file content
set verify off ;
set echo on ;
set termout off ;
set feedback off ;
set heading off ;

column PASSWORD new_value MOTDEPASSE ;

select oracle1.scb_util.boil_raw(repadmin.decrypt(PASSWORD),'VARCHAR2') PASSWORD from REPLIC_QUEUE.REPLIC_PASSWORDS where USERNAME = '&1' ;
echo "connecting to database";
connect &1/&&MOTDEPASSE ;


.ksh file content
sqlplus -s /@$ORACLE_SID << END
@$scripts.sql admin;


seems like the scripts.sql is not executed when called from the .ksh file.
Could any one help in resolving this issue?

Thanks in advance.
Re: Calling .sql file from .ksh file [message #597380 is a reply to message #597379] Fri, 04 October 2013 03:31 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
What is error you see in the log file?
Re: Calling .sql file from .ksh file [message #597381 is a reply to message #597380] Fri, 04 October 2013 03:36 Go to previous messageGo to next message
arunprakash647
Messages: 5
Registered: August 2013
Junior Member
at the end of the .ksh file i have added 'END;'

error message 'SP2-0042: unknown command "END" - rest of line ignored.'.

as far as i know, it is not even entering the sql file for execution.
Re: Calling .sql file from .ksh file [message #597382 is a reply to message #597381] Fri, 04 October 2013 04:13 Go to previous messageGo to next message
dariyoosh
Messages: 538
Registered: March 2009
Location: France
Senior Member
Hi,

END is not a shell command, and obviously KSH will reject it. What are you trying to do exactly?

For the authentication, have a look at Secure External Password Store, maybe this is what are you looking for.

Regards,
Dariyoosh

[Updated on: Fri, 04 October 2013 04:18]

Report message to a moderator

Re: Calling .sql file from .ksh file [message #597383 is a reply to message #597379] Fri, 04 October 2013 04:20 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
arunprakash647 wrote on Fri, 04 October 2013 13:55
@$scripts.sql admin;


??? How do you interpret @$?
Re: Calling .sql file from .ksh file [message #597385 is a reply to message #597383] Fri, 04 October 2013 04:25 Go to previous messageGo to next message
arunprakash647
Messages: 5
Registered: August 2013
Junior Member
@lalit - sorry, it is only @scripts.sql and not @$scripts.sql
Re: Calling .sql file from .ksh file [message #597393 is a reply to message #597379] Fri, 04 October 2013 06:11 Go to previous messageGo to next message
tigsav
Messages: 49
Registered: April 2012
Member
Hi,
The END you have written is actually an indicator.
You can write the entire contents of scripts.sql after writing END
and once you have done it write END again to imply you have finished with the sql processing.

For Eg :
#!/bin/ksh
sqlplus /nolog << EOF
CONNECT scott/tiger
SPOOL /u01/emp.lst
SET LINESIZE 100
SET PAGESIZE 50
SELECT *
FROM emp;
SPOOL OFF
EXIT;
EOF
icon13.gif  Re: Calling .sql file from .ksh file [message #597428 is a reply to message #597379] Fri, 04 October 2013 11:06 Go to previous message
Michel Cadot
Messages: 68637
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

I think you should read again your previous topic answers: ...using sh script with out the password

Previous Topic: To check hanging/not run/failed jobs
Next Topic: Is it possible to fetch file path from a folder through PL/SQL
Goto Forum:
  


Current Time: Tue Apr 16 15:23:25 CDT 2024