Alternative for ROW_NUMBER () OVER.
Hi All,
Is there a way to implement the below logic without using ROW_NUMBER () OVER feature that Oracle provides ?
SELECT
cost_object INTO out_cost_object
FROM
SELECT equip_no,
cost_object,
ROW_NUMBER () OVER (PARTITION BY equip_no, trunc(in_date)
ORDER BY start_date) row_number
FROM escost_object_assign
WHERE equip_no = in_equip
AND in_date between start_date and nvl(end_date,sysdate)
WHERE
a. row_number = 1 ;I want to implement this logic in one of the tool which does not support ROW_NUMBER OVER feature. Please let em know if you need any info.
Thanks and Regards
Nagaraja Akkivalli.
Hi,
can you post the structure of escost_object_assign?
Also from your code it seem you are just returning one row (INTO out_cost_object).
But your analytic function seems to be handling more than one rows as you have partition by equip_no, trunc(in_date)
I suppose you can do something like this.
SELECT cost_object
INTO out_cost_object
FROM (SELECT cost_object
FROM escost_object_assign
WHERE equip_no = in_equip
AND in_date BETWEEN start_date AND NVL (end_date, SYSDATE)
ORDER BY start_date
WHERE ROWNUM <= 1;If not, please post some sample data (CREATE TABLE and INSERT statement) and explain exactly the case.
Beside this I have to say that I totally agree with Blu:
You'd be better to change your tool, rather than perfectly acceptable code.A tool should support entirely the database.
Regards.
Al
Edited by: Alberto Faenza on May 14, 2013 12:07 PM
Similar Messages
-
Alternative choice for ROW_NUMBER?
Hello,
I have two tables:
NAME_tab
PERSID ___ First ___ Last
1 _________ Hans ___ Schmidt
2 _________ Klaus ___ Meier
ADDRESS_tab
ADDRID _ PERSID _ Street ____ Nr.
1 _______ 2 _______ UUU _____ x ( <---------------- Klaus Meier)
2 _______ 1 _______ VVV _____ y ( <---------------- Hans Schmidt)
3 _______ 1 _______ WWW ___ z ( <---------------- Hans Schmidt)
In a report region I want to display each person with only the first person-specific adress-entry:
First _____ Last ______ Street _ Nr.
Hans ____ Schmidt ___ VVV __ y
Klaus ____ Meier _____ UUU __ x
The columns in this region are enabled to be sorted.
I tried it with ROW_NUMBER function, but this forces an ORDER BY. And I cant use an ORDER BY if I enable the sort-option for the columns.
I hope you have a good advice for me!
Best regards!
JensThank you, Heinz,
but I have only one report region and if I am using min() I get only one record,i.g.:
First _____ Last ______ Street _ Nr.
Hans ____ Schmidt ___ VVV __ y
I want this result:
First _____ Last ______ Street _ Nr.
Hans ____ Schmidt ___ VVV __ y
Klaus ____ Meier _____ UUU __ x
Here is the SQL-code with ROW_NUMBER. It works so far, but I can't set columns to be sorted by the user, because of "ORDER BY" within ROW_NUMBER.
select * from (
select
p.PERS_ID, p.NAME, p.VORNAME,
a.STRASSE, a.HAUSNR, a.ADR_ID,
ROW_NUMBER() over (partition by p.PERS_ID order by a.ADR_ID) R
from PERSON p, ADRESSE a
where p.PERS_ID = a.PERS_ID (+)
where R = 1
________________________________________________________________________ -
Alternative for Open , Fetch cursor command
Hi Experts,
I am populating data from glpca table using Open Cursor statement with hold as shown below:
OPEN CURSOR WITH HOLD cur1 FOR
Select data from the purchase order header table.
SELECT runit rprctr sprctr
racct rfarea hsl msl kostl aufnr ps_psp_pnr
FROM glpca
WHERE docnr IN s_docnr
AND rbukrs = p_rbukrs
AND rprctr IN s_rprctr
AND sprctr IN s_sprctr
AND rfarea IN s_rfarea
AND budat IN s_budat
AND kostl IN s_kostl
AND aufnr IN s_aufnr.
Now when i try to Fetch the cursor even restricting it with PACKAGE SIZE command ( value 998), my program get struck over here for 20-30 mins or more den that & session gets out for the user at client end coz of large data. I checked the value of cursor , it was around 670-700 approx.
The query is shown below:
DO.
fetch rows from cursor depending on package size
FETCH NEXT CURSOR cur1 INTO TABLE t_glpca
PACKAGE SIZE p_size.
IF sy-subrc NE 0.
CLOSE CURSOR cur1.
EXIT.
ENDIF.
The program get struck at above fetch next cursor command.
Kindly suggest me some other way to handle or populate the data or any alternative for Cursor command.
Thanks for your consideration.
Regards
MuditSiegfried Boes wrote:
> there is a reason why OPEN CURSOR WITH HOLD is usually used.
>
> Siegfried
Sorry for hijacking this thread and asking here. I am here in the forums on daily basis just reading and learning.
This got me curious and I googled and read SAP tutorial about cursors:
http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3b23358411d1829f0000e829fbfe/content.htm
also read an answer from Thomas after searching forum:
The combination with OPEN CURSOR ... WITH HOLD allows package processing of tasks that require a database commit inside the loop. A normal SELECT loop without holding the cursor would be interrupted by a commit -> short dump.
MY TWO QUESTIONs
1. In SAP tutorial it states that
"WITH HOLD addition in the OPEN CURSOR statement allows you to prevent a cursor from being closed when a database commit occurs in Native SQL"
If I don't specify any commit statements in my abap code and user cursor without the addition with hold.
Can a commit be executed anyway and I get an unwanted commit and thus an unwanted close of my cursor?
Or do they mean that "if you specify commit in native sql"?
2. Thomas says a normal select loop without the cursor holding would be interrupted. Interrupted by who? Again, it seems like there is an "unwanted" commit here? Again, can there be any commits and unwanted interrupts if I dont specify it somewhere in my code?
regards
Baran
Edited by: Baran Sölen on Feb 25, 2009 11:39 AM -
Hi
I have to simple sets of query Q1 and Q2, both of them have the SUM function used, they work just fine separately, but we want the result in 1 single query.
The problem is that Q1 has a master/detail table relation in the join so whenever we join both queries together the result set is being summed incorrectly according to the number of detail records found in the detail table.
Of course the solution is to use UNION operator.
What I'm looking for is an alternative for the UNION
Are there any analytical functions where I can have the result???
Query examples:
TONY@DEV> SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QTY
5 FROM ISTD_STOCK_MOUVEMENTS_M M ,
6 ISTD_STOCK_MOUVEMENTS_D D,
7 IACD_AUXILIARIES X
8 WHERE M.TMVS_CODE = D.TMVS_CODE
9 AND M.CPNY_CODE = D.CPNY_CODE
10 AND M.BRCH_CODE = D.BRCH_CODE
11 AND M.MVTS_YEAR = D.MVTS_YEAR
12 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
13 AND X.AUXL_TYPE = M.AUXL_TYPE
14 AND X.AUXL_CODE = M.AUXL_CODE
15 AND X.AUXL_RPRSNT_TITLE = 1
16 AND M.AUXL_TYPE = 1
17 GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE;
GRP_CODE AUXL_CODE ITEM_CODE QTY
1 33405 4030010 318
1 33405 4030020 22
1 33405 4030030 22
1 33408 4030010 14
1 33408 4030020 2
1 33408 4030030 2
1 33410 4030010 992
1 33410 4030020 42
1 33410 4030030 42
1 33413 4030010 789
1 33413 4030020 38
GRP_CODE AUXL_CODE ITEM_CODE QTY
1 33413 4030030 38
1 33413 5010008 1
1 33413 5010009 1
1 33413 5010012 1
15 rows selected.
Elapsed: 00:00:00.00
TONY@DEV> SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 X.AUXL_CODE,
3 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
4 SUM(NVL(A.AGAC_AMT, 0)) PAID,
5 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
6 FROM IACD_PAYM_AGING A,
7 IACD_AUXILIARIES X
8 WHERE X.AUXL_TYPE = A.AUXL_TYPE
9 AND X.AUXL_CODE = A.AUXL_CODE
10 AND X.AUXL_RPRSNT_TITLE = 1
11 GROUP BY X.AUXL_RPRSNT_TITLE, X.AUXL_CODE;
GRP_CODE AUXL_CODE AMT PAID DUE
1 33405 845.248 93.34 751.908
1 33408 37.334 13.34 23.994
1 33410 2655.328 394.68 2260.648
1 33413 2103.855 293.302 1810.553
Elapsed: 00:00:00.00
TONY@DEV> SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 NULL AMT,
6 NULL PAID,
7 NULL DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X
11 WHERE M.TMVS_CODE = D.TMVS_CODE
12 AND M.CPNY_CODE = D.CPNY_CODE
13 AND M.BRCH_CODE = D.BRCH_CODE
14 AND M.MVTS_YEAR = D.MVTS_YEAR
15 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
16 AND X.AUXL_TYPE = M.AUXL_TYPE
17 AND X.AUXL_CODE = M.AUXL_CODE
18 AND X.AUXL_RPRSNT_TITLE = 1
19 AND M.AUXL_TYPE = 1
20 GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE
21 UNION
22 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
23 X.AUXL_CODE,
24 NULL ITEM_CODE,
25 NULL QUANTITY,
26 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
27 SUM(NVL(A.AGAC_AMT, 0)) PAID,
28 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
29 FROM IACD_PAYM_AGING A,
30 IACD_AUXILIARIES X
31 WHERE X.AUXL_TYPE = A.AUXL_TYPE
32 AND X.AUXL_CODE = A.AUXL_CODE
33 AND X.AUXL_RPRSNT_TITLE = 1
34 GROUP BY X.AUXL_RPRSNT_TITLE, X.AUXL_CODE;
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 318
1 33405 4030020 22
1 33405 4030030 22
1 33405 845.248 93.34 751.908
1 33408 4030010 14
1 33408 4030020 2
1 33408 4030030 2
1 33408 37.334 13.34 23.994
1 33410 4030010 992
1 33410 4030020 42
1 33410 4030030 42
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33410 2655.328 394.68 2260.648
1 33413 4030010 789
1 33413 4030020 38
1 33413 4030030 38
1 33413 5010008 1
1 33413 5010009 1
1 33413 5010012 1
1 33413 2103.855 293.302 1810.553
19 rows selected.
Elapsed: 00:00:05.03
TONY@DEV>Here are samples from the joined query
TONY@DEV> ed
Wrote file afiedt.buf
1 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
6 SUM(NVL(A.AGAC_AMT, 0)) PAID,
7 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X,
11 IACD_PAYM_AGING A
12 WHERE M.TMVS_CODE = D.TMVS_CODE
13 AND M.CPNY_CODE = D.CPNY_CODE
14 AND M.BRCH_CODE = D.BRCH_CODE
15 AND M.MVTS_YEAR = D.MVTS_YEAR
16 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
17 AND X.AUXL_TYPE = M.AUXL_TYPE
18 AND X.AUXL_CODE = M.AUXL_CODE
19 AND X.AUXL_TYPE = A.AUXL_TYPE
20 AND X.AUXL_CODE = A.AUXL_CODE
21 AND X.AUXL_RPRSNT_TITLE = 1
22 AND M.AUXL_TYPE = 1
23* GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE
TONY@DEV> /
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 10494 30428.928 3360.24 27068.688
1 33405 4030020 726 845.248 93.34 751.908
1 33405 4030030 726 845.248 93.34 751.908
1 33408 4030010 140 373.34 133.4 239.94
1 33408 4030020 20 37.334 13.34 23.994
1 33408 4030030 20 37.334 13.34 23.994
1 33410 4030010 56544 164630.336 24470.16 140160.176
1 33410 4030020 2394 10621.312 1578.72 9042.592
1 33410 4030030 2394 13276.64 1973.4 11303.24
1 33413 4030010 56808 151477.56 21117.744 130359.816
1 33413 4030020 2736 10519.275 1466.51 9052.765
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33413 4030030 2736 10519.275 1466.51 9052.765
1 33413 5010008 72 2103.855 293.302 1810.553
1 33413 5010009 72 2103.855 293.302 1810.553
1 33413 5010012 72 2103.855 293.302 1810.553
15 rows selected.
Elapsed: 00:00:03.09
TONY@DEV> ED
Wrote file afiedt.buf
1 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
6 SUM(NVL(A.AGAC_AMT, 0)) PAID,
7 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X,
11 IACD_PAYM_AGING A
12 WHERE M.TMVS_CODE = D.TMVS_CODE
13 AND M.CPNY_CODE = D.CPNY_CODE
14 AND M.BRCH_CODE = D.BRCH_CODE
15 AND M.MVTS_YEAR = D.MVTS_YEAR
16 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
17 AND X.AUXL_TYPE = M.AUXL_TYPE
18 AND X.AUXL_CODE = M.AUXL_CODE
19 AND X.AUXL_TYPE = A.AUXL_TYPE
20 AND X.AUXL_CODE = A.AUXL_CODE
21 AND A.AUXL_CODE = M.AUXL_CODE
22 AND A.AUXL_TYPE = M.AUXL_TYPE
23 AND X.AUXL_RPRSNT_TITLE = 1
24 AND M.AUXL_TYPE = 1
25* GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE
TONY@DEV> /
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 10494 30428.928 3360.24 27068.688
1 33405 4030020 726 845.248 93.34 751.908
1 33405 4030030 726 845.248 93.34 751.908
1 33408 4030010 140 373.34 133.4 239.94
1 33408 4030020 20 37.334 13.34 23.994
1 33408 4030030 20 37.334 13.34 23.994
1 33410 4030010 56544 164630.336 24470.16 140160.176
1 33410 4030020 2394 10621.312 1578.72 9042.592
1 33410 4030030 2394 13276.64 1973.4 11303.24
1 33413 4030010 56808 151477.56 21117.744 130359.816
1 33413 4030020 2736 10519.275 1466.51 9052.765
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33413 4030030 2736 10519.275 1466.51 9052.765
1 33413 5010008 72 2103.855 293.302 1810.553
1 33413 5010009 72 2103.855 293.302 1810.553
1 33413 5010012 72 2103.855 293.302 1810.553
15 rows selected.
Elapsed: 00:00:00.02
TONY@DEV>
Note: If I join the A table with D table the query's returning no rows
Any suggestions are apreciated
Tony S. GarabedianHi Laurent,
I've got the same results as the joined tables without UNION.
The AUXL_CODE column is detail in the D table and master in M table the query is counting the detail records over and over when joined with table A where the function SUM is executed against columns in this table even with grouping sets
Am I correct??
I'm sure there is (must be) another way other than UNION and all the lengthy query but I just can't figure it out.
samples
1 SELECT X.AUXL_RPRSNT_TITLE,
2 X.AUXL_CODE,
3 D.ITEM_CODE,
4 DECODE(GROUPING(X.AUXL_CODE), 1, SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R))) QTY,
5 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT, SUM(NVL(A.AGAC_AMT, 0)) PAID,
6 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
7 FROM ISTD_STOCK_MOUVEMENTS_M M ,
8 ISTD_STOCK_MOUVEMENTS_D D,
9 IACD_AUXILIARIES X,
10 IACD_PAYM_AGING A
11 WHERE M.TMVS_CODE = D.TMVS_CODE
12 AND M.CPNY_CODE = D.CPNY_CODE
13 AND M.BRCH_CODE = D.BRCH_CODE
14 AND M.MVTS_YEAR = D.MVTS_YEAR
15 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
16 AND X.AUXL_TYPE = M.AUXL_TYPE
17 AND X.AUXL_CODE = M.AUXL_CODE
18 AND X.AUXL_TYPE = A.AUXL_TYPE
19 AND X.AUXL_CODE = A.AUXL_CODE
20 AND A.AUXL_CODE = M.AUXL_CODE
21 AND A.AUXL_TYPE = M.AUXL_TYPE
22 AND X.AUXL_RPRSNT_TITLE = 1
23 AND M.AUXL_TYPE = 1
24* GROUP BY GROUPING SETS((X.AUXL_RPRSNT_TITLE), (X.AUXL_RPRSNT_TITLE, X.AUXL_CODE), (X.AUXL_RPRSNT_TITLE, X.AUXL_CODE, D.ITEM_CODE))
TONY@RIM> /
AUXL_RPRSNT_TITLE AUXL_CODE ITEM_CODE QTY AMT PAID DUE
1 33405 4030010 32162.102 3453.58 28708.522
1 33405 4030020 869.246 93.34 775.906
1 33405 4030030 869.246 93.34 775.906
1 33405 33900.594 3640.26 30260.334
1 33408 4030010 373.34 133.4 239.94
1 33408 4030020 37.334 13.34 23.994
1 33408 4030030 37.334 13.34 23.994
1 33408 448.008 160.08 287.928
1 33410 4030010 171351.747 24864.84 146486.907
1 33410 4030020 10879.476 1578.72 9300.756
1 33410 4030030 13599.345 1973.4 11625.945
AUXL_RPRSNT_TITLE AUXL_CODE ITEM_CODE QTY AMT PAID DUE
1 33410 195830.568 28416.96 167413.608
1 33413 4030010 157668.977 21411.046 136257.931
1 33413 4030020 10799.245 1466.51 9332.735
1 33413 4030030 10799.245 1466.51 9332.735
1 33413 5010008 2159.849 293.302 1866.547
1 33413 5010009 2159.849 293.302 1866.547
1 33413 5010012 2159.849 293.302 1866.547
1 33413 185747.014 25223.972 160523.042
1 141375 415926.184 57441.272 358484.912
20 rows selected.
TONY@RIM> SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 SUM(NVL(A.AGAC_REV_AMT, 0)) AMT,
6 SUM(NVL(A.AGAC_AMT, 0)) PAID,
7 SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)) DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X,
11 IACD_PAYM_AGING A
12 WHERE M.TMVS_CODE = D.TMVS_CODE
13 AND M.CPNY_CODE = D.CPNY_CODE
14 AND M.BRCH_CODE = D.BRCH_CODE
15 AND M.MVTS_YEAR = D.MVTS_YEAR
16 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
17 AND X.AUXL_TYPE = M.AUXL_TYPE
18 AND X.AUXL_CODE = M.AUXL_CODE
19 AND X.AUXL_TYPE = A.AUXL_TYPE
20 AND X.AUXL_CODE = A.AUXL_CODE
21 AND A.AUXL_CODE = M.AUXL_CODE
22 AND A.AUXL_TYPE = M.AUXL_TYPE
23 AND X.AUXL_RPRSNT_TITLE = 1
24 AND M.AUXL_TYPE = 1
25 GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE;
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 11118 32162.102 3453.58 28708.522
1 33405 4030020 748 869.246 93.34 775.906
1 33405 4030030 748 869.246 93.34 775.906
1 33408 4030010 140 373.34 133.4 239.94
1 33408 4030020 20 37.334 13.34 23.994
1 33408 4030030 20 37.334 13.34 23.994
1 33410 4030010 58812 171351.747 24864.84 146486.907
1 33410 4030020 2436 10879.476 1578.72 9300.756
1 33410 4030030 2436 13599.345 1973.4 11625.945
1 33413 4030010 59130 157668.977 21411.046 136257.931
1 33413 4030020 2774 10799.245 1466.51 9332.735
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33413 4030030 2774 10799.245 1466.51 9332.735
1 33413 5010008 73 2159.849 293.302 1866.547
1 33413 5010009 73 2159.849 293.302 1866.547
1 33413 5010012 73 2159.849 293.302 1866.547
15 rows selected.
TONY@RIM>This is with UNION and these are the correct results
TONY@RIM> ed
Wrote file afiedt.buf
1 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
2 M.AUXL_CODE,
3 D.ITEM_CODE,
4 SUM(DECODE(M.TMVS_OPERATION,6,D.MVTS_QUANTITY_R,11,-D.MVTS_QUANTITY_R)) QUANTITY,
5 NULL AMT,
6 NULL PAID,
7 NULL DUE
8 FROM ISTD_STOCK_MOUVEMENTS_M M ,
9 ISTD_STOCK_MOUVEMENTS_D D,
10 IACD_AUXILIARIES X
11 WHERE M.TMVS_CODE = D.TMVS_CODE
12 AND M.CPNY_CODE = D.CPNY_CODE
13 AND M.BRCH_CODE = D.BRCH_CODE
14 AND M.MVTS_YEAR = D.MVTS_YEAR
15 AND M.MVTS_DOC_NUM = D.MVTS_DOC_NUM
16 AND X.AUXL_TYPE = M.AUXL_TYPE
17 AND X.AUXL_CODE = M.AUXL_CODE
18 AND X.AUXL_RPRSNT_TITLE = 1
19 AND M.AUXL_TYPE = 1
20 GROUP BY X.AUXL_RPRSNT_TITLE, M.AUXL_CODE, D.ITEM_CODE
21 UNION
22 SELECT X.AUXL_RPRSNT_TITLE GRP_CODE,
23 X.AUXL_CODE,
24 NULL ITEM_CODE,
25 NULL QUANTITY,
26 ROUND(SUM(NVL(A.AGAC_REV_AMT, 0)), 2) AMT,
27 ROUND(SUM(NVL(A.AGAC_AMT, 0)), 2) PAID,
28 ROUND(SUM(NVL(A.AGAC_REV_AMT, 0) - NVL(A.AGAC_AMT, 0)), 2) DUE
29 FROM IACD_PAYM_AGING A,
30 IACD_AUXILIARIES X
31 WHERE X.AUXL_TYPE = A.AUXL_TYPE
32 AND X.AUXL_CODE = A.AUXL_CODE
33 AND X.AUXL_RPRSNT_TITLE = 1
34* GROUP BY X.AUXL_RPRSNT_TITLE, X.AUXL_CODE
TONY@RIM> /
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33405 4030010 327
1 33405 4030020 22
1 33405 4030030 22
1 33405 869.25 93.34 775.91
1 33408 4030010 14
1 33408 4030020 2
1 33408 4030030 2
1 33408 37.33 13.34 23.99
1 33410 4030010 1014
1 33410 4030020 42
1 33410 4030030 42
GRP_CODE AUXL_CODE ITEM_CODE QUANTITY AMT PAID DUE
1 33410 2719.87 394.68 2325.19
1 33413 4030010 810
1 33413 4030020 38
1 33413 4030030 38
1 33413 5010008 1
1 33413 5010009 1
1 33413 5010012 1
1 33413 2159.85 293.3 1866.55
19 rows selected.
TONY@RIM>Thanks again,
Tony
Message was edited by:
Tony Garabedian -
Hi guys i need some help with the logic. As an example, i have table with Account and product columns. So each Account can have multiple products. Now i need SQL to see Accounts that have only Product.
One way of doing it is by doing a groupby and having count(Account) =1. I need an alternative for this. Please help me with your ideas. Thanks in advance.Alberto Faenza wrote:
Is there any reason why you don't want to use group by or just your curiosity to find alternatives?Simple case would be: "I need to select everything from account table where account has multiple products". And between:
SELECT *
FROM YOUR_TABLE
WHERE ACCOUNT IN (
SELECT ACCOUNT,
FROM YOUR_TABLE
GROUP BY ACCOUNT
HAVING COUNT(*) > 1
/and
SELECT *
FROM (
SELECT ACCOUNT,
COUNT(*) OVER(PARTITION BY ACCOUNT) CNT
FROM YOUR_TABLE
WHERE CNT > 1
/I prefer the latter.
SY. -
Issue with OBIEE ROW_NUMBER() OVER (PARTITION BY)
Hi All,
I am facing some issue with the ROW_NUMBER() OVER (PARTITION BY function in the query that is being generated. I am currently on version 11.1.1.6. I have 1 FACT and 1 Dimension table. Within the dimension I have create a level based hierarchy namely REGION -> GROUP - DIVISION etc. Now the problem is that the OBIEE automatically applies *"ROW_NUMBER() OVER (PARTITION BY T9.PRODUCT_TYPE_DESC, T130.DIVISION_DESC, T130.REGION_DESC ORDER BY T9.PRODUCT_TYPE_DESC ASC, T130.DIVISION_DESC ASC, T130.REGION_DESC ASC) "
to the query where in it is not required at it returns with 3 different row numbers. If i remove this line and the where clause I am able to get correct results however its not working whatever I do in the RPD. Please advise.
WITH
SAWITH0 AS (select D1.c1 as c1,
D1.c2 as c2,
D1.c3 as c3,
D1.c4 as c4,
D1.c5 as c5,
D1.c6 as c6
from
(select sum(T157.PL_GRAND_TOTAL) as c1,
sum(T157.TRANSACTION_AMT) as c2,
T130.DIVISION_DESC as c3,
T130.REGION_DESC as c4,
T130.GROUP_DESC as c5,
T9.PRODUCT_TYPE_DESC as c6,
ROW_NUMBER() OVER (PARTITION BY T9.PRODUCT_TYPE_DESC, T130.DIVISION_DESC, T130.REGION_DESC ORDER BY T9.PRODUCT_TYPE_DESC ASC, T130.DIVISION_DESC ASC, T130.REGION_DESC ASC) as c7
from
DIM_ALL_MODULES_REF T9,
DIM_MIS_TREE_REF T130,
DIM_DATE_SERIES T123,
FCT_ALL_MODULES_TRANS T157
where ( T9.SGK_MIS_ID = T130.SGK_MIS_ID and T9.SGK_MODULE_ID = T157.SGK_MODULE_ID and T123.SGK_TIME_ID = T157.SGK_TIME_ID and T123.TRANS_DATE between TO_DATE('2011-01-01 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') and TO_DATE('2011-03-31 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') )
group by T9.PRODUCT_TYPE_DESC, T130.DIVISION_DESC, T130.GROUP_DESC, T130.REGION_DESC
) D1
where ( D1.c7 = 1 ) ),
SACOMMON42934 AS (select T130.DIVISION_DESC as c2,
T130.REGION_DESC as c3,
T130.GROUP_DESC as c4,
T9.PRODUCT_TYPE_DESC as c5,
sum(T258.BEG_NMK_EQ_COST_AMT) as c6,
T123.TRANS_DATE as c7,
sum(T258.END_NMK_EQ_COST_AMT) as c8
from
DIM_ALL_MODULES_REF T9,
DIM_MIS_TREE_REF T130,
DIM_DATE_SERIES T123,
FCT_MODULES_BEG_END_BAL T258
where ( T123.SGK_TIME_ID = T258.SGK_TIME_ID and T9.SGK_MIS_ID = T130.SGK_MIS_ID and T9.SGK_MODULE_ID = T258.SGK_MODULE_ID and T258.PRODUCT_TYPE_ID = 2 and T123.TRANS_DATE between TO_DATE('2011-01-01 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') and TO_DATE('2011-03-31 00:00:00' , 'YYYY-MM-DD HH24:MI:SS') )
group by T9.PRODUCT_TYPE_DESC, T123.TRANS_DATE, T130.DIVISION_DESC, T130.GROUP_DESC, T130.REGION_DESC),Hi Dhar,
Thanks for replying back. But the ROW_NUMBER thing is inserted with the "WITH SUPPORTED" clause only but that is something which are the default settings. However, I notice that ROW_NUMBER() OVER (PARTITION BY) lines are erratic and are not consistent. So sometimes the drill works properly when no ROW_NUMBER() OVER (PARTITION BY) is generated but other times data is wrong. I am not sure why this behaviour is erratic even though I select the same values.
This is surely a product problem as the condition where c7 = 1 filters the result and does not take into account all values.
Even when I do not use WITH_SUPPORTED clause the stitch does not happen properly. Please advice if this is ever going to be by Oracle or any work around for this?
Thanks -
Mac alternatives for affordable 5.1 AC3 encoding?
A musician, I was looking into DVDSP 4 so I could get into adding 5.1 audio created in Cubase SX to video. I have FCPE, which has more than plenty of video production features for me, so obviously I don't want to spend $1300 just for 5.1 AC3 encoding.
Is there an alternative for 5.1 dolby encoding for mac users under the $500 mark? Do I need to go over to the dark side for this? (I've seen a couple apps for Windows).Hi again-
Okay, about DVD-A: you asked about playback options, specifically the cable issue (six analog or one optical specifically.) It depends...how's that for an answer! Actually, it depends on your player and preamp/receiver. I take it since you knew enough to ask the question in the first place, you're familiar with the copy protection involved with both DVD-Audio and SACD for that matter. They were originally not allowed to be sent digitally from the player to the preamp. I believe it's the way the labels wanted to try to put the copy genie back in the bottle that they lost from CDs. Anyways, unless you've got something like D-Link from Denon (for only their DVD and receiver) or even some FireWire units that talk the same encryption on both ends for digital it won't work. Me, I have to rely on the six audio RCA cables to get the signal from my Denon DVD player to the Outlaw Audio preamp. The normal digital cable I've got connected will not pass the DVD-Audio or SACD stream along from the player. Another case of me, the end user, being treated as guilty until proven innocent. But that's another story.
DTS CDs: I've found that the medium I use, either DVD or redbook CD, is rather irrelevant when it comes to providing a DTS stream to my preamp- it likes both equally well, and recognizes them identically as DTS. The most important thing is the digital steam that's DTS encoded- once it leaves the player, it looks the same going across the wire. At least that's been my experience. That's why DTS originally could release DTS CDs- as long as their was a digital connection to a preamp that can decode DTS, a normal CD player works fine. In fact, I can also use the six channel input to play it back as my DVD player decodes the DTS stream internally and often do. My 14 year old CD player won't decode DTS, but with the digital out it can only pass the stream along to an outboard decoder.
As an aside, I can expand on this a bit. To augment my modest home studio monitors (two Event 20/20's), I bought an okay 5.1 speaker setup, the Alesis ProActive one that is more or less a rebranded Logitech but with six analog 5.1 inputs (important to me for mixing from my MOTU 828) and detachable speaker wire because I'm a prude that way. Anyway, out of the box and connected via one optical cable from my G5, I could get it to play anything except my DTS encoded tracks. Actually it played them- think white noise. Not good. I did some Googles and found out that the volume coming from the Mac had to be pretty much pegged to the max for the DTS decoder in the ProActive brain to recognize the digital stream. Once I did that, I got the DTS 5.1 soundtrack just fine.
Too bad about IM not being prompt. Like I said, I like the product and I've had no issues and I've needed no support as the product is self-documenting. It does one thing and does it well for me. Hopefully someone from their sales team will find this thread and convince the company to arrange at least a basic sales page with the website. As I said earlier, I did many Googles over the course of maybe a month and never found the right query to hit IM's page, and it was DTS that finally pointed me to their website.
DVD Studio Pro is worth it, if only to allow you to share your recordings to create DD mixes with pretty menus and the such. If IM ever gets off their butt it's worth at least a demo since you could encode and burn both DD and DTS tracks to the same DVD and see what you'd like better.
DVD-Audio is (was?) a good format (pet peeve- let me leave the TV off please- I hate having to navigate a menu to start track 1!!!) Of course there's enough confusion in the home theater world now that explaining to someone that you'll need six more cables isn't easy. Chicken and egg too- the software titles never panned out for the masses. And don't get me going with Sony screwing up yet again by not releasing stuff like the entire Pink Floyd catalog in SACD at launch of that format. I've heard enough 5.1 mixes of both classic and new recordings to know that I'm completely sold on the notion of surround music. Unless you like classical music, the choices are a bit thin of course. I do agree with you- hopefully the HD versions of DD and DTS will give the industry a kick in the backside to release more multichannel music.
Hmmm...encoding DTS via Virtual PC, eh? Shouldn't be too bad. Then again, if enough people from Apple who have the power to do something realizes that you, me, and at least a few others are interested but have to resort to a Windows solution for a multi-media codec, maybe they'll release such a beast. Then again, I'm one of the many waiting for a decent alternative to Quicken since Intuit screwed up the initial OS X version and never quite fixed it...
Cheers!
Marty -
Alternatives for library management?
Clearly, Apple has decided that from now on iTunes is a music player only, designed it for use primarily on small screens, and taken steps to remove most of it's functionality to manage large libraries. Many of the removed features were those which helped maintain (duplicate finder) and organize (multiple windows, lack of detailed view of fields except in song view), and navigate (any time you change a list or view, you go to the top of the page rather than returning to where you were). What's left is a program that is bright and pretty on a small screen and makes it easy to buy and play new music. Clearly, they are positioning the product as a good-looking alternative for when they introduce a streaming service.
While the program has never been ideal for managing large libraries it has been "good enough" to preclude the development of many alternatives for the relatively small percentage of users with more than 10,000 songs or those with extremely varied or classical music tastes, especially since it was closely linked to the store and could easily sync with Apple products.
Although my immediate reaction was, like so many others, to revert to 10.7, the Apple ecosystem is such that eventually there will be no option but to give in to a later version. Already, many of the Mac apps will not work on my OS X 10.6.8 , 2G of RAM mini, and to move to OS X 10.8 will, according to all accounts, require a new machine with more memory.
So far, my search for something to use as a "back end" data manager for iTunes seems to have turned up WinAmp for Mac, Songbird, and Doubletwist. Can anyone provide insight on any or all of these programs, specifically on issues such as field customization, sorting and playlist creation, and whether or not they can intergrate well enough with iTunes that I can still use it to sync my iPod and download podcasts and iTunes U materials while doing my maintenance and organizing on the alternate program? Or are there other programs out there that I may have missed?
After having spent far too much of the last week restoring as much functionality as I can to iTunes 11, I'm hoping to finally get back to the rest of my life and look forward to useful responses to help put an end to this unwelcome distraction forced on me by Apple.Thanks for the response.
The reason I'm concerned about rolling back the version is that I have reached the limits of my 1T external drive and need more capacity. My original thought was to just get a new mini with a bigger external drive. I've begun having "hiccups" with the existing media drive (it's read a lot of CD's over the years). Now, neither the mini nor the Mac come with drives, and even the diehard Apple people who buy their usb external drive through Apple give it only a 3 star rating. So, whatever way I go, changes and $$ are at hand. My understanding is, if I get a new machine with Mountain Lion (or Constipated Goat, or whatever the latest aninal is -- OS X 10.8) iTUnes 11 is integrated and basically can't be removed. Also, I've synced my iPod classic (which they seem to be ready to drop any day -- no updated models in a couple of product cycles) with iTunes 11 and from what I've been reading, even though there are methods for rolling back the program, it is much harder to get the devices to roll back, and that seems to be the point where people are losing access to their material.
The reason itunes was acceptable before and is not now is that Apple has essentially decided for us that we don't need any of the, for lack of a better phrase, database managemtn functions, that those of us with large libraries have come to depend on. My wife already says I spend way too much time with my 65,000 song and lecture library, and the new iTunes adds three to four additional steps to almost everything I want to do.
To browse the store, I have to leave the playlist I'm playing. If I spot a song or an album that looks interesting, to check if I've already got some or all of it, I need to leave the store, get to the songs list under the main library, do my search, go back to the store and then, if I make a pruchase, go back to the music library and then click back to the playlist I've been listening to (unless I finished with what I started listening and want to change where I am, in which case, I have to go through the process of changing windows that many more times. And, of course, everytime I do change a window, I have to scroll back to where I was.
When loading in a new CD, aside from all the back and forth in screens, at the end (now that I've reinstated the sidebar and figured out how to show downloads) it defaults to album view which, if you've got songs and spoken audio material from 2500 sources, is to all intents and purposes, useless. So you go to yet another window (songs, which is the only window which allows you to search on more than one field) to see if you've ended up with any duplicates, which you have to do by searching because they've removed that feature as well.
Get the idea? Not only are uselful and functional features removed, but even many of those that remain have to be discovered by trial and error. I come from the era of top 40 radio -- the same few songs over and over, and next week the new batch of songs is out and the old ones discarded, gone to who-cares where. That, essentially, is what they've done to iTunes by removing all the features that made managing your media easier in favor of only those features that make buying and playing the newest thing as easy as possible.
BTW, I would have no problem moving to Android if I can find the software I need. I've been using PC's since the DOS command line days, and basically did not move into Apple's sphere until I got my 160 Gig iPod. If I can find another device as small and with as big a drive, and a system to manage my music with, fine by me. Apple clearly no longer wants me or all the music I've bought from them any longer. -
ROW_NUMBER() OVER (PARTITION
hi, can anyone explain, especially this part
ROW_NUMBER() OVER (PARTITION BY A.USER_ID ORDER BY A.TNP_TRACK_ID DESC) RN
Thanks
newbie
SELECT A.TNP_TRACK_ID, A.USER_ID, NVL(A.DELETED,0) DELETED, A.CREATE_TIME, A.DELETE_TIME, B.PRODUCT_CODE, C.LOGIN_NAME,
ROW_NUMBER() OVER (PARTITION BY A.USER_ID ORDER BY A.TNP_TRACK_ID DESC) RN
FROM MISPNA.TNP_TRACKABLE_' || TO_CHAR(p_reporting_month, 'YYYYMM') || ' A
JOIN TMP_VRZ_LATEST_SOC B ON A.TNP_TRACK_ID = B.TRACK_ID
JOIN MISPNA.TN_LOGIN C ON A.USER_ID = C.USER_ID
WHERE A.DELETED<>1Hi,
949523 wrote:
thank you very much, the whole original script is
SELECT TNP_TRACK_ID, USER_ID, DELETED, CREATE_TIME, DELETE_TIME, PRODUCT_CODE, LOGIN_NAME
FROM (
SELECT A.TNP_TRACK_ID, A.USER_ID, NVL(A.DELETED,0) DELETED, A.CREATE_TIME, A.DELETE_TIME, B.PRODUCT_CODE, C.LOGIN_NAME,
ROW_NUMBER() OVER (PARTITION BY A.USER_ID ORDER BY A.TNP_TRACK_ID DESC) RN
FROM MISPNA.TNP_TRACKABLE_' || TO_CHAR(p_reporting_month, 'YYYYMM') || ' A
JOIN TMP_VRZ_LATEST_SOC B ON A.TNP_TRACK_ID = B.TRACK_ID
JOIN MISPNA.TN_LOGIN C ON A.USER_ID = C.USER_ID
WHERE A.DELETED <>1
WHERE RN != 1';I assume the single-quote near the end is just an editing typo.
>
so seems like with specified user_id, it will pick greatest tnp_track_id ? ( as it asks RN=1)That's what it would be doing if the last line read
WHERE rn = 1; for each user_id, that query (with = on the last line) would display all the SELECTed values from the row with the greatest tnp_track_id.
Since you're using != , however, then it's doing just the opposite; it's displaying all rows except the row with the greatest tnp_track_id.
The sub-query is necessary here. All analytic functions, including ROW_NUMBER, are evaluated after the WHERE clause has been applied. To use the results of an analytic function in a WHERE clause, you have to compute the function in a sub-query first.
Edited by: Frank Kulash on Jan 7, 2013 8:08 PM
Just noticed you're saying "WHERE RN != 1" ( not equals) -
Sorting does not work with ROW_NUMBER () OVER (ORDER BY
CREATE OR REPLACE PROCEDURE SP_SALES (
p_sales_id IN VARCHAR2,
p_rownnum_from IN NUMBER,
p_rownnum_to IN NUMBER,
p_sort_by IN VARCHAR2,
p_query OUT SYS_REFCURSOR,
AS
v_query VARCHAR2 (32000);
v_sort_list VARCHAR2(32000) ;
BEGIN
IF p_spv_sort_by IS NULL THEN
v_sort_list := 'given_name ASC ' ;
ELSE
v_sort_list :=p_spv_sort_by;
END IF ;
DBMS_OUTPUT.PUT_LINE ('v_sort_list '||v_sort_list);
OPEN p_query FOR
SELECT sales_id,
item_id,
order_num,
employee_name
,given_name
dept_id,
manager_name,
ROW_NUM
FROM
(SELECT x.*,
ROW_NUMBER () OVER (ORDER BY v_sort_list ) ROW_NUM
FROM (sales_id,
item_id,
order_num,
employee_name
,given_name
dept_id,
manager_name,
FROM order rvw,
sales pol,
emp ca,
WHERE pol.id = rvw.pr_order_id
AND ca.empid =pol.employee_id
AND status = 'SUP') x )
WHERE ROW_NUM BETWEEN p_rownnum_from AND p_rownnum_to;
-- ORDER by v_sort_list ;
DBMS_OUTPUT.PUT_LINE ('v_sort_list '||v_sort_list);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('EX ');
END;
END;
SHOW ERRORS
Sorting does not work. Am I doing something wrong here?
executing procedure using below
declare
x SYS_REFCURSOR;
y number;
BEGIN
SP_SALES('70159_502',1,5, 'GIVEN_NAME'||' ASC' ,:x);
--dbms_output.put_line (:x);
END;Hello
Depending on how many different columns you can sort on and the data types of them, it may be feasible for you to include the conditional logic in the existing statement without the need for dynamic sql...
DTYLER_APP@pssdev2> var p_spv_sort_by varchar2(100)
DTYLER_APP@pssdev2>
DTYLER_APP@pssdev2> exec :p_spv_sort_by:='some other column'
PL/SQL procedure successfully completed.
P_SPV_SORT_BY
some other column
DTYLER_APP@pssdev2>
DTYLER_APP@pssdev2> WITH source AS
2 ( SELECT 'a' given_name, 'z' other_column from dual UNION ALL
3 SELECT 'b' given_name, 'y' other_column from dual UNION ALL
4 SELECT 'c' given_name, 'x' other_column from dual
5 )
6 SELECT
7 given_name,
8 other_column,
9 ROW_NUMBER ()
10 OVER (
11 ORDER BY
12 CASE
13 WHEN :p_spv_sort_by IS NULL THEN given_name
14 WHEN :p_spv_sort_by = 'some other column' THEN other_column
15 END)
16 ROW_NUM
17 FROM
18 source
19 /
G O ROW_NUM
c x 1
b y 2
a z 3
3 rows selected.
DTYLER_APP@pssdev2> exec :p_spv_sort_by:=NULL;
PL/SQL procedure successfully completed.
P_SPV_SORT_BY
DTYLER_APP@pssdev2> WITH source AS
2 ( SELECT 'a' given_name, 'z' other_column from dual UNION ALL
3 SELECT 'b' given_name, 'y' other_column from dual UNION ALL
4 SELECT 'c' given_name, 'x' other_column from dual
5 )
6 SELECT
7 given_name,
8 other_column,
9 ROW_NUMBER ()
10 OVER (
11 ORDER BY
12 CASE
13 WHEN :p_spv_sort_by IS NULL THEN given_name
14 WHEN :p_spv_sort_by = 'some other column' THEN other_column
15 END)
16 ROW_NUM
17 FROM
18 source
19 /
G O ROW_NUM
a z 1
b y 2
c x 3
3 rows selected.
DTYLER_APP@pssdev2>But that would depend on the columns you're sorting on being of the same data type or at least having the ability to convert them to the same data type without loosing the sort order.
DTYLER_APP@pssdev2> WITH source AS
2 ( SELECT 'a' given_name, sysdate - 2 other_column from dual UNION ALL
3 SELECT 'b' given_name, sysdate - 1 other_column from dual UNION ALL
4 SELECT 'c' given_name, sysdate other_column from dual
5 )
6 SELECT
7 given_name,
8 other_column,
9 ROW_NUMBER ()
10 OVER (
11 ORDER BY
12 CASE
13 WHEN :p_spv_sort_by IS NULL THEN given_name
14 WHEN :p_spv_sort_by = 'some other column' THEN other_column
15 END)
16 ROW_NUM
17 FROM
18 source
19 /
WHEN :p_spv_sort_by = 'some other column' THEN other_column
ERROR at line 14:
ORA-00932: inconsistent datatypes: expected CHAR got DATE
DTYLER_APP@pssdev2> WITH source AS
2 ( SELECT 'a' given_name, sysdate - 2 other_column from dual UNION ALL
3 SELECT 'b' given_name, sysdate - 1 other_column from dual UNION ALL
4 SELECT 'c' given_name, sysdate other_column from dual
5 )
6 SELECT
7 given_name,
8 other_column,
9 ROW_NUMBER ()
10 OVER (
11 ORDER BY
12 CASE
13 WHEN :p_spv_sort_by IS NULL THEN given_name
14 WHEN :p_spv_sort_by = 'some other column' THEN TO_CHAR(other_column,'YYYYMMDDHH24MISS')
15 END)
16 ROW_NUM
17 FROM
18 source
19 /
G OTHER_COLUMN ROW_NUM
a 12-SEP-2011 15:04:19 1
b 13-SEP-2011 15:04:19 2
c 14-SEP-2011 15:04:19 3
3 rows selected.HTH
David -
Microphone for voice over.
My standalone isight that I have used for voice overs has finally given up. (I'd developed a technique whereby I held the lens to my chin and pointed the isight down at about 45 degrees-but I digress) can anyone recommend a reasonable alternative, around $100 would be reasonable, I'm no pro but it has to be a reasonable quality.
I've bought and tried a microphone a day now for about a week and none match up to my experience with my old isight. I'd prefer one that needs to be close to the source sound so as background noise is not a huge problem and I'd also prefer it to be USB or firewire, I need to take on the guise of a ferret to get to the back of my mac.I tried the logitech one from the store, it didn't have the same quality as the isight but I could have lived with that I suppose as it wasn't as bad as some of the others I've tried. I don't know whether I got a faulty one, I don't think I did, because it seemed to work with Quicktime excepting the quality issue, but when I used it with FCE, it was awful.
Not sure if FCE has its own background noise cancelling feature that interfered with the background noise cancelling feature of the logitech but it was way to quiet 90% of the time and when it wasn't it was too loud, there was no middle ground. Overall too quiet, with odd words that were obviously said a little louder being clipped. -
How to implement qualify row_number over(Partition by col order by col) and char2hexint in informatica in a way that is supported by pdo?
Apart from sql overriding or using stored procedure ,is there any other solution?Can rank transformation help here? ....But, I guess rank transformation cannot be pushed down..
help please !Hi Saichand,
The links were helpful. But i am not getting how it is working in test and not in live.
I found one difference while deploying . The column names of the object both in Test and Production had spaces.For E.g: Full Name
When this column Full Name is pulled to the repsository in test , it automatically put double quotes for the column names in the physical sql when it hits the database.
But, In production , when I pulled the column the report gave error as Invalid Identifier since OBIEE generated column name as Full Name without double quotes.
Then I changed the column in Phyiscal Layer repository by having double Quotes for all columns. Afte that report worked fine.
Whether this has caused any issue in Row Partition.
Is there any setting to have column name in Double Quotes ?
Thanks,
Johnny -
Help - have an iTunes account on iPad for well over a year. Just bought iPhone 5 and I cannot purchase apps using my account. I am asked to verify my credit card and details but then it rejects them. They are still fine on the iPad. Any ideas?
I tried to contact support but they do not recognise my Thai phone number.
the Thai support site is all in Thai (and I neither read or write it).
All I want is a single email address that works - it must be quite a simple process.
I don't want to create another account with another credit card - life will just get seriously complicated then.
BTW my apple I'd is accepted for downloading free apps!!!First of all, you should always save you photos on computer like any other digital camera.
Backup on iCloud or iTunes only backup your Camera Roll. The other photos should be already on the computer.
Note: Photos are not saved in iTunes, it's only a conduit between your iPhone and your photo managing software on computer.
What computer do you have? -
I upgraded my iPod Touch 4th Gen yesterday. Now it won't play music, which is the main thing I use it for. Over 11,000 songs [it's a 64GB model] -- will I actually have to restore the device and re-add all that music?
[Music files are still there, and I can play them on my computer directly from the iPod [just one track at a time] but not in the usual way, through headphones.]
On the Summary page of iTunes for the iPod, it shows 50-plus gigabytes of "Other" content and no music, which was not previously the case. I assume this is related to the problem.
I can bring up individual tracks on the iPod and see cover art, but cannot play the music.iCloud is free, iTunes match is $25 a year.
I had the same problem and when I went to Settings I had 0 songs, even though they were obviously still there since I only had 15GB free on my 64GB device.
I decided to do a complete reset/restore of my 4th gen iPod Touch, Bad move! I've been messing with it for hours, and it simply won't restore--it keeps hanging on a black screen with an Apple logo and a progress bar at about 10%, sometimes it goes completely blank and tries again, with the same result. (I've posted my question/plea for help here: https://discussions.apple.com/message/19735862 )
I'm ready to bang my head against the wall! I can put the device in recovery mode, connect to iTunes on my computer, and get it back to the setup screen, but when I go through the process again and try to do an iCloud backup I get the same reset/restore loop.
I could start from scratch, but I really, really, really don't want to go through all of my hundreds of apps, reinstall them one by one, etc. etc. etc.
I thought that once I started using iCloud, I didn't need to sync with iTunes anymore--guess I was wrong. -
What is the alternative for DisplayMemberPath="Value" for Windows Store applications?
I think there is a bug with Windows Store Applications when it comes to using DisplayMemberPath="Value".
Here is my code
<ComboBox Height="40" VerticalAlignment="Stretch" SelectedValuePath="Key" DisplayMemberPath="Value" x:Name="comboBox1" FontSize="25"/>
var source = new Dictionary<string, double>();
source.Add("Item1", 0.4);
source.Add("Item2", 0.3);
source.Add("Item3", 0.1);
source.Add("Item4", 0.1);
var formateDSource = new Dictionary<string, string>();
foreach (var item in source)
formateDSource.Add(string.Format("[{0}, {1}]", item.Key, item.Value), item.Key);
comboBox1.ItemsSource = source;
If you use this code in WPF in works perfectly. However if you use this code in a Windows Store Application then the Combo Box is empty and an error is thrown. So is there an alternative way to do this in Windows Store Applications and have I unearthed a
bug? Because I have researched the Web for days and found no solution to this.*please do not comment unless you have tried my code as a Windows Store App not a WPF in Visual Studios. Can Someone post an example based on my code that works in Windows Store
Apps please because this is terrible.
ThanksIt looks like you got an answer on SO:
http://stackoverflow.com/questions/29817124/what-is-the-alternative-for-displaymemberpath-value-for-windows-store-applicat
This does look like a bug.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
objects and unknown namespaces.
Maybe you are looking for
-
How can I disable the end of call notification or at least turn it down?
On my Droid Turbo, At the end of a call there is a big loud beep. (end of call notification) I need to disable it or turn it down because on headset it is deafening. I had this exact problem on the HTC One M8 and now with the Droid Turbo. My wife
-
Recording from audio tape, using SPDIF
I recorded and saved as mp3, some music from an old audio tape and selected SPDIF-IN as the recording medium. The issue is when I tested the playback it sounded ok on my PC. Now after saving the file with a different name etc., the file has no sound
-
Itunes screw up my music library
Attention! I use itunes 7.0.1.8 and used the function "add folder to library". In my case the folder is a network based harddisk. itunes added all of my songs, also the mp3 files which were already on the disc, but SCRAMBLED the whole disc. For examp
-
My iphone 4 wont sync because it "cannot save to computer" HELP!
Whenever i plug in my iphone and try to add music it comes up with a message that says that it cannot sync becasue it cannot be saved on the computer. i know this is probably really stupid but i cant figure it out!!!
-
Interactive Report- short dump
Hi Experts, I have developed two tables and joined them through foreign key relationship.( activated and entered data) and i wrote code for interactive report. On executing code, I am getting data for basic list but if i click for secondary list, it