1.Java中调用sqlplus执行文件中的sql语句
String cmd = "sqlplus test/test@orcl @D://sql//database.sql";
Runtime.getRuntime.exec(cmd);
2.CMD中调用sqlplus执行文件中的sql语句:
sqlplus username/password@instanceNname @c://a.sql
3.执行多个sql文件:
sql文件开头添加[set define off]避免'&'字符,最后添加[quit]命令
1>把所有的sql文件都放在同一个目录下,然后在命令行里执行命令:
c:>dir/b > d:\1.sql 会把所有的sql文件名都输出到一个sql文件中。
2>用UltraEdit打开生成的sql文件,alt+C切换到column mode,给所有的行前都添加一个,保存。
3>在sqlplus中执行:“@d:\1.sql”.
4.sqlplus 能生产xls的excel文件:
set markup html on;
spool c:abc.xls
select * from tab;
spool off;