oracle 中的插入语句要条件判断怎么写?

oracle 中的插入语句要条件判断怎么写?,第1张

insert into table1 values(a1,a2,aid in(select aid from p where pname=''),cid in (select sid from u where uname='aa'))
应该要把 aid in ,cid in去掉吧?
最简单的方式,把后面两个字段设置为非空,让oracle报错去。。呵呵

你不是写出来了么?
to_date( to_char(sysdate,'YYYY-MM')|| '-01','YYYY-MM-DD')取得月初
add_months(to_date( to_char(sysdate,'YYYY-MM')|| '-01','YYYY-MM-DD') ,1) 取得下月初
具体 where 子句如下
oper_date >= to_date( to_char(sysdate,'YYYY-MM')|| '-01','YYYY-MM-DD')
and oper_date< add_months(to_date( to_char(sysdate,'YYYY-MM')|| '-01','YYYY-MM-DD') ,1)

where pcstatus != 2 and (startDate between pcprojectStartDate and pcprojectEndDate or endDate between pcprojectStartDate and pcprojectEndDate)
-----------------------------这样也可以------------------------------------------------------
where pcstatus != 2 and (( startDate between pcprojectStartDate and pcprojectEndDate) or (endDate between pcprojectStartDate and pcprojectEndDate))
--------------------------------
这个问题的分类应该是数据库软件编程的。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/13386703.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-26
下一篇 2023-07-26

发表评论

登录后才能评论

评论列表(0条)

保存