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_nameselect 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求教这几句话是什么意思???
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_nameselect 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求教这几句话是什么意思???
有啥特殊,难懂的地方?
and a.timestamp < to_date(to_char(sysdate,'yyyymm')||'16','yyyymmdd')
这两句不明白是什么意思oracle以前没用过
timestamp < 本月十六号
and a.timestamp < to_date(to_char(sysdate,'yyyymm')||'16','yyyymmdd')
这两句不明白是什么意思oracle以前没用过
这个就是个简单的日期比对啊。 timestamp 也是 oracle 的一个日期类型,精度高点而已。
2、||'01' ||为合并符号 结果会显示20130901 就是当前月份的第一天
3、to_date 然后将第一天转换成日期格式
4、表中数据 根据这个时间段来过滤出 符合当月1-16号的数据