Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: output format in SQL*Plus!!!??
select ename, deptno
from emp
where 1 = 2 -- Will never return any rows
UNION
select to_char(NULL) ename, to_number(NULL) deptno
from emp -- will return one row with nulls for the columns
/
note the conversion on the nulls to match the datatypes of the columns of
the first query
otherwise you will get an error
<ibm_97_at_yahoo.com> wrote in message news:94sn3i$cd8$1_at_nnrp1.deja.com...
> Oracle 8.1.6
>
> Hi, there:
>
> A query like:
>
> select col_a, col_b
> from table
> where .... ;
>
> col_a is varchar2; col_b is integer. When there's no value for "col_b"
> meet the "where" clause, Display is
> "no rows selected"
>
> How can I make the output like: (I still need the title of these
> columns, even though return nothing from query)
>
> col_a col_b
> ------ ----
>
>
> Thanks a lot!!
>
>
> Sent via Deja.com
> http://www.deja.com/
>
Received on Mon Jan 29 2001 - 22:42:05 CST