码迷,mamicode.com
首页 > 数据库 > 详细

bat执行sqlplus语句,省去@xx.sql过程

时间:2018-07-15 19:37:03      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:order by   --   union   bat   登录   sql   rom   sum   过程   

bat文件中执行写sqlplus连接,再@调用自己,sql登录成功后,会忽略掉第一行sqlplus xxx,转而执行下方的sql语句

----------------------------------------------------------------------------------------

sqlplus aixm/aixm@aixm @连接数.bat

select * from
(
select terminal,count(*) CNT   from v$session where username =‘AIXM‘
group by terminal
union
select ‘TOTAL‘, SUM(count(*) )
from v$session where username =‘AIXM‘
group by terminal
)
order by decode(terminal,‘TOTAL‘,1,0),cnt
;

bat执行sqlplus语句,省去@xx.sql过程

标签:order by   --   union   bat   登录   sql   rom   sum   过程   

原文地址:https://www.cnblogs.com/mol1995/p/9314011.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!