可以用两个sql语句解决,第一个语句将select col_2 from tab_2 where condition_1不空的col_1表赋值,第二个语句将select col_2 from tab_2 where condition_1空的col_1表赋值,可以在coldition_2后面在增加一个条件来区分以上两个语句。
解决方案 »
- oracle11g ORA-01034:oracle not available ORA-27101:shared memory realm does not
- PLSQL Developer登录后总是显示程序无响应
- 存储过程问题
- ORACLE数据库可加载,但无法打开,26日早上出现的问题
- ORACLE FUNCTION返回集合的问题
- drop表的问题
- 请问为什么sql loader导入CSV文件后产生日志文件不能追加?
- Primary key 和 Unique column
- 在线等:怎么用一条sql语句进行三个表和三个以上表的级联搜索?
- 新建数据库问题
- 大家帮帮忙,下面的sql还能怎么优化,现在执行它一共才400多条纪录得花费近一分钟的时间!
- 各位高手,请教有关动态SQL的问题
select col_2 into v_Col_2 from tab_2 where condition_1;
if v_Col_2 is null
.. = 'none'
else
.. = (select...)
end if
对吗我想有没有nvl或者decode能嵌套sql之类的效果……?
set col_1 =
(select nvl(col_2,'none') from tab_2 where condition_1)
where condition_2
;