Oracle/SQLPlus help - ksh Script calling .sql file not 'pausing' at ACCEPT, can't figure out why
Hi,
I am trying to write a script that calls an Oracle SQL file who in turns call another SQL file. This same SQL file has to be run against the same database but using different username and password at each loop.
The first SQL file is basically a connection test and it is supposed to sort of pause and the user is to press enter to continue or CTRL-C to exit. CTRL-C wouldn't be the right choice, I will be changing to a Y or N preferably at some point, at the moment, the main problem is getting the script to prompt/pause.
Below is a sample run of the scripts, I have to remove the real username, password and database.
Here it is running the UNIX script. I am expecting it to prompt/pause but it didn't. The script call sqlplus to run x_main.sql that is supposed to prompt for a user input before running the x_test.sql script
For the run below, it run without prompting/pausing. It didn't even run the script twice like we are expecting too since the while loop has two username/password entries to read.
Here it is not using x_main.ksh. We run sqlplus from the command line instead and run x_main.sql as below. This time it prompt/pause as we've expected.
Below is the x_main.ksh script
Below are the .sql file
x_schema.txt contains username/password it has two entries when I ran the x_main.ksh script. Its entries are in the form like below:
Please advise if anyone knows what am I doing wrong. Thanks in advance.
What you are trying to do won't work with this method of file reading:
because the next line from "myfile" will be fed as a response to the "accept" command in the sqlplus script within the loop.
You will have to read your file using the file descriptor method.
Change your "x_main.ksh" to something like this:
Friends,
I'm newbie with ksh so wanting some help....
1. I'm trying to call oracle stored procedure from ksh script by taking variable value from runtime, feed into script and execute procedure.
2. Put name1 and name2 value from script run replacing $3 & $4
I'm trying to put name1 in... (4 Replies)
I have a shell script like this:
#!/bin/sh
$PYTHON MetarDecoder.py < ../data/mtrs/arg1/arg2
And I'm calling it with this in perl:
my $output = `./metar_parse.sh --options`;
It's successful when I put in actual values for arg1 and arg2 in the shell script, but I'd like to pass arguments... (1 Reply)
Hi,
I am trying to call sql script from ksh job with parameters.The parameters passed from ksh job will be used in SELECT query in sql file to SPOOL the data in extract file.My questions are:
1) How to call a sql script from ksh job with parameters?
2) How to use the parameter in sql file to... (1 Reply)
Hi,
I want to call a sql file in my shell script. see the below code:-
if ]
then
(
isql -U${S_USER} -S${S_SERV} -w100 -b -h0 <<ENDSQL | sed -e "s/Password://"
${S_PWD}
set nocount on
go
use ${S_DB}
go
// need to call a file name... (16 Replies)
Hi,
I need help urgently for following issue. Pls help me to resolve this issue.
I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql)
I given... (6 Replies)
Hi
I have a shell script that call a sql file. The sql file will create a spool file.
My requirement is, when ever i get an OS error like file not found. I have to log it in a log file.
Could some who worked in a like scenario help me by giving the code sample.
Many Thanks.. (1 Reply)
Hello everybody
I need help calling sql file from shell script.
Can anyone help me creating a small shell script which calls an sql file .
The .sql file should contain some select statements like
select emp_no from emp_table;
select emp_id from emp_table;
And the results should be... (6 Replies)
I have created abc.sh file which will set the environment variables (UNIX env variables as well as ORACLE required variables like ORACLE_SID,ORACLE_HOME etc) and then calls a function file which checks for starts some logs and then it will try to execute the .sql file. The .sh, function file are as... (1 Reply)
Hi all,
Iam facing a lot of problem while calling Oracle 10g SQLPLUS files from shell.
What is the standard procedures to be taken care.
Any help would be useful for me.
Thanks in advance,
Ganapati. (2 Replies)