在oracle中仅选择没有null或空值的列 [英] Select only columns without null or blank values in oracle

查看:88
本文介绍了在oracle中仅选择没有null或空值的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How can I select only columns that don't have null value

col1 col2 col3
20    12   null
25    null     null

Desired output

col1 col2 
20    12  
25    null





我尝试了什么:



没有办法出来.................................................. .....



What I have tried:

Not getting way to come out.......................................................

推荐答案

结果集的结构本质上是静态的。换句话说,你在构建查询时决定列。



据我所知,你几乎没有选择:



1.首先运行查询以查看哪些列包含数据,然后使用仅包含所需列的动态构建的SELECT子句再次运行查询

2.将数据读取到单个,XML列,适当处理

3.获取所有列并处理客户端格式化



从这些,选项3最多因为SQL不是为格式化而设计的,只是提取和操作数据。
The structure of the result set is static in nature. In other words, you decide the columns when you build the query.

As far as I can see, you have few options:

1. first run a query to see which columns contain data and then run a query again with dynamically built SELECT clause containing only desired columns
2. Fetch the data into a single, XML column, handle appropriately
3. Fetch all the columns and handle formatting on client side

From those, option 3 makes most sense since SQL isn't designed for formatting, just fetching and manipulating data.


这篇关于在oracle中仅选择没有null或空值的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆