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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL*PLUS select statment

Re: SQL*PLUS select statment

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Thu, 07 Jun 2007 16:33:51 +0200
Message-ID: <4668174F.7080500@gmail.com>


sunadmn schrieb:
> Ok here is the issue I have right now.
>
> In the above select (first one) it appears to me that this is looking
> at particulars with regards to the return data (numeric data) i.e.:
>
> SELECT 6577 "COUNT",
> 6146 GOOD_COUNT,
> 91 FAIR_COUNT,
> 340 UNACCEPTABLE_COUNT,
>
> To me means select 6577,6146,91,340 from the corresponding. Because
> this is dynamic data that changes every day/hour/minute these values
> can't be hard coded. I did try to fool around (and I do mean "Fool")
> with the query and modify it to the way I need it and I could not get
> dynamic data back with that said how could I turn this into a dynamic
> query that just pulls whatever data is in the data source to get a
> dynamic set? Am I making any sense here? Am I just overlooking the
> obvious?
>
> Thanks,
> -Steve
>

Forget for a moment about WITH part of this query, assuming, your data is in the table EVERYDAY_SUMMARY,
don't

SELECT
DECODE(RN,1,'COUNT',2,'GOOD_COUNT',3,'FAIR_COUNT',4,'UNACCEPTABLE_COUNT') COUNT_TYPE,   DECODE(RN,1,"COUNT",2,GOOD_COUNT,3,FAIR_COUNT,4,UNACCEPTABLE_COUNT) COUNT_VALUE
FROM EVERYDAY_SUMMARY, (SELECT ROWNUM RN FROM DUAL CONNECT BY LEVEL <= 4) WHERE PERIOD = TO_CHAR(SYSDATE - 1, 'YYYY-MM-DD') give you the results you are expected?

Best regards

Maxim Received on Thu Jun 07 2007 - 09:33:51 CDT

Original text of this message

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