在报告中隐藏具有 NULL 值的列 (Oracle 假脱机)

Hide Column with NULL Value on Report (Oracle Spool)

我有这样的数据:

Name            Birthday             Telephone              Remarks
-------------   --------------       ---------------        ---------------
Andrew          8-Jun-1989           97827197               (null)
John            19-Sep-1988          87920187               (null)

我只想在报告中显示不为空的列。像这样:

Name            Birthday             Telephone              
-------------   --------------       ---------------        
Andrew          8-Jun-1989           97827197              
John            19-Sep-1988          87920187         

如何在 Oracle Spool 上执行此操作?已经尝试在 spool 之后或之前对 SELECT 语句使用 NVLCASE WHEN IS NULL,但这没有用。还有其他方法可以隐藏具有 NULL 值的列吗?提前致谢。

您可以使用 SET NULL 命令来解决这个问题。

SQL> set null (null)
SQL> select * from dob;

NAME             BIRTHDAY  TELEPHONE  REMARKS
-------------------- --------- ---------- ----------
john             11-APR-16 984563732  no rem
john             11-APR-16 984563732  (null)

SQL> set null ""
SQL> select * from dob;

NAME             BIRTHDAY  TELEPHONE  REMARKS
-------------------- --------- ---------- ----------
john             11-APR-16 984563732  no rem
john             11-APR-16 984563732

或者如果你想排除列你可以 select columns from tbl.

在列定义中使用 noprint。 像, 专栏备注 col 备注 noprint ;