新建txt文件编写代码:

sqlplus c##scott/tiger @runsql.sql

用户名c##scott

密码tiger

将文件后缀改为.bat

新建txt文件编写,文件名为runsql

编写代码

1 conn c##scott/tiger
2 --写你的sql语句
3 select * from (select * from dept order by rownum) where rownum<2;
4 commit;
5 pause;
6 exit;

将文件名改为runsql.sql

执行.bat文件即可

如果需要将结果输出到文本文件的话,利用spool缓冲池

1 conn c##scott/tiger
2 spool d:\output.txt
3 select * from (select * from dept order by rownum) where rownum<2;
4 commit;
5 spool off;
6 pause;
7 exit;

 spool d:\output.txt 指定输出的路径和文件

最后输入缓冲结果命令

spool off; 

相关文章:

  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2021-07-03
  • 2021-08-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2022-03-03
  • 2021-06-12
  • 2022-01-26
相关资源
相似解决方案