How can I issue a single command from the command line through sql plus? How can I issue a single command from the command line through sql plus? oracle oracle

How can I issue a single command from the command line through sql plus?


I'm able to run an SQL query by piping it to SQL*Plus:

@echo select count(*) from table; | sqlplus username/password@database

Give

@echo execute some_procedure | sqlplus username/password@databasename

a try.


Have you tried something like this?

sqlplus username/password@database < "EXECUTE some_proc /"

Seems like in UNIX you can do:

sqlplus username/password@database <<EOFEXECUTE some_proc;EXIT;EOF

But I'm not sure what the windows equivalent of that would be.


For UNIX (AIX):

export ORACLE_HOME=/oracleClient/app/oracle/product/versionexport DBUSER=fooUserexport DBPASSWD=fooPWexport DBNAME=fooSchema echo "select * from someTable;" | $ORACLE_HOME/bin/sqlplus $DBUSER/$DBPASSWD@$DBNAME