Oracle语句

对一个表选择更新或者插入:

merge into TITEMTAB t1 using
(SELECT count(*) as count_ FROM tItemTab WHERE CHANNELID='1') t2
ON (t2.count_ > 0)
WHEN MATCHED THEN
UPDATE

SET CHANNELNAME='a' WHERE CHANNELID='1'

WHEN NOT MATCHED THEN
INSERT

VALUES('1','1', '1','a1', 'a1', 'a1')
;

 

两个日期间的天数:
select floor(sysdate - to_date('20020405','yyyymmdd')) from dual;

 

复制一个表中的部分数据插入同一个表:

insert into channelinfotab select day_ + 1, channel,play,charge from channelinfotab where day_=floor(sysdate + 1- to_date('19700101','yyyymmdd'));

你可能感兴趣的:(oracle)