【问题标题】:Execute sqlplus commands in shell script在 shell 脚本中执行 sqlplus 命令
【发布时间】:2016-03-25 01:11:07
【问题描述】:

假设我需要从 shell 脚本执行一些 sql 代码。
有什么简单而简洁的方法可以做到这一点?

【问题讨论】:

  • 已经有很多关于从 shell 脚本运行 SQL*Plus 的问题 - 另一个有用吗?

标签: shell sqlplus


【解决方案1】:
sqlplus -s /nolog <<EOF
whenever sqlerror exit sql.sqlcode;
set echo on;
set serveroutput on;
connect <user>/<pass>@<host>:<port>/<sid>

delete from <table_name> where <...>;
...

quit;
EOF

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-22
    • 2012-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多