Dense Rank in OBIEE answers
Hi All,
Can any on let me know how to create a column in OBIEE answers which gives the row number starting with 1 for each row in the group. similarly for next group the row number should start with 1 and so on.
Thanks in advance for your quick response!
Regards
This feature had appear in the 9i version, so there is no way to have it running with a 6i version. If you have a 9i database, you could write a database stored function/procedure that would use this analytic function, and return the lines to Forms.
Francois
Similar Messages
-
Hi All,
I'm an "OBIEE newbie" and not sure how to use the Topn or Rank function to achieve the desired resullt below.
I have a report that will display the top 10 or 20 (or whaterver # entered by users) of hospitals that have highest # of patients and then a sum of patients from the rest of other hospitals. ex:
Hospitals #patients rank
ABC 1500 1
KLM 1200 2
DEF 1200 2
XYZ 200 10
Other hospistals: 5000
The top 10 or 20 # will be used as a prompt.
Your help is much appreciated !!!
Thanks,
TyHi David,
I did follow John's posting (it's very helpful for a beginner) but I just could not figure out what he did in Pivot table to get the SUM of the one that did not make the top 10 list. If you could show me how to do that :)
Thank you for help!
Ty -
OBIEE Answers (Ad-Hoc Reporting) Best Practices
Hi All
Just finish writing about OBIEE Answers (Ad-Hoc Reporting) Best Practices. Thought it would be great to share with extended family.
Please visit : http://wp.me/pfMKU-3t
OR
http://sranka.wordpress.com/2010/01/07/obiee-answers-ad-hoc-reporting-best-practices/
Hope this helps
Sunil S Ranka
Blog :: http://sranka.wordpress.com
"Superior BI is the antidote to Business Failure"hi ranka,
Nice work and nice post.It would be helpful to many guys out here.
Thanks,
By,
Kranthi. -
Please help me with this query -- i am trying with Dense rank
version 10g
i received a quote for an account. if the same quote is received under different account then i should mark the previous account received as deleted.
please help me .
/* Formatted on 2010/06/28 14:13 (Formatter Plus v4.8.8) */
WITH temp AS
(SELECT '1-11TWQL' quote_id, 'COPS' ACCOUNT, 'Ordered' status,
TO_DATE ('12/23/2009 3:37:54',
'mm/dd/yyyy hh:mi:ss PM'
) captured_date
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'RFS',
TO_DATE ('12/23/2009 3:37:50', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'Rejected',
TO_DATE ('12/23/2009 3:37:52', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:51', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Ordered',
TO_DATE ('12/23/2009 3:04:24', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'RFS',
TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Rejected',
TO_DATE ('12/23/2009 3:04:22', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Validated',
TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'RFS',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'RFS',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8Z', 'COPS', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8Z', 'COPS', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL)
SELECT quote_id, ACCOUNT, status, captured_date,
DENSE_RANK () OVER (PARTITION BY quote_id ORDER BY quote_id,
ACCOUNT) rn
-- ,CASE DENSE_RANK () OVER (PARTITION BY quote_id ORDER BY quote_id,
-- ACCOUNT)
-- WHEN 1
-- THEN 'Y'
-- ELSE 'N'
-- END deleted_flag
FROM temp
ORDER BY quote_id, captured_date;output required
WITH temp AS
(SELECT '1-11TWQL' quote_id, 'COPS' ACCOUNT, 'Ordered' status,
TO_DATE ('12/23/2009 3:37:54',
'mm/dd/yyyy hh:mi:ss PM'
) captured_date, 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'RFS',
TO_DATE ('12/23/2009 3:37:50', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'Rejected',
TO_DATE ('12/23/2009 3:37:52', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:51', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Ordered',
TO_DATE ('12/23/2009 3:04:24', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'RFS',
TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Rejected',
TO_DATE ('12/23/2009 3:04:22', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Validated',
TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'RFS',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'RFS',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8Z', 'COPS', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8Z', 'COPS', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL)
SELECT quote_id, ACCOUNT, status, captured_date, deleted_flag
FROM temp
ORDER BY quote_id, captured_date;try to wrap your query to become an in-line view. use a case statement or decode to your derived column RN from the analytic query of DENSE RANK. either way they both will work.
SQL> WITH temp AS
2 (SELECT '1-11TWQL' quote_id, 'COPS' ACCOUNT, 'Ordered' status,
3 TO_DATE ('12/23/2009 3:37:54',
4 'mm/dd/yyyy hh:mi:ss PM'
5 ) captured_date
6 FROM DUAL
7 UNION ALL
8 SELECT '1-11TWQL', 'COPS', 'RFS',
9 TO_DATE ('12/23/2009 3:37:50', 'mm/dd/yyyy hh:mi:ss PM')
10 FROM DUAL
11 UNION ALL
12 SELECT '1-11TWQL', 'COPS', 'Rejected',
13 TO_DATE ('12/23/2009 3:37:52', 'mm/dd/yyyy hh:mi:ss PM')
14 FROM DUAL
15 UNION ALL
16 SELECT '1-11TWQL', 'COPS', 'Validated',
17 TO_DATE ('12/23/2009 3:37:51', 'mm/dd/yyyy hh:mi:ss PM')
18 FROM DUAL
19 UNION ALL
20 SELECT '1-11TWQL', 'D1', 'Ordered',
21 TO_DATE ('12/23/2009 3:04:24', 'mm/dd/yyyy hh:mi:ss PM')
22 FROM DUAL
23 UNION ALL
24 SELECT '1-11TWQL', 'D1', 'RFS',
25 TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM')
26 FROM DUAL
27 UNION ALL
28 SELECT '1-11TWQL', 'D1', 'Rejected',
29 TO_DATE ('12/23/2009 3:04:22', 'mm/dd/yyyy hh:mi:ss PM')
30 FROM DUAL
31 UNION ALL
32 SELECT '1-11TWQL', 'D1', 'Validated',
33 TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM')
34 FROM DUAL
35 UNION ALL
36 SELECT '1-249A8X', 'COPS', 'RFS',
37 TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM')
38 FROM DUAL
39 UNION ALL
40 SELECT '1-249A8X', 'COPS', 'RFS',
41 TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM')
42 FROM DUAL
43 UNION ALL
44 SELECT '1-249A8X', 'COPS', 'RFS',
45 TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM')
46 FROM DUAL
47 UNION ALL
48 SELECT '1-249A8X', 'COPS', 'Rejected',
49 TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM')
50 FROM DUAL
51 UNION ALL
52 SELECT '1-249A8X', 'COPS', 'Rejected',
53 TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM')
54 FROM DUAL
55 UNION ALL
56 SELECT '1-249A8X', 'COPS', 'Rejected',
57 TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM')
58 FROM DUAL
59 UNION ALL
60 SELECT '1-249A8X', 'COPS', 'Validated',
61 TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
62 FROM DUAL
63 UNION ALL
64 SELECT '1-249A8X', 'COPS', 'Validated',
65 TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
66 FROM DUAL
67 UNION ALL
68 SELECT '1-249A8X', 'COPS', 'Validated',
69 TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
70 FROM DUAL
71 UNION ALL
72 SELECT '1-249A8X', 'D1', 'Ordered',
73 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
74 FROM DUAL
75 UNION ALL
76 SELECT '1-249A8X', 'D1', 'Ordered',
77 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
78 FROM DUAL
79 UNION ALL
80 SELECT '1-249A8X', 'D1', 'RFS',
81 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
82 FROM DUAL
83 UNION ALL
84 SELECT '1-249A8X', 'D1', 'RFS',
85 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
86 FROM DUAL
87 UNION ALL
88 SELECT '1-249A8X', 'D1', 'Validated',
89 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
90 FROM DUAL
91 UNION ALL
92 SELECT '1-249A8X', 'D1', 'Validated',
93 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
94 FROM DUAL
95 UNION ALL
96 SELECT '1-249A8Z', 'COPS', 'Validated',
97 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
98 FROM DUAL
99 UNION ALL
100 SELECT '1-249A8Z', 'COPS', 'Ordered',
101 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
102 FROM DUAL)
103 select vt.quote_id,
104 vt.account,
105 vt.status,
106 vt.captured_date,
107 case when vt.rn = 1 then 'N'
108 else 'Y'
109 end deleted_flag
110 from (SELECT quote_id, ACCOUNT, status, captured_date,
111 DENSE_RANK () OVER (PARTITION BY quote_id ORDER BY quote_id, ACCOUNT) rn
112 FROM temp
113 ORDER BY quote_id, captured_date) vt;
QUOTE_ID ACCOUNT STATUS CAPTURED_DATE DELETED_FLAG
1-11TWQL D1 Rejected 23-Dec-2009 3 Y
1-11TWQL D1 RFS 23-Dec-2009 3 Y
1-11TWQL D1 Validated 23-Dec-2009 3 Y
1-11TWQL D1 Ordered 23-Dec-2009 3 Y
1-11TWQL COPS RFS 23-Dec-2009 3 N
1-11TWQL COPS Validated 23-Dec-2009 3 N
1-11TWQL COPS Rejected 23-Dec-2009 3 N
1-11TWQL COPS Ordered 23-Dec-2009 3 N
1-249A8X COPS Validated 23-Dec-2009 3 N
1-249A8X COPS Validated 23-Dec-2009 3 N
1-249A8X COPS Validated 23-Dec-2009 3 N
1-249A8X COPS RFS 05-Mar-2010 1 N
1-249A8X COPS Rejected 05-Mar-2010 1 N
1-249A8X COPS RFS 16-Mar-2010 7 N
1-249A8X COPS Rejected 16-Mar-2010 7 N
1-249A8X COPS Rejected 16-Mar-2010 7 N
1-249A8X COPS RFS 16-Mar-2010 7 N
1-249A8X D1 Ordered 26-Mar-2010 1 Y
1-249A8X D1 Ordered 26-Mar-2010 1 Y
1-249A8X D1 RFS 26-Mar-2010 1 Y
1-249A8X D1 RFS 26-Mar-2010 1 Y
1-249A8X D1 Validated 26-Mar-2010 1 Y
1-249A8X D1 Validated 26-Mar-2010 1 Y
1-249A8Z COPS Validated 26-Mar-2010 1 N
1-249A8Z COPS Ordered 26-Mar-2010 1 N
25 rows selected
SQL> -
Hi All,
I am working on Oracle BI Publisher. Can we apply Dense Rank on a column directly in the template? I don't want to change the total query for this, is there any way to do in template? if yes please tell me how can we do.
Any suggestion would be greatly appreciated.
Thanks in advance,
Anil.Anil
I think it can be done in XSL but its going to take some effort. You might be better using the db to provide the record ranking as a value in the resulting XML. Then its just a case of sorting on the ranking values.
Regards
tim -
Hello,
I am using ORACLE 10g and having an error when updating a table and generating ORA-30926 'Unable to get a stable set of rows in the source tables'.
I create a temporary working table with records pulled from 2 different tables. The query to make the temp table uses
the DENSE RANK FUNCTION to eliminate any duplicates. But, I am still getting duplicate records.
When it is time to update my primary table with the records from the temp table, it sees the duplicates and
generates the error. I have all the code to create the problem. I think I almost have it but maybe need different query structure.Any help is appreciated.
-- Create table
create table CUSTOMER
EMP_ID NUMBER(4) ,
CUST_ID NUMBER(9) not null,
CONTACT_CD VARCHAR2(1),
PURCHASE_DATE DATE,
NEW_CUST_CD VARCHAR2(1),
CUST_NAME VARCHAR2(25)
-- Create table
create table DEFERRED_MAILING
CUST_ID NUMBER(9) not null,
EMP_ID NUMBER(4) not null,
PURCHASE_DATE DATE
insert into customer ( emp_id, cust_id, contact_cd,PURCHASE_DATE, NEW_CUST_CD,cust_name)
values (10,444,'Y',to_date('11-01-2011 16:11:05', 'dd-mm-yyyy hh24:mi:ss'),'Y','J.J.BROWN');
insert into customer ( emp_id, cust_id,contact_cd, PURCHASE_DATE, NEW_CUST_CD,cust_name)
values (10,444,'Y',to_date('11-01-2011 16:11:05', 'dd-mm-yyyy hh24:mi:ss'),'Y','J.BROWN');
insert into deferred_mailing (cust_id, emp_id, purchase_date)
values (444, 10, to_date('11-01-2011 16:11:05', 'dd-mm-yyyy hh24:mi:ss'));
create table UPDTE_DEFERRED_MAILING_RECORDS nologging as
SELECT a.CUST_ID,
a.EMP_ID,
a.PURCHASE_DATE,
a.DM_ROW_ID,
a.drank,
c.CONTACT_CD,
c.NEW_CUST_CD/*,
TRANS_ID_SEQ.NEXTVAL as TRANS_ID*/
FROM (SELECT a.ROWID AS DM_ROW_ID,
a.CUST_ID,
a.EMP_ID,
a.PURCHASE_DATE,
dense_rank() over(PARTITION BY a.CUST_ID, a.EMP_ID ORDER
BY a.PURCHASE_DATE DESC, a.ROWID) DRANK
FROM deferred_mailing a) a,
customer c
WHERE a.CUST_ID = c.CUST_ID
AND a.EMP_ID = c.EMP_ID
AND (a.PURCHASE_DATE <= c.PURCHASE_DATE OR
c.PURCHASE_DATE IS NULL);
SELECT * FROM UPDTE_DEFERRED_MAILING_RECORDS;
}Please try this
create table UPDTE_DEFERRED_MAILING_RECORDS nologging as
SELECT distinct a.CUST_ID,
a.EMP_ID,
a.PURCHASE_DATE,
a.drank,
c.CONTACT_CD,
c.NEW_CUST_CD,
a.DM_ROW_ID
FROM (SELECT a.ROWID AS DM_ROW_ID,
a.CUST_ID,
a.EMP_ID,
a.PURCHASE_DATE,
dense_rank() over(PARTITION BY a.CUST_ID, a.EMP_ID ORDER
BY a.PURCHASE_DATE DESC, a.ROWID) DRANK
FROM deferred_mailing a) a,
customer c
WHERE a.CUST_ID = c.CUST_ID
AND a.EMP_ID = c.EMP_ID
AND (a.PURCHASE_DATE <= c.PURCHASE_DATE OR
c.PURCHASE_DATE IS NULL)
and a.drank=1;
The query you've posted is behaving according to the expectations. The inner select is returning one row and the outer is returning two as the
WHERE a.CUST_ID = c.CUST_ID
AND a.EMP_ID = c.EMP_ID
AND (a.PURCHASE_DATE <= c.PURCHASE_DATE OR
c.PURCHASE_DATE IS NULL)
conditions are seeing two rows in the table customer.
I've added the a.drank=1 clause to skip the duplicates from the inner table and distinct in the final result to remove duplicates from the overall query result.
For eg, if you have one more row in the deferred_mailing like this
SQL> select * from DEFERRED_MAILING;
CUST_ID EMP_ID PURCHASE_
444 10 11-JAN-11
444 10 11-JAN-11
then the query without "a.drank=1" will return 4 rows like this by the outer query.
CUST_ID EMP_ID PURCHASE_ DM_ROW_ID DRANK C N
444 10 11-JAN-11 AAATi2AAGAAAACcAAB 2 Y Y
444 10 11-JAN-11 AAATi2AAGAAAACcAAA 1 Y Y
444 10 11-JAN-11 AAATi2AAGAAAACcAAB 2 Y Y
444 10 11-JAN-11 AAATi2AAGAAAACcAAA 1 Y Y
It'll return the below even if we use distinct on the same query(i.e. without a.drank=1)
CUST_ID EMP_ID PURCHASE_ DM_ROW_ID DRANK C N
444 10 11-JAN-11 AAATi2AAGAAAACcAAB 2 Y Y
444 10 11-JAN-11 AAATi2AAGAAAACcAAA 1 Y Y
which contains duplicates again.
So, we need a combination of distinct and dense here.
btw, Please mark the thread as 'answered', if you feel you got your question answered. This will save the time of others who search for open questions to answer.
Regards,
CSM -
Hello All,
Below is the sql i am trying to execute and the Dense Rank function is giving same result for all of the rows, could you please help me where i am doing wrong
SELECT
AMT,
DENSE_RANK() OVER (PARTITION BY AMT ORDER BY AMT DESC) AS DENSE_RANK
FROM
SELECT DISTINCT
SUM(NVL(TRUNC(NET_AMT) * NVL(GLOBAL1_EXCHANGE_RATE,1),0))
OVER (PARTITION BY CUSTOMER_BILL_TO_LOC_WID ORDER BY CUSTOMER_BILL_TO_LOC_WID)
AS AMT
FROM
W_SALES_BOOKING_LINE_F
WHERE
SALES_ORDER_NUM IN ('10612426','10612450','10612477','32649203')
AND
X_MONTH_WID=TO_CHAR(SYSDATE-1,'YYYYMMDD')
)--ORDER BY AMT DESC Result Set:
AMT DENSE_RANK
0 1
2,855 1
6,706 1
14,265 1you have "broken" up your resultset (from the inline view) by AMT (PARTITION BY AMT)
and per part, you sort this (one row in each partition, not a whole lot of sorting) ( ORDER BY AMT DESC)
then you assign a ranking based on the sorting action... which yields 1 (DENSE_RANK)
Are you looking for this
SELECT
AMT,
DENSE_RANK() OVER (ORDER BY AMT DESC) AS DENSE_RANK
FROM
SELECT DISTINCT
SUM(NVL(TRUNC(NET_AMT) * NVL(GLOBAL1_EXCHANGE_RATE,1),0))
OVER (PARTITION BY CUSTOMER_BILL_TO_LOC_WID ORDER BY CUSTOMER_BILL_TO_LOC_WID)
AS AMT
FROM
W_SALES_BOOKING_LINE_F
WHERE
SALES_ORDER_NUM IN ('10612426','10612450','10612477','32649203')
AND
X_MONTH_WID=TO_CHAR(SYSDATE-1,'YYYYMMDD')
)--ORDER BY AMT DESC -
How to change the default up arrow in OBIEE Answers
Hi All,
I want to change the default blue up arrow with a green up arrow in OBIEE answers. How to do it?
Regards,
SoumitraDo you mean the condition formatting options ? If so I had a similar requirement to create a Green up arrow and an orange 'sideways' arrow. I did the following, all based on a default Windows install using OC4J :
Navigate to :
C:\OracleBI\oc4j_bi\j2ee\home\applications\analytics\analytics\res\s_oracle10\meters\arrow\tri\
I copied up.gif to upgreen.gif and change the colour in a image editor.
I coped up.gif, rotated 90 degrees, changed colour to orange and saved this as sideways.gif
I copied the two new files into the Web services stye folders also :
C:\OracleBI\web\app\res\s_oracle10\meters\arrow\tri
restarted OC4J and presentation services and they are now available in the conditional formatting options, alongside the defaut Blue (up) and red(down) arrows.
** I believe the new pictures need to exist in any other style folders that you are using, e.g "s_hyperion", "s_oracle10", s_custom if you've done your own. -
How To Give a Validation In Prompt(OBIEE Answers)
Hi,
I ahve the promt like
Name----------------<text box> Go
if i enter the name then the prompt will effect on the data.
if i didn't enter tha data in name textbox it should dispaly a meassge like:please enter a valid name:
here name comling from backend database to obiee answers
can u please tell me how to sort out this-----------------Check this MOS note:
OA Framework Personalization and Extensibility Guide: Version 5.7+ (Doc ID 236618.1)
thanks -
Field is in DB table/alias but I get ORA904 error using it in OBIEE Answers
Hello, I'm very new at developing with RPD and OBIEE tools, so I'm struggling with something that I thought I did correctly. I added a new field to a database table, and can query it in the database. I added it to the table in RPD Physical layer and I verified that it also now exists in an alias of that table. The physical alias table field is used as a source for a logical column in the presentation layer. Everything looks good in the RPD. But when I try to pull it up in a query in OBIEE Answers I get a 904 error telling me that the column does not exist. I've bounced the servers, dropped cookies and cache, but nothing helps - I still get the error.
What step could I have missed?
Thanks in advance!
RichTHank you all for the advice, but it still appears to be a problem. Here's what I tried and the results:
1. Right-clicked on the new column to do a row count update. As predicted by Gaurav, this also failed with a 904 error.
2. Verified exact spelling is correct.
3. Checked the connection pool. THis looks correct, but I will double-check today with one of my co-workers who has more experience with RPD.
4. Tried querying the column in RPD - this also failed with 904 error.
5. Checked the LTS within BMM layer and my new field does map back to the alias column
6. Ran a consistency check and the only errors (warnnings actually) are for a different, unrelated table.
7. Checked security and it also looks okay, but this is another one I'll double-check later with one of our experts here.
8. Joins in physical layer and BMM look good
9. Checked physical column and table in the presentation layer. These also point to the right columns/tables
10. Selecting the column by itself in analysis fails with 904.
If anyone can think of something else to consider based on this please advise. One thing I did notice is that in performing the steps above I noticed somewhere (the BMM I think) that the new column I added is at the bottom of the table (last field) and not in the middle as it is in the database. In past experience with other tools this hasn't mattered, but I'm going to see if I can change that and if that has an effect. I'm guessing it won't but I'm running out of ideas!
Thanks again,
Rich -
OBIEE Answers functionality questions
Hi,
I pretty new to OBIEE Answers orginally working with Business Objects XI Webi, I have read through the user guides for Answers but some functionality I would like thats in BO XI but doesnt seem to be avaliable in Answers, Im not sure if its not documented because its more advanced functionality or whether Answers just can't do it ? Is the following functionality avaliable in Answers,
1. I want to build a report based on 2 queries and then link the data in these queries by a common dimension and display this data in 1 report, for example I have query 1 with fields A,B,C and query 2 with fields A, D, E, I want to link on field A as its common and in the 1 report display the fields A,B,C,D,E
is this possible ? This is not the same as union / intersect, and is not the same as dashboard showing two query results, I want 1 table showing the results of two queries.
2. Once you have you data set returned is there anyway to filter on the data displayed in the report without the SQL actually having the filter in ? For example I have 1 query returning 100 rows of data and in that 50 rows are of type = A and 50 are of type = B. I dont want to have two seperate queries one to get all type A and one to get all type B, but I would prefer to return all rows in the query then filter the results in the report itself so I can have 1 report table showing type = A and 1 report table showing type = B, pretty much like how you can add a filter in Excel or again how you would add a report level filter in BO XI ?
Edited by: RichRich on 01-Feb-2010 02:41
Edited by: RichRich on 01-Feb-2010 02:41
Edited by: RichRich on 01-Feb-2010 02:42HI,
May I know obiee version?
Can you refer below thread, it sees similar error.
https://forums.oracle.com/message/9866218
https://forums.oracle.com/message/10091143
Thanks,
Satya -
How to Identify duplicates in OBIEE Answers.
Hi Friends,
Please help me here.
I am having a secnario in OBIEE Answers.
How to identify duplicates using combination either first names with Last Name or with DOB in OBIEE.I dont have access to RPD currently.
Also please let me know using RPD also how i achive this .
Example :
Cusomers table:
First_Name Last_Name DOB
ABC XYZ 29-Mar-2011
ABC XYZ 28-Mar-2011
ABC PQR 29-Mar-2011
ABC XYZ 29-Mar-2011
Case 1: Check row 1 & row 2 having First_Name & Last_Name duplicate but DOB is differ.
Case 2: check row 1 & row 3 having First_Name & DOB duplicate but last name is differ.
case 3: check row 1 & row 4 having First_Name,Last_name & DOB duplicate.
Advance Many Thanks.,
DakHi Dak,
option 1:
go to advanced tab of that particular report...
You find check box Check this box to issue an explicit Select Distinct
option 2:
Uncheck the following item in Physical layer database features.
DISTINCT_SUPPORTED
For displaying duplicate rows refer : http://carpediemconsulting.wordpress.com/2008/08/13/displaying-duplicate-values-in-obiee-reports/
Thanks
Aravind -
Request chaning/flow in OBIEE Answers?
In OBIEE Answers, is it possible to save the value of a request and reuse this value for further
calculations?
In other words, I want to use the results of request(s) as the data source for another request.
The use case is like this:
1. Use OBIEE Answers to get the value of a metric. There are multiple such metrics. Create one request per metric and save all such requests.
2. Use the requests saved in step 1 to derive a higher layer of metrics. Save these requests.
3. Use the requests saved in step 2 to derive a higher layer of metrics. Save these requests.
And so on.
Then I want to show these metrics on the dashboard with drill down navigation.
Appreciate your help.
Thank you.Hi all,
Thanks for the reply.
But this doesn't seem to solve the problem.
Let me put it in other words:
Result-1:
Metric_A X <-- single row resulting from a request in OBIEE Answers
Result-2:
Metric_B Y <-- again single row resulting from a request in OBIEE Answers
Result-3 (to be derived from above two results)
Metric_C a*X + b*Y
where a, b are constants.
and so on...
Edited by: user2363628 on Jun 10, 2010 2:18 AM -
Sort in OBIEE Answers - Desc Nulls Last
I want to sort Desc on a Answers column, but want NULLS last. Where do I set it?
For instance I can write SQL
select * from T1 order by c2 Nulls first;
NULLS last is default behavior in Oracle SQL
However, via OBIEE Answers, I see when I use DESC Nulls are on top, I want them on bottom.
Where should I set it?Hi shyamvaran,
What is the value of your "NULL_VALUES_SORT_FIRST" parameter in your NQSConfig.INI file? By default, this is set to OFF. Which is probably what your seeing i.e. if NULLs are last, and you are sorting in descending order, then you would expect to see NULLs first.
If you want NULLs to show up last when sorting in descending order, then set the above parameter to ON and bounce your services. That should take care of you.
Otherwise, you can do a work around. Create a hidden column in your report. Set it's formula to IFNULL(C2,'aaaaaaaaaaa') . This way it'll be alphabetically first i.e. last in descending order. Set this column to sort descending and then set it to hidden. It should sort your report in the desired order and it should be hidden from view.
Good luck and if you found this post useful, please award points!
Best regards,
-Joe -
Parse String in OBIEE Answers.
Please can someone help me to know how to parse a string in obiee answers:
Eg: 'Administrators;XMLP_ADMIN;319'.
I can do this very easy in Java but not sure how to do it in OBIEE. Appreciate your help
Regards.Hi,
what are you expecting to do with that string? can you be more specific?
you want to have all values before the semi colon?
you can use regexp in obiee to parse these kind of strings..
i think this must be helpful to you..
http://oraclebizint.wordpress.com/2009/06/04/oracle-bi-ee-10-1-3-4-1-handling-complex-string-manipulations-using-regular-expressions-regex-and-evaluate/
if its helpful award points
thanks,
karthick
Edited by: kart on May 28, 2010 3:56 PM
Maybe you are looking for
-
ITunes locked up while Transferring Purchases
iTunes version 10.1.2.17, iPad 3G 64M version 4.2.1 Several months ago I purchased several videos on my iPad. Most worked fine, but one of them locked up the video application on the iPad. When selected, it just went to a blank black screen and does
-
Error using WEEKDAY function in view filter
I want to be able to display all events in a calendar for the following week (Saturday to Saturday). I have created a column called week_end that is a calculated column and gives the date of the Saturday after the event: =[Start Time]+(7-WEEKDAY([Sta
-
How to show Phonetic symbol in a j2me program?
i want write a dictionary program,but now i don't know how to show Phonetic symbol in the program! does someone can help me ?
-
App will not open after update from market.
I have an android app that when I publish an update and the user downloads the update the app will not open. It opens for a second and then closes. This happens even if I do not change anything in the update. The only thing I can find is that after
-
Can Someone please help me with ERROR 4251
I have tried everything! even slowing down the burn speed. Can someone please help with error 4251 when burning. I have my diagnostics report done as well. Thank you to anyone who can help.