Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie SQL help needed - URGENT
pawanputrahanuman_at_yahoo.com said...
> Thanks Karsten. But it does not work.
>
> Karsten Farrell <kfarrell_at_belgariad.com> wrote in message news:<MPG.19368fe941161d5e98978d_at_news.la.sbcglobal.net>...
> > pawanputrahanuman_at_yahoo.com said...
> > [snip]
> > > SUM(decode(upper(b.CATG),'OTH',b.PMT_AMT,null)) ||'|'||
> > > c.BRD_ALT_DS,
> > > c.EVENT_START_DT,
> > > c.PRICE_AMT
> > [snip]
> > >
> > sum(decode(upper(b.catg),'OTH',b.pmt_amt,null)) || '|' ||
> > c.brd_alt_ds || '|' ||
> > to_char(c.event_start_dt,'yyyy-mm-dd') || '|' ||
> > to_char(c.price_amt,'999.99')
>
Depends on how you define "does not work."
SQL> create table xyz(
2 mystring varchar2(10),
3 mydate date,
4 myamt number(8,2));
Table created.
SQL> insert into xyz values ( 'Product1', 2 to_date('2003-01-01','yyyy-mm-dd'), 3 3.94);
1 row created.
SQL> insert into xyz values ( 'Product2', 2 to_date('2003-02-01','yyyy-mm-dd'), 3 3.65);
1 row created.
SQL> insert into xyz values ( 'Product3', 2 to_date('2003-02-22','yyyy-mm-dd'), 3 6.64);
1 row created.
SQL> insert into xyz values ( 'Product3', 2 to_date('2003-01-01','yyyy-mm-dd'), 3 9.58);
1 row created.
SQL> insert into xyz values ( 'Product4', 2 to_date('2003-01-01','yyyy-mm-dd'), 3 12.99);
1 row created.
SQL> select mystring || '|' ||
2 to_char(mydate,'yyyy-mm-dd') || '|' || 3 to_char(myamt,'999.99')
MYSTRING||'|'||TO_CHAR(MYDATE
Product1|2003-01-01| 3.94 Product2|2003-02-01| 3.65 Product3|2003-02-22| 6.64 Product3|2003-01-01| 9.58 Product4|2003-01-01| 12.99
5 rows selected.
SQL>
-- /Karsten DBA > retired > DBAReceived on Fri May 23 2003 - 15:39:17 CDT