1、给表添加注释
comment on table MW_SYS.MWT_OM_OBJ1 is '业务类型的对象实例。';
comment on column MW_SYS.MWT_OM_OBJ1.OBJ_ID is '对象的唯一标示符。';
comment on column MW_SYS.MWT_OM_OBJ1.OBJ_LOCALID is '对象本地标识。';
comment on column MW_SYS.MWT_OM_OBJ1.OBJ_CAPTION is '用于缓存对象显示时的标题。';
comment on column MW_SYS.MWT_OM_OBJ1.CLS_ID is '类型的唯一标识符。';
comment on column MW_SYS.MWT_OM_OBJ1.SDOBJ_ID is '对象安全域的唯一标识符。';
comment on column MW_SYS.MWT_OM_OBJ1.STATE_ID is '状态的唯一标识符。';
2、extract()用法
SELECT EXTRACT(YEAR FROM SYSDATE) FROM DUAL; return Current Year
SELECT EXTRACT(MONTH FROM SYSDATE) FROM DUAL; return Current Month
SELECT EXTRACT(DAY FROM SYSDATE) FROM DUAL; return Current Day
SELECT EXTRACT(HOUR FROM SYSDATE) FROM DUAL;Error
3、sum()的高级用法
2005-05-09 胜
2005-05-09 胜
2005-05-09 负
2005-05-09 负
2005-05-10 胜
2005-05-10 负
2005-05-10 负
如果要生成下列结果, 该如何写sql语句?
胜 负
2005-05-09 2 2
2005-05-10 1 2
------------------------------------------
create table tmp(rq varchar(10),shengfu nchar(1))
insert into tmp values('2005-05-09','胜')
insert into tmp values('2005-05-09','胜')
insert into tmp values('2005-05-09','负')
insert into tmp values('2005-05-09','负')
insert into tmp values('2005-05-10','胜')
insert into tmp values('2005-05-10','负')
insert into tmp values('2005-05-10','负')
查询SQL:select rq, sum(case when shengfu='胜' then 1 else 0 end) '胜',
sum(case when shengfu='负' then 1 else 0 end) '负' from tmp group by rq
4、创建JOB
declare job1 number;
begin
sys.dbms_job.submit(job => job1,
what => 'mw_app.mwp_ud_pd_sb_xlbyqtj;',
next_date => sysdate,
interval => 'sysdate+1');
commit;
end;