Re: SQL statement question ........

From: Simon Hedges <shedges_at_hhhh.freeserve.co.uk>
Date: Sat, 12 Jun 1999 15:05:27 +0100
Message-ID: <7jtpgu$ikm$1_at_news4.svr.pol.co.uk>


Jimmy wrote:

> I have a table aaa as follows:
>
> create table T_aa (
> aaa date,
> bbb varchar2(10),
> ccc number);
>
> And I want to get the following result with SQL select statement:
>
> a_date, bbb, ccc
> 01-Jan-1999,50,1
> 02-Jan-1999,,1
> 03-Jan-1999,70,2
> (column aaa renamed to a_date)
>
> And I write the following SQL statement:
>
> select to_char(aaa, 'DD-MON-YYYY') a_date || ',' || bbb || ',' ||ccc
> from T_aa;
>
> however, the above statement is invalid. Is is possible to get the
> result that I want by using a single SQL statement?

Yes it is. You could try
to_char(a_date) || ',' || bbb || ',' ||to_char(ccc)

You may need to fiddle with the to_char around the date in order to get exactly the date format you need.

I hope this works.

Simon Hedges
Gloucester
UK

Jimmy <c6635500_at_comp.polyu.edu.hk> wrote in message news:3763333A.3F096431_at_comp.polyu.edu.hk...
> Hello all,
>
> I have a table aaa as follows:
>
> create table T_aa (
> aaa date,
> bbb varchar2(10),
> ccc number);
>
> And I want to get the following result with SQL select statement:
>
> a_date, bbb, ccc
> 01-Jan-1999,50,1
> 02-Jan-1999,,1
> 03-Jan-1999,70,2
> (column aaa renamed to a_date)
>
> And I write the following SQL statement:
>
> select to_char(aaa, 'DD-MON-YYYY') a_date || ',' || bbb || ',' ||ccc
> from T_aa;
>
> however, the above statement is invalid. Is is possible to get the
> result that I want by using a single SQL statement?
>
> Thanks,
> Jimmy
>
>
Received on Sat Jun 12 1999 - 16:05:27 CEST

Original text of this message