在shell脚本中执行sqlplus命令

时间:2016-03-24 17:05:54

标签: shell sqlplus

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

1 个答案:

答案 0 :(得分:2)

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
相关问题