Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Query problem...

Re: Query problem...

From: Epicentre Team A ANNECY <djeanneret_at_epicentre.fr>
Date: Thu, 21 Mar 2002 14:19:27 +0100
Message-ID: <a7cmao$c2$1@wanadoo.fr>


You can use this

I've translate your sample with field and table of my database.

SELECT RTRIM(CAST(FAL_TASK_ID AS char(30))) || ':' || RTRIM(CAST(FAL_TASK_ID AS

char(30))) as "LIST" from FAL_TASK

Best regards

Denis

"Neo" <salil_khedkar_at_yahoo.com> wrote in message news:a6c24f5.0203210319.e7c0c68_at_posting.google.com...
> Hi Folks,
>
> I am working on a application designed for Microsoft SQL server which
> I am am now porting to Oracle.
>
> I want to get a ':' separated list of IDs from a table. So on MSSQL a
> query like works fine...
> SELECT RTRIM(CAST(FIELD1 AS char(30))) + ':' + RTRIM(CAST(FIELD2 AS
> char(30))) as LIST from TABLE1
> and return the following as result for example.
> 123:1234
> :123 (if first value is null)
> 123: (if first value is null)
> : (if first value is null)
>
> But on oracle if I do the same query
> SELECT RTRIM(CAST(FIELD1 AS char(30))) + ':' + RTRIM(CAST(FIELD2 AS
> char(30))) as "LIST" from TABLE1
> (1) It says I cant add mixed types like this
> (2) If I remove the + ':' + part, it gives me numeric addition of the
> two fields instead of string concatenation.
> (3) Finally, if any of the field is null, it does not return any value
> at all
>
> What is the correct query for oracle in this case?
>
> Regards,
> Neo
Received on Thu Mar 21 2002 - 07:19:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US