Hi Friends,
Is it possible to execute SQL or PL/SQL commands from Unix shell prompt. For example, I want to execute a CREATE COMMAND from "$" prompt.
eg.
$ sqlplus SCOTT/TIGER CREATE TABLE t1(I INT)
Thanks
gandhi
Printable View
Hi Friends,
Is it possible to execute SQL or PL/SQL commands from Unix shell prompt. For example, I want to execute a CREATE COMMAND from "$" prompt.
eg.
$ sqlplus SCOTT/TIGER CREATE TABLE t1(I INT)
Thanks
gandhi
Code:sqlplus -s /nolog "<<"ENDSQL
connect connectstring
@script1.sql or put your SQL script here.
EXIT;
ENDSQL
Why don't you search in the net?
Note: Please remove the "" from "<<"ENDSQL.
I am trying to execute OS commands through PL/SQL, you are trying to execute Oracle command on OS level :-) What a world...Quote:
Originally posted by gandhi
Hi Friends,
Is it possible to execute SQL or PL/SQL commands from Unix shell prompt. For example, I want to execute a CREATE COMMAND from "$" prompt.
eg.
$ sqlplus SCOTT/TIGER CREATE TABLE t1(I INT)
Thanks
gandhi
Hi,
The previous explanation is correct.
$sqlplus /nolog < now u can write all the sql command after giving the connect string.
to end your session.
you need to give !END
once again.
This is more helpful in making shell scripts which interact with oracle.
eg.
sqlplus /nolog < alter system switch logfile
<
I hope this helps
Thanks