求教这句sql什么意思。。。
select distinct
a.os_username os_user,
a.userhost,
a.username db_user,
to_char(a.timestamp,'yyyy-mm') Year_Month,
a.action_name action_name
from dba_audit_trail a
where a.timestamp >= to_date(to_char(sysdate,'yyyymm')-1||'16','yyyymmdd')
and a.timestamp < to_date(to_char(sysdate,'yyyymm')||'01','yyyymmdd')
and a.action in (100)
order by a.action_name
select distinct
a.os_username os_user,
a.userhost,
a.username db_user,
to_char(a.timestamp,'yyyy-mm') Year_Month,
a.action_name action_name
from dba_audit_trail a
where a.timestamp >= to_date(to_char(sysdate,'yyyymm')||'01','yyyymmdd')
and a.timestamp < to_date(to_char(sysdate,'yyyymm')||'16','yyyymmdd')
and a.action in (100)
order by a.action_name
如果 不知道意思 可以单独查询出来
to_date(to_char(sysdate,'yyyymm')
[解决办法]
'01','yyyymmdd')
1、to_char(sysdate,'yyyymm') 先查询当前年月 201309
2、
[解决办法]
'01'
[解决办法]
为合并符号 结果会显示20130901 就是当前月份的第一天
3、to_date 然后将第一天转换成日期格式
4、表中数据 根据这个时间段来过滤出 符合当月1-16号的数据