表里有shop1,shop2....shopn这样的n个字段,对于某条数据,这n个字段有的有值,有的为空,我想查询出所有数据对应的有值的字段,怎么做??
解决方案 »
- pl/sql developer 建表时的分号问题
- to_date('2006-01-02','yyyy-mm-dd')在oracle中执行后的值为:2006-1-2,怎样使其保持2006-01-02不变?
- 请教简单的Oracle 查询语句
- 弱弱的问题
- 请问“oracle is not valiable",这是什么意思?
- 谁有TOAD的注册码
- 请问OCI有无操作ORACLE字符集的函数
- orcal81加了一片网卡后,客户端不能通过这片网卡连上服务器了?求解
- oracle进程
- Oracle 存储过程,如何改进下面这个存储过程,Oracle是否有split函数
- Server2003 64位系统上32 oracle10g的安装与连接问题
- 请问如何统计两个字段都相等的记录条数?
(
select 'yes' shop1, null shop2, 'yes' shop3 from dual
union all
select null shop1, null shop2, 'yes' shop3 from dual
union all
select null shop1, 'yes' shop2, null shop3 from dual
)
select regexp_replace(
(trim('|' from
decode(shop1, null, '', 'shop1') || '|' ||
decode(shop2, null, '', 'shop2') || '|' ||
decode(shop3, null, '', 'shop3')
)), '[|]+', '|')
from tmp;RESULT
-------------
shop1|shop3
shop3
shop2