日期:2014-05-17 浏览次数:20891 次
ges 50000 alter session set nls_date_format='MM-DD HH24:MI'; set term off column n.name format a8 column INDEX format 999999999999990 set lines 600 spool test select to_char(m.start_time,'yyyymmddhh24'), n.name,INDEX, sum(IUACT), sum(FAILACT) from tab1 m, tab2 n where m.iid = n.iid and to_char(m.start_time,'yyyymmddhh24') > '201111282000' group by to_char(m.start_time,'yyyymmddhh24'),n.name,INDEX order by to_char(m.start_time,'yyyymmddhh24'),n.name,INDEX
ges 50000 --不知道,没用过,哈哈 alter session set nls_date_format='MM-DD HH24:MI'; --设置当前session的日期显示格式 set term off column n.name format a8 column INDEX format 999999999999990 set lines 600 --设置行宽600 spool test --把下面select结果输出到test文件中 select to_char(m.start_time,'yyyymmddhh24'), n.name,INDEX, --把date类型的start_time转成字符型 sum(IUACT), sum(FAILACT) from tab1 m, tab2 n --tab1的别名是m,tab2的别名是n where m.iid = n.iid and to_char(m.start_time,'yyyymmddhh24') > '201111282000' group by to_char(m.start_time,'yyyymmddhh24'),n.name,INDEX order by to_char(m.start_time,'yyyymmddhh24'),n.name,INDEX
------解决方案--------------------
一部分是sqlplus命令,一部分是sql命令
to_char 是按照一定的格式将时间类型转成字符类型