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

后端 未结 6 1316
半阙折子戏
半阙折子戏 2020-12-02 12:03

Using SQL Plus, you can run a script with the \"@\" operator from the command line, as in:

c:\\>sqlplus username/password@databasename @\         


        
6条回答
  •  时光取名叫无心
    2020-12-02 12:52

    For UNIX (AIX):

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

提交回复
热议问题