Reputation: 7
This is probably a very silly question, but here it goes...
This is my syntax for getting some data using sqlplus in Unix command line:
echo pwd|sqlplus -S -L user@db @mysqlfile >> otherfile
It works OK, but 'otherfile' starts with the line 'Enter password:', which is pretty annoying, and it makes for extra code for parsing results. So the question is:
How do I get rid of the 'Enter password:' line? Am I doing something wrong there?
Thanks.
Upvotes: 0
Views: 288
Reputation: 8123
It is possible if you pass the connect command to the sqlplus
, along with the script you want to execute. You'll also have to utilize the /nolog
and -S
(silent) options:
[oracle@localhost]$ cat mysqlfile.sql
select * from dual;
[oracle@localhost]$ (echo connect username/secretpassword ; echo @mysqlfile) | sqlplus -S /nolog >> out
[oracle@localhost]$ cat out
D
-
X
[oracle@localhost]$
Edit: Using your parameters:
(echo connect user/pwd ; echo @mysqlfile) | sqlplus -S /nolog >> otherfile
Upvotes: 2