Need explanation on the below behavior of rownum.
Hi,
I have a normal table employee with 4 columns(id,name,age,salary).
I am using the below queries on it.
What is the reason that query 1 and 4 gives value whereas 2 and 3 doesn't??
Can someone explain this behaviour of rowwnum?
1) select rownum,emp.* from employee rownum = 1; --gives value
2) select rownum,emp.* from employee rownum = 1; --doesn't
3) select rownum,emp.* from employee rownum > 1; --doesn't
4) select rownum,emp.* from employee rownum < 5; --gives value
Manoj0408 wrote:
hi Nicolas,
the second query should have been
2) select rownum,emp.* from employee rownum = 2 or 3 or 4 anything greater than 1
if i put this why dont this returns any row?
3) For third query also there are values for rownum > 1 ie .2,3,4,5 etc..
so this should reurn other rows except 1 ie greater than 1.
No, you still don't understand.
Rownum is not an immutable attribute of a row. It is assigned as the result set is being built.
So the first row that makes it through the other filters is assigned rownum 1. It is then evaluated against the rownum condition. Is it = 2 (query 2) ? No. Is it > 1 (qeury 4)? No. So it is rejected.
The next row up is then assigned rownum 1. It is then evaluated against the rownum condition. Is it = 2 (query 2) ? No. Is it > 1 (qeury 4)? No. So it is rejected.
The next row up is then assigned rownum 1. It is then evaluated against the rownum condition. Is it = 2 (query 2) ? No. Is it > 1 (qeury 4)? No. So it is rejected.
The next row up is then assigned rownum 1. It is then evaluated against the rownum condition. Is it = 2 (query 2) ? No. Is it > 1 (qeury 4)? No. So it is rejected.
See how this could go on forever?
By the way, on my system, none of your queries work at all. They are missing the keyword "WHERE".
Similar Messages
-
Need help on the below query.
Hi All,
I've a query given below..
SELECT W.WONUM,
W.STATUS,
WS.CHANGEDATE,
EH.OLD_RATE
FROM
WORKORDER W,
WOSTATUS WS,
ESTIMATE_HEADER@GQMFOF EH
WHERE WS.CHANGEDATE BETWEEN '01-Oct-2009' AND '1-Nov-2009'
AND W.WONUM = WS.WONUM
AND EH.OLD_RATE = 'N'
AND WS.WOSTATUS = 'CLOSE';
I would like to get All the data which status =closed in the month of Oct for Old rate,
So for this i am writing the query above. But not getting the o/p.
It is giving me that " Table/View doesn't exist.
There 2 schemas MAXIMO,GQMMGR..
DBlinks are GQMFOF,MAXFOFNC..
Can anyone help me while writing the above query...
Regards,
gr.A question was asked in your other thread. But the problem was you dint care to give an answer.
Dont open duplicate post.
I need help on the below problem.. -
I need help on the below problem..
Hi All,
I need help on the below problem..
I've 2 Schemas called
1. MAXIMO and DBLink is GQMFOF
2. GQMMGR adn DBLink is MAXFOFNC
Now i would likw to retrive the data from both the schemas,
i.e some columns from WORKORDER table of maximo schema and some columns from ESTIMATE_HEADER table
of GQMMGR schema..
I'm trying to get the data using DB links, but it is giving TABLE/VIEW doesn't exist.
Please help me on this.
Regards,
gr.Does your user has the SELECT privelage granted for accessing those tables?
-
Need help on the below query or Pl-SQL
Hello Every one,
Please let me know if some one can help me out with the below scenario either in pl-sql or sql.
Source Data:
0000253800 0.25 0845A 0900A
0000253800 1 0900A 1000A
0000253800 1 1300P 1400P
0000253800 1 1500P 1600P
0000253800 1 1600P 1700P
Output needed:
0000253800 1.25 0845A 1000A
0000253800 1 1300P 1400P
0000253800 2 1500P 1700P
Thanks in Advance....
Edited by: user12564103 on Dec 11, 2011 5:54 PMHi,
Welcome to the forum!
Depending on your data and your requirements:
WITH got_times AS
SELECT column_1, column_2, column_3, column_4
, TO_DATE ( substr (column_3, 1, 4)
, 'HH24MI'
) AS time_3
, TO_DATE ( SUBSTR (column_4, 1, 4)
, 'HH24MI'
) AS time_4
FROM table_x
, got_grp_id AS
SELECT column_1, column_2, column_3, column_4
, time_3, time_4
, time_4 - SUM (time_4 - time_3) OVER ( PARTITION BY column_1
ORDER BY time_3
) AS grp_id
FROM got_times
SELECT column_1
, SUM (column_2) AS sum_2
, MIN (column_3) KEEP (DENSE_RANK FIRST ORDER BY time_3)
AS min_3
, MAX (column_4) KEEP (DENSE_RANK LAST ORDER BY time_4)
AS max_4
FROM got_grp_id
GROUP BY column_1
, grp_id
ORDER BY column_1
, grp_id
;Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data, as well as the results you want from that data. Explain, with specific examples, how you get the results you want from that data.
Always say which version of Oracle you're using. The query above will work in Oracle 9.1 (and higher).
Since this is your first thread, I'll do this for you:
CREATE TABLE table_x
( column_1 NUMBER
, column_2 NUMBER
, column_3 VARCHAR2 (5)
, column_4 VARCHAR2 (5)
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, .25, '0845A', '0900A');
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1, '0900A', '1000A');
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1, '1300P', '1400P');
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1, '1500P', '1600P');
INSERT INTO table_x (column_1, column_2, column_3, column_4) VALUES (253800, 1, '1600P', '1700P');Column_1 identifes a day.
Column_2 is an amount that I need to total.
Column_3 and column_4 are starting and ending times. We can assume that they are all valid times (in 'HH24MI' format, plus a redundant 'A' or 'P') on the same day, column_3 is always less than column_4, and that the range of two rows for the same value of column_1 never overlap. Column_4 of one row may be equal to column_3 of another rows with the same column_1, but it will never be greater.
Each row of the output represent a contiguous group of rows (each ending exactly when the next one begins) with the same column_1, with the common column_1, the total of column_2, and the range of the group.
For example, the first two rows for a single group, because they have the same value for column_1, and one ends exactly when the other begins (at 9:00 AM). This group represents day 253800, from 8:45 AM to 10:00 AM. The totla of column_2 fro this group is .25 + 1 = 1.25.
The next row (from 1:00 PM to 2:00 PM) is a group all by itself, because there is a gap one either side of it separating it from its nearest neighbor on the same day."
Of course, I'm guessing at lots of things.
Edited by: Frank Kulash on Dec 11, 2011 9:44 PM
Changed TO_DATE calls.
Edited by: Frank Kulash on Dec 11, 2011 9:52 PM
Added sample question. -
Need explanation of the following code
HI All,
I need your help on explanation of the following code :
what I don't understand is how it route the request (all the benefit of the replace statement )
If the input is /scarr/LH/SPFLI/402
how he know to route it and
what is the benefit for using the wild card and the concatenate CONCATENATE '^' lv_verif_pattern '$'
Edited by: James Herb on Apr 13, 2010 9:53 AM
Edited by: James Herb on Apr 13, 2010 9:53 AMDATA: lt_routing_tab TYPE z_resource_routing_tab,
CONSTANTS: param_wildcard TYPE string VALUE '([^/])*'.
FIELD-SYMBOLS: <ls_routing> LIKE LINE OF lt_routing_tab.
CALL METHOD get_routing
RECEIVING
rt_routing_tab = lt_routing_tab.
LOOP AT lt_routing_tab ASSIGNING <ls_routing>.
* replace all parameters placeholders by regex
lv_verif_pattern = <ls_routing>-url_info.
lv_signature = <ls_routing>-url_info.
REPLACE ALL OCCURRENCES OF REGEX '\{([A-Z]*[_]*[a-z]*[0-9]*)*\}'
IN lv_verif_pattern WITH param_wildcard.
CONCATENATE '^' lv_verif_pattern '$' INTO lv_verif_pattern.
* check if pattern matches current entry
FIND ALL OCCURRENCES OF REGEX lv_verif_pattern
IN url_info MATCH COUNT lv_count.
* pattern matched
IF lv_count > 0.
* get controller class name
lv_controller_name = <ls_routing>-handler_class.
ls_class-clsname = lv_controller_name.
* check if class exists
* class found
IF sy-subrc = 0.
* create controller
CREATE OBJECT eo_controller TYPE (lv_controller_name).
* create parameter table
SHIFT lv_verif_pattern RIGHT DELETING TRAILING '$'.
SHIFT lv_verif_pattern LEFT DELETING LEADING ' ^'.
SPLIT lv_verif_pattern AT param_wildcard INTO TABLE lt_url_parts.
lv_url_info = url_info.
LOOP AT lt_url_parts INTO lv_url_part.
SHIFT lv_signature LEFT DELETING LEADING lv_url_part.
SHIFT lv_signature LEFT DELETING LEADING '{'.
SHIFT lv_url_info LEFT DELETING LEADING lv_url_part.
Edited by: James Herb on Apr 13, 2010 9:56 AM -
Need to merge the below two rows
Hi,
I have a sample data as shown below:
ID OBJID ACT_CODE ADDNL_INFO ENTRY_TIME
2523540 333003736 900 from WIP default to Queue PSD1. 1/3/2012 15:07
2523540 333003271 100 100 from Queue PSD1 to WIP For assigment. 1/3/2012 15:43
2523540 333003744 900 900 from WIP default to Queue PSD1. 1/3/2012 15:49
2523540 333004966 100 100 from Queue PSD1 to WIP For assigment. 1/3/2012 16:04
I need to merge the first two rows and get a single record for each "from" and "to" as shown below (desired output)
ID_NUMBER ADDNL_INFO ENTRY_TIME EXIT_TIME TOTAL TIME
2523540 PSD1 1/3/2012 15:07 1/3/2012 15:43 0.025069444
2523540 PSD1 1/3/2012 15:49 1/3/2012 16:04 0.010231481
I have used function on the addnl_info column to display only the name of the queue "PSD1"
(SUBSTR(ADDNL_INFO, INSTR(ADDNL_INFO, 'PSD1'), LENGTH('PSD1'))) QUEUE_NAME
Can any one help me out in getting the desired output.Below is a solution to your query:
drop table test_Table;
create table test_Table
ID number,
objid number,
act_code number,
addl_info varchar2(500),
entry_time timestamp
insert into test_Table values (2523540, 333003736, 900, 'from WIP default to Queue PSD1.', to_timestamp('1/3/2012 15:07', 'DD/MM/YYYY HH24:MI'));
insert into test_Table values (2523540, 333003271, 100, 'from Queue PSD1 to WIP For assigment.', to_timestamp('1/3/2012 15:43', 'DD/MM/YYYY HH24:MI'));
insert into test_Table values (2523540, 333003744, 900, 'from WIP default to Queue PSD1.', to_timestamp('1/3/2012 15:49', 'DD/MM/YYYY HH24:MI'));
insert into test_Table values (2523540, 333004966, 100, 'from Queue PSD1 to WIP For assigment.', to_timestamp('1/3/2012 16:04', 'DD/MM/YYYY HH24:MI'));
select * from test_table;
select id, addl_info, entry_time, exit_time, total_time
from
select a.id, a.objid, 'PSD1' addl_info, a.entry_time, lead(a.entry_time, 1, null) over (order by a.entry_time) exit_time,
lead(a.entry_time, 1, null) over (order by a.entry_time) - a.entry_time total_time, DECODE(a.act_code, 900, 'D', 'ND') disp
from test_Table a
where a.id = 2523540
where disp = 'D';
ID ADDL_INFO ENTRY_TIME EXIT_TIME TOTAL_TIME
2523540 PSD1 01-MAR-12 03.07.00.000000000 PM 01-MAR-12 03.43.00.000000000 PM 0 0:36:0.0
2523540 PSD1 01-MAR-12 03.49.00.000000000 PM 01-MAR-12 04.04.00.000000000 PM 0 0:15:0.0I see a shortcoming in the design:
1. For "WIP default to Queue PSD1" there are two records, both containing different OBJID but same ID, which in ideal case should not happen. You MUST have a COMPOSITE key on ID and OBJID; This shall help you to identify the distinct records.
My solution is not perfect as it is based on the ENTRY TIME. The reason being SIMPLE Ordering by the OBJID would not lead to a correct difference in the Transaction Time (referred by you as TOTAL_TIME.); Hence, for this reason I had to use ENTRY_TIME to correctly get the total_time.
If you wish you may follow the solution else I shall always recommend to change the Table Design and follow the correct approach.
If you are changing the Table design then following shall be a solution:
select id, addl_info, entry_time, exit_time, total_time
from
select a.id, a.objid, 'PSD1' addl_info, a.entry_time, lead(a.entry_time, 1, null) over (order by a.id, a.objid) exit_time,
lead(a.entry_time, 1, null) over (order by a.entry_time) - a.entry_time total_time, DECODE(a.act_code, 900, 'D', 'ND') disp
from test_Table a
where disp = 'D';Regards,
P. -
Need help in the below command excution
Hi Champs,
Can any one help with the below command, It is not working.
Get-CsUser | Where-Object {$_.dialplan -eq "USDAL"} | Grant-CsLocationPolicy -PolicyName "Dallas Location Policy"
Regards
VijendharYou could try something like:
$userlist = Get-CsUser -ResultSize Unlimited
foreach ($user in $userlist)
if ($user.dialplan -eq $Null)
$pool = (Get-csdialplan | Where-Object {$_.Identity -like ("*" + $user.RegistrarPool)})
if ($pool.length -ge "1") {write-host ("Pool simple name: " + $pool.simplename + ", Identity: " + $pool.identity)}
if (($pool.simplename -eq "USDal") -or ($pool.identity -eq "USDal"))
Write-host "Please Grant location policy to: $user.Displayname"
# Get-csuser $user.identity | Grant-CsLocationPolicy -PolicyName "Dallas Location Policy"
$pool = $Null
Use at your own risk as I haven't had a chance to test, I have commented out the grant so you can test prior to changes.
Please mark posts as answers/helpful if it answers your question.
Blog
Lync Validator - Used to assist in the validation and documentation of Lync Server 2013. -
Need Suggesion for the below logic
Hi Experts,
i have a 6 fields a,b,c,d,e,f in the source and in the target i have one field k
My mapping requirement is
if a =1 then K =b
suppose if b is blank
then k=c
suppose if c is blank
then k = d
suppose if d is blank
then k = e
suppose if e is blank
then k=f
In the mapping i wrote a decode function as below
decode ( a = '1',b,
(a='1' and b = ' '),c,
(a='1' and c = ' '),d,
(a='1' and d = ' '),e,
(a='1' and e = ' '),f,null)
My problem is when the first field i.e if b is blank, i should get c values, i am using 4.1 version, i am not getting expected
Any Suggesion please
Thanks
MadhuThe Data types A is int
B,C,D,E,F are varchar (30)
K is varchar(40)
The requirement is
if A =1 then K =B
suppose if B is blank
then K=C
suppose if C is blank
then K = D
suppose if D is blank
then K = E
suppose if E is blank
then K=F
Out of 5 fields--B,C,D,E,F . K value should be the first value out of these 5 fields in the Order B ,C, D, E, F which is not blank
Please let me know if you did not understand
Thanks
Madhu -
Need to tune the below query.
Query below:
I have generated the explain plan for the same and its cost is overall 2089...
But Strange once I have removed the "ORDER SIBLINGS BY RETAILER_NM" from below then its cost is coming overall 40.
Can U suggest me what is the best solution.
SELECT path as Retailer_id, logical_physical_flg, parent_retailer_id, upper(retailer_nm), max_level
FROM (SELECT A.RETAILER_ID,LOGICAL_PHYSICAL_FLG, NULL AS PARENT_RETAILER_ID, B.RETAILER_NM, a.retailer_id path,
(LEVEL+2) AS MAX_LEVEL FROM
RETAILER B, USER_RETAILER_MAP A WHERE USER_ID= 'ALEX.CAYLESS@GMACIO' AND
B.RETAILER_ID=A.RETAILER_ID AND B.STATUS='ACTIVE' AND
A.RETAILER_ID NOT IN (SELECT DISTINCT RETAILER_ID FROM
RETAILER_HIERARCHY START WITH PARENT_RETAILER_ID IN (SELECT RETAILER_ID FROM USER_RETAILER_MAP A
WHERE USER_ID= 'ALEX.CAYLESS@GMACIO' AND MANAGED_BY='Y') CONNECT BY PRIOR RETAILER_ID=PARENT_RETAILER_ID)
AND MANAGED_BY='Y'
UNION
SELECT a.RETAILER_ID, LOGICAL_PHYSICAL_FLG, replace(sys_connect_by_path(decode(level, 1, a.parent_retailer_id), '~'), '~') parent_retailer_id, RETAILER_NM, LPAD(' ', 2*LEVEL-1)||SYS_CONNECT_BY_PATH(B.RETAILER_ID, '/') AS path, LEVEL+3 AS MAX_LEVEL
FROM RETAILER B, RETAILER_HIERARCHY A
WHERE B.RETAILER_ID=A.RETAILER_ID AND UPPER(B.STATUS)='ACTIVE' AND EXISTS
(SELECT RETAILER_ID FROM USER_RETAILER_MAP C WHERE USER_ID = 'ALEX.CAYLESS@GMACIO' AND
B.RETAILER_ID = C.RETAILER_ID AND MANAGED_BY= 'Y')
START WITH PARENT_RETAILER_ID IN (SELECT A.RETAILER_ID FROM
RETAILER B, USER_RETAILER_MAP A WHERE USER_ID= 'ALEX.CAYLESS@GMACIO' AND B.RETAILER_ID=A.RETAILER_ID
AND UPPER(B.STATUS)='ACTIVE' AND A.RETAILER_ID NOT IN (SELECT DISTINCT RETAILER_ID FROM
RETAILER_HIERARCHY START WITH PARENT_RETAILER_ID IN (SELECT RETAILER_ID FROM USER_RETAILER_MAP A
WHERE USER_ID= 'ALEX.CAYLESS@GMACIO' AND MANAGED_BY='Y') CONNECT BY PRIOR RETAILER_ID=PARENT_RETAILER_ID)
AND MANAGED_BY='Y') CONNECT BY PRIOR A.RETAILER_ID=PARENT_RETAILER_ID )
START WITH PARENT_RETAILER_ID IS NULL CONNECT BY PRIOR RETAILER_ID = PARENT_RETAILER_ID
ORDER SIBLINGS BY RETAILER_NM
Explain Plan:
==========================
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1352 | 5385K| 2089 |
|* 1 | CONNECT BY WITH FILTERING | | | | |
|* 2 | FILTER | | | | |
| 3 | COUNT | | | | |
| 4 | VIEW | | 1352 | 5385K| 40 |
| 5 | SORT UNIQUE | | 1352 | 84128 | 40 |
| 6 | UNION-ALL | | | | |
|* 7 | HASH JOIN ANTI | | 16 | 1296 | 12 |
|* 8 | HASH JOIN | | 19 | 1406 | 9 |
| 9 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 10 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 2409 | | 1 |
|* 11 | TABLE ACCESS FULL | RETAILER | 1594 | 70136 | 6 |
| 12 | VIEW | VW_NSO_1 | 3 | 21 | 2 |
|* 13 | CONNECT BY WITH FILTERING | | | | |
| 14 | NESTED LOOPS | | | | |
|* 15 | HASH JOIN | | 58 | 2262 | 5 |
| 16 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 17 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 18 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 19 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 20 | NESTED LOOPS | | | | |
| 21 | BUFFER SORT | | 3 | 54 | |
| 22 | CONNECT BY PUMP | | | | |
|* 23 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|* 24 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 25 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|* 26 | FILTER | | | | |
|* 27 | CONNECT BY WITH FILTERING | | | | |
|* 28 | FILTER | | | | |
| 29 | COUNT | | | | |
|* 30 | HASH JOIN | | 1336 | 82832 | 9 |
| 31 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 1336 | 24048 | 2 |
| 32 | TABLE ACCESS FULL | RETAILER | 3188 | 136K| 6 |
| 33 | NESTED LOOPS ANTI | | 1 | 54 | 5 |
| 34 | NESTED LOOPS | | 1 | 47 | 3 |
|* 35 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 36 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|* 37 | TABLE ACCESS BY INDEX ROWID | RETAILER | 1 | 17 | 1 |
|* 38 | INDEX UNIQUE SCAN | XPKRETAILER | 100 | | |
|* 39 | VIEW | VW_NSO_3 | 3 | 21 | |
|* 40 | CONNECT BY WITH FILTERING | | | | |
| 41 | NESTED LOOPS | | | | |
|* 42 | HASH JOIN | | 58 | 2262 | 5 |
| 43 | TABLE ACCESS BY INDEX ROWID| USER_RETAILER_MAP | 19 | 570 | 2 |
|* 44 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 45 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 46 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 47 | NESTED LOOPS | | | | |
| 48 | BUFFER SORT | | 3 | 54 | |
| 49 | CONNECT BY PUMP | | | | |
|* 50 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|* 51 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 52 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
| 53 | HASH JOIN | | | | |
| 54 | CONNECT BY PUMP | | | | |
| 55 | COUNT | | | | |
|* 56 | HASH JOIN | | 1336 | 82832 | 9 |
| 57 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 1336 | 24048 | 2 |
| 58 | TABLE ACCESS FULL | RETAILER | 3188 | 136K| 6 |
| 59 | NESTED LOOPS ANTI | | 1 | 54 | 5 |
| 60 | NESTED LOOPS | | 1 | 47 | 3 |
|* 61 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 62 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|* 63 | TABLE ACCESS BY INDEX ROWID | RETAILER | 1 | 17 | 1 |
|* 64 | INDEX UNIQUE SCAN | XPKRETAILER | 100 | | |
|* 65 | VIEW | VW_NSO_3 | 3 | 21 | |
|* 66 | CONNECT BY WITH FILTERING | | | | |
| 67 | NESTED LOOPS | | | | |
|* 68 | HASH JOIN | | 58 | 2262 | 5 |
| 69 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 70 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 71 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 72 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 73 | NESTED LOOPS | | | | |
| 74 | BUFFER SORT | | 3 | 54 | |
| 75 | CONNECT BY PUMP | | | | |
|* 76 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|* 77 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 78 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|* 79 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 80 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
| 81 | HASH JOIN | | | | |
| 82 | CONNECT BY PUMP | | | | |
| 83 | COUNT | | | | |
| 84 | VIEW | | 1352 | 5385K| 40 |
| 85 | SORT UNIQUE | | 1352 | 84128 | 40 |
| 86 | UNION-ALL | | | | |
|* 87 | HASH JOIN ANTI | | 16 | 1296 | 12 |
|* 88 | HASH JOIN | | 19 | 1406 | 9 |
| 89 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 90 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 2409 | | 1 |
|* 91 | TABLE ACCESS FULL | RETAILER | 1594 | 70136 | 6 |
| 92 | VIEW | VW_NSO_1 | 3 | 21 | 2 |
|* 93 | CONNECT BY WITH FILTERING | | | | |
| 94 | NESTED LOOPS | | | | |
|* 95 | HASH JOIN | | 58 | 2262 | 5 |
| 96 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 97 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 98 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 99 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 100 | NESTED LOOPS | | | | |
| 101 | BUFFER SORT | | 3 | 54 | |
| 102 | CONNECT BY PUMP | | | | |
|*103 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|*104 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*105 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|*106 | FILTER | | | | |
|*107 | CONNECT BY WITH FILTERING | | | | |
|*108 | FILTER | | | | |
| 109 | COUNT | | | | |
|*110 | HASH JOIN | | 1336 | 82832 | 9 |
| 111 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 1336 | 24048 | 2 |
| 112 | TABLE ACCESS FULL | RETAILER | 3188 | 136K| 6 |
| 113 | NESTED LOOPS ANTI | | 1 | 54 | 5 |
| 114 | NESTED LOOPS | | 1 | 47 | 3 |
|*115 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*116 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|*117 | TABLE ACCESS BY INDEX ROWID | RETAILER | 1 | 17 | 1 |
|*118 | INDEX UNIQUE SCAN | XPKRETAILER | 100 | | |
|*119 | VIEW | VW_NSO_3 | 3 | 21 | |
|*120 | CONNECT BY WITH FILTERING | | | | |
| 121 | NESTED LOOPS | | | | |
|*122 | HASH JOIN | | 58 | 2262 | 5 |
| 123 | TABLE ACCESS BY INDEX ROWID| USER_RETAILER_MAP | 19 | 570 | 2 |
|*124 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 125 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 126 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 127 | NESTED LOOPS | | | | |
| 128 | BUFFER SORT | | 3 | 54 | |
| 129 | CONNECT BY PUMP | | | | |
|*130 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|*131 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*132 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
| 133 | HASH JOIN | | | | |
| 134 | CONNECT BY PUMP | | | | |
| 135 | COUNT | | | | |
|*136 | HASH JOIN | | 1336 | 82832 | 9 |
| 137 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 1336 | 24048 | 2 |
| 138 | TABLE ACCESS FULL | RETAILER | 3188 | 136K| 6 |
| 139 | NESTED LOOPS ANTI | | 1 | 54 | 5 |
| 140 | NESTED LOOPS | | 1 | 47 | 3 |
|*141 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*142 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|*143 | TABLE ACCESS BY INDEX ROWID | RETAILER | 1 | 17 | 1 |
|*144 | INDEX UNIQUE SCAN | XPKRETAILER | 100 | | |
|*145 | VIEW | VW_NSO_3 | 3 | 21 | |
|*146 | CONNECT BY WITH FILTERING | | | | |
| 147 | NESTED LOOPS | | | | |
|*148 | HASH JOIN | | 58 | 2262 | 5 |
| 149 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|*150 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 151 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 152 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 153 | NESTED LOOPS | | | | |
| 154 | BUFFER SORT | | 3 | 54 | |
| 155 | CONNECT BY PUMP | | | | |
|*156 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|*157 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*158 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|*159 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*160 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
Predicate Information (identified by operation id):
1 - filter("from$_subquery$_001"."PARENT_RETAILER_ID" IS NULL)
2 - filter("from$_subquery$_001"."PARENT_RETAILER_ID" IS NULL)
7 - access("A"."RETAILER_ID"="VW_NSO_1"."$nso_col_1")
8 - access("B"."RETAILER_ID"="A"."RETAILER_ID")
10 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
11 - filter("B"."STATUS"='ACTIVE')
13 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A" WHERE "A"."USER_ID"='ALEX.CAYLES
S@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY"='Y'))
15 - access("RETAILER_HIERARCHY"."PARENT_RETAILER_ID"="A"."RETAILER_ID")
17 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
23 - filter("SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL)
24 - filter("A"."MANAGED_BY"='Y')
25 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
26 - filter(UPPER("SYS_ALIAS_1"."STATUS")='ACTIVE' AND EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILE
R_MAP" "C" WHERE "C"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "C"."RETAILER_ID"=:B1 AND "C"
."MANAGED_BY"='Y'))
27 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A","RETAILER" "B", (SELECT /*+ */ "
SYS_ALIAS_1"."RETAILER_ID" "$nso_col_1" FROM "RETAILER_HIERARCHY" "SYS_ALIAS_1" WHERE
"SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL) "VW_NSO_3" WHERE "A"."RETAILER_ID"="VW_NSO_3"
."$nso_col_1" AND "B"."RETAILER_ID"="A"."RETAILER_ID" AND UPPER("B"."STATUS")='ACTIVE'
AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY
"='Y'))
28 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A","RETAILER" "B", (SELECT /*+ */ "
SYS_ALIAS_1"."RETAILER_ID" "$nso_col_1" FROM "RETAILER_HIERARCHY" "SYS_ALIAS_1" WHERE
"SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL) "VW_NSO_3" WHERE "A"."RETAILER_ID"="VW_NSO_3"
."$nso_col_1" AND "B"."RETAILER_ID"="A"."RETAILER_ID" AND UPPER("B"."STATUS")='ACTIVE'
AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY
"='Y'))
30 - access("SYS_ALIAS_1"."RETAILER_ID"="SYS_ALIAS_2"."RETAILER_ID")
35 - filter("A"."MANAGED_BY"='Y')
36 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
37 - filter(UPPER("B"."STATUS")='ACTIVE')
38 - access("B"."RETAILER_ID"="A"."RETAILER_ID")
39 - filter("A"."RETAILER_ID"="VW_NSO_3"."$nso_col_1")
40 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A" WHERE "A"."USER_ID"='ALEX.CAYLES
S@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY"='Y'))
42 - access("RETAILER_HIERARCHY"."PARENT_RETAILER_ID"="A"."RETAILER_ID")
44 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
50 - filter("SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL)
51 - filter("A"."MANAGED_BY"='Y')
52 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
56 - access("SYS_ALIAS_1"."RETAILER_ID"="SYS_ALIAS_2"."RETAILER_ID")
61 - filter("A"."MANAGED_BY"='Y')
62 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
63 - filter(UPPER("B"."STATUS")='ACTIVE')
64 - access("B"."RETAILER_ID"="A"."RETAILER_ID")
65 - filter("A"."RETAILER_ID"="VW_NSO_3"."$nso_col_1")
66 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A" WHERE "A"."USER_ID"='ALEX.CAYLES
S@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY"='Y'))
68 - access("RETAILER_HIERARCHY"."PARENT_RETAILER_ID"="A"."RETAILER_ID")
70 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
76 - filter("SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL)
77 - filter("A"."MANAGED_BY"='Y')
78 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
79 - filter("C"."MANAGED_BY"='Y')
80 - access("C"."RETAILER_ID"=:B1 AND "C"."USER_ID"='ALEX.CAYLESS@GMACIO')
87 - access("A"."RETAILER_ID"="VW_NSO_1"."$nso_col_1")
88 - access("B"."RETAILER_ID"="A"."RETAILER_ID")
90 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
91 - filter("B"."STATUS"='ACTIVE')
93 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A" WHERE "A"."USER_ID"='ALEX.CAYLES
S@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY"='Y'))
95 - access("RETAILER_HIERARCHY"."PARENT_RETAILER_ID"="A"."RETAILER_ID")
97 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
103 - filter("SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL)
104 - filter("A"."MANAGED_BY"='Y')
105 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
106 - filter(UPPER("SYS_ALIAS_1"."STATUS")='ACTIVE' AND EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILE
R_MAP" "C" WHERE "C"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "C"."RETAILER_ID"=:B1 AND "C"
."MANAGED_BY"='Y'))
107 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A","RETAILER" "B", (SELECT /*+ */ "
SYS_ALIAS_1"."RETAILER_ID" "$nso_col_1" FROM "RETAILER_HIERARCHY" "SYS_ALIAS_1" WHERE
"SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL) "VW_NSO_3" WHERE "A"."RETAILER_ID"="VW_NSO_3"
."$nso_col_1" AND "B"."RETAILER_ID"="A"."RETAILER_ID" AND UPPER("B"."STATUS")='ACTIVE'
AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY
"='Y'))
108 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A","RETAILER" "B", (SELECT /*+ */ "
SYS_ALIAS_1"."RETAILER_ID" "$nso_col_1" FROM "RETAILER_HIERARCHY" "SYS_ALIAS_1" WHERE
"SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL) "VW_NSO_3" WHERE "A"."RETAILER_ID"="VW_NSO_3"
."$nso_col_1" AND "B"."RETAILER_ID"="A"."RETAILER_ID" AND UPPER("B"."STATUS")='ACTIVE'
AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY
"='Y'))
110 - access("SYS_ALIAS_1"."RETAILER_ID"="SYS_ALIAS_2"."RETAILER_ID")
115 - filter("A"."MANAGED_BY"='Y')
116 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
117 - filter(UPPER("B"."STATUS")='ACTIVE')
118 - access("B"."RETAILER_ID"="A"."RETAILER_ID")
119 - filter("A"."RETAILER_ID"="VW_NSO_3"."$nso_col_1")
120 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A" WHERE "A"."USER_ID"='ALEX.CAYLES
S@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY"='Y'))
122 - access("RETAILER_HIERARCHY"."PARENT_RETAILER_ID"="A"."RETAILER_ID")
124 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
130 - filter("SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL)
131 - filter("A"."MANAGED_BY"='Y')
132 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
136 - access("SYS_ALIAS_1"."RETAILER_ID"="SYS_ALIAS_2"."RETAILER_ID")
141 - filter("A"."MANAGED_BY"='Y')
142 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
143 - filter(UPPER("B"."STATUS")='ACTIVE')
144 - access("B"."RETAILER_ID"="A"."RETAILER_ID")
145 - filter("A"."RETAILER_ID"="VW_NSO_3"."$nso_col_1")
146 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A" WHERE "A"."USER_ID"='ALEX.CAYLES
S@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY"='Y'))
148 - access("RETAILER_HIERARCHY"."PARENT_RETAILER_ID"="A"."RETAILER_ID")
150 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
156 - filter("SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL)
157 - filter("A"."MANAGED_BY"='Y')
158 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
159 - filter("C"."MANAGED_BY"='Y')
160 - access("C"."RETAILER_ID"=:B1 AND "C"."USER_ID"='ALEX.CAYLESS@GMACIO')
Edited by: user13345267 on Jul 19, 2010 1:56 AMPlease find formatted sql.
SELECT path AS retailer_id,
logical_physical_flg,
parent_retailer_id,
Upper(retailer_nm),
max_level
FROM (SELECT a.retailer_id,
logical_physical_flg,
NULL AS parent_retailer_id,
b.retailer_nm,
a.retailer_id path,
( LEVEL + 2 ) AS max_level
FROM retailer b,
user_retailer_map a
WHERE user_id = 'ALEX.CAYLESS@GMACIO'
AND b.retailer_id = a.retailer_id
AND b.status = 'ACTIVE'
AND a.retailer_id NOT IN (SELECT DISTINCT retailer_id
FROM retailer_hierarchy
START WITH parent_retailer_id IN (
SELECT
retailer_id
FROM
user_retailer_map a
WHERE
user_id = 'ALEX.CAYLESS@GMACIO'
AND managed_by = 'Y')
CONNECT BY PRIOR
retailer_id = parent_retailer_id)
AND managed_by = 'Y'
UNION
SELECT a.retailer_id,
logical_physical_flg,
Replace(Sys_connect_by_path(
Decode(LEVEL, 1, a.parent_retailer_id), '~')
'~')
parent_retailer_id,
retailer_nm,
Lpad(' ', 2 * LEVEL - 1)
||Sys_connect_by_path(b.retailer_id, '/') AS path,
LEVEL + 3 AS max_level
FROM retailer b,
retailer_hierarchy a
WHERE b.retailer_id = a.retailer_id
AND Upper(b.status) = 'ACTIVE'
AND EXISTS (SELECT retailer_id
FROM user_retailer_map c
WHERE user_id = 'ALEX.CAYLESS@GMACIO'
AND b.retailer_id = c.retailer_id
AND managed_by = 'Y')
START WITH parent_retailer_id IN (SELECT a.retailer_id
FROM retailer b,
user_retailer_map a
WHERE user_id = 'ALEX.CAYLESS@GMACIO'
AND
b.retailer_id = a.retailer_id
AND Upper(b.status) = 'ACTIVE'
AND a.retailer_id NOT IN
(SELECT DISTINCT
retailer_id
FROM retailer_hierarchy
START WITH parent_retailer_id IN
SELECT
retailer_id
FROM
user_retailer_map a
WHERE
user_id = 'ALEX.CAYLESS@GMACIO'
AND managed_by = 'Y')
CONNECT BY PRIOR
retailer_id = parent_retailer_id)
AND managed_by = 'Y')
CONNECT BY PRIOR a.retailer_id = parent_retailer_id)
START WITH parent_retailer_id IS NULL
CONNECT BY PRIOR retailer_id = parent_retailer_id
ORDER SIBLINGS BY RETAILER_NM
Execution Plan
====================================
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1352 | 5385K| 2089 |
|* 1 | CONNECT BY WITH FILTERING | | | | |
|* 2 | FILTER | | | | |
| 3 | COUNT | | | | |
| 4 | VIEW | | 1352 | 5385K| 40 |
| 5 | SORT UNIQUE | | 1352 | 84128 | 40 |
| 6 | UNION-ALL | | | | |
|* 7 | HASH JOIN ANTI | | 16 | 1296 | 12 |
|* 8 | HASH JOIN | | 19 | 1406 | 9 |
| 9 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 10 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
|* 11 | TABLE ACCESS FULL | RETAILER | 32 | 1408 | 6 |
| 12 | VIEW | VW_NSO_1 | 3 | 21 | 2 |
|* 13 | CONNECT BY WITH FILTERING | | | | |
| 14 | NESTED LOOPS | | | | |
|* 15 | HASH JOIN | | 58 | 2262 | 5 |
| 16 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 17 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 18 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 19 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 20 | NESTED LOOPS | | | | |
| 21 | BUFFER SORT | | 3 | 54 | |
| 22 | CONNECT BY PUMP | | | | |
|* 23 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|* 24 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 25 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|* 26 | FILTER | | | | |
|* 27 | CONNECT BY WITH FILTERING | | | | |
|* 28 | FILTER | | | | |
| 29 | COUNT | | | | |
|* 30 | HASH JOIN | | 1336 | 82832 | 9 |
| 31 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 1336 | 24048 | 2 |
| 32 | TABLE ACCESS FULL | RETAILER | 3188 | 136K| 6 |
| 33 | NESTED LOOPS ANTI | | 1 | 54 | 5 |
| 34 | NESTED LOOPS | | 1 | 47 | 3 |
|* 35 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 36 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|* 37 | TABLE ACCESS BY INDEX ROWID | RETAILER | 1 | 17 | 1 |
|* 38 | INDEX UNIQUE SCAN | XPKRETAILER | 100 | | |
|* 39 | VIEW | VW_NSO_3 | 3 | 21 | |
|* 40 | CONNECT BY WITH FILTERING | | | | |
| 41 | NESTED LOOPS | | | | |
|* 42 | HASH JOIN | | 58 | 2262 | 5 |
| 43 | TABLE ACCESS BY INDEX ROWID| USER_RETAILER_MAP | 19 | 570 | 2 |
|* 44 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 45 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 46 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 47 | NESTED LOOPS | | | | |
| 48 | BUFFER SORT | | 3 | 54 | |
| 49 | CONNECT BY PUMP | | | | |
|* 50 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|* 51 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 52 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
| 53 | HASH JOIN | | | | |
| 54 | CONNECT BY PUMP | | | | |
| 55 | COUNT | | | | |
|* 56 | HASH JOIN | | 1336 | 82832 | 9 |
| 57 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 1336 | 24048 | 2 |
| 58 | TABLE ACCESS FULL | RETAILER | 3188 | 136K| 6 |
| 59 | NESTED LOOPS ANTI | | 1 | 54 | 5 |
| 60 | NESTED LOOPS | | 1 | 47 | 3 |
|* 61 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 62 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|* 63 | TABLE ACCESS BY INDEX ROWID | RETAILER | 1 | 17 | 1 |
|* 64 | INDEX UNIQUE SCAN | XPKRETAILER | 100 | | |
|* 65 | VIEW | VW_NSO_3 | 3 | 21 | |
|* 66 | CONNECT BY WITH FILTERING | | | | |
| 67 | NESTED LOOPS | | | | |
|* 68 | HASH JOIN | | 58 | 2262 | 5 |
| 69 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 70 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 71 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 72 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 73 | NESTED LOOPS | | | | |
| 74 | BUFFER SORT | | 3 | 54 | |
| 75 | CONNECT BY PUMP | | | | |
|* 76 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|* 77 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 78 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|* 79 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|* 80 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
| 81 | HASH JOIN | | | | |
| 82 | CONNECT BY PUMP | | | | |
| 83 | COUNT | | | | |
| 84 | VIEW | | 1352 | 5385K| 40 |
| 85 | SORT UNIQUE | | 1352 | 84128 | 40 |
| 86 | UNION-ALL | | | | |
|* 87 | HASH JOIN ANTI | | 16 | 1296 | 12 |
|* 88 | HASH JOIN | | 19 | 1406 | 9 |
| 89 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 90 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
|* 91 | TABLE ACCESS FULL | RETAILER | 32 | 1408 | 6 |
| 92 | VIEW | VW_NSO_1 | 3 | 21 | 2 |
|* 93 | CONNECT BY WITH FILTERING | | | | |
| 94 | NESTED LOOPS | | | | |
|* 95 | HASH JOIN | | 58 | 2262 | 5 |
| 96 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|* 97 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 98 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 99 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 100 | NESTED LOOPS | | | | |
| 101 | BUFFER SORT | | 3 | 54 | |
| 102 | CONNECT BY PUMP | | | | |
|*103 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|*104 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*105 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|*106 | FILTER | | | | |
|*107 | CONNECT BY WITH FILTERING | | | | |
|*108 | FILTER | | | | |
| 109 | COUNT | | | | |
|*110 | HASH JOIN | | 1336 | 82832 | 9 |
| 111 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 1336 | 24048 | 2 |
| 112 | TABLE ACCESS FULL | RETAILER | 3188 | 136K| 6 |
| 113 | NESTED LOOPS ANTI | | 1 | 54 | 5 |
| 114 | NESTED LOOPS | | 1 | 47 | 3 |
|*115 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*116 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|*117 | TABLE ACCESS BY INDEX ROWID | RETAILER | 1 | 17 | 1 |
|*118 | INDEX UNIQUE SCAN | XPKRETAILER | 100 | | |
|*119 | VIEW | VW_NSO_3 | 3 | 21 | |
|*120 | CONNECT BY WITH FILTERING | | | | |
| 121 | NESTED LOOPS | | | | |
|*122 | HASH JOIN | | 58 | 2262 | 5 |
| 123 | TABLE ACCESS BY INDEX ROWID| USER_RETAILER_MAP | 19 | 570 | 2 |
|*124 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 125 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 126 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 127 | NESTED LOOPS | | | | |
| 128 | BUFFER SORT | | 3 | 54 | |
| 129 | CONNECT BY PUMP | | | | |
|*130 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|*131 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*132 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
| 133 | HASH JOIN | | | | |
| 134 | CONNECT BY PUMP | | | | |
| 135 | COUNT | | | | |
|*136 | HASH JOIN | | 1336 | 82832 | 9 |
| 137 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 1336 | 24048 | 2 |
| 138 | TABLE ACCESS FULL | RETAILER | 3188 | 136K| 6 |
| 139 | NESTED LOOPS ANTI | | 1 | 54 | 5 |
| 140 | NESTED LOOPS | | 1 | 47 | 3 |
|*141 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*142 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|*143 | TABLE ACCESS BY INDEX ROWID | RETAILER | 1 | 17 | 1 |
|*144 | INDEX UNIQUE SCAN | XPKRETAILER | 100 | | |
|*145 | VIEW | VW_NSO_3 | 3 | 21 | |
|*146 | CONNECT BY WITH FILTERING | | | | |
| 147 | NESTED LOOPS | | | | |
|*148 | HASH JOIN | | 58 | 2262 | 5 |
| 149 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 19 | 570 | 2 |
|*150 | INDEX RANGE SCAN | INDX_USERID_MNGBY | 19 | | 1 |
| 151 | INDEX FAST FULL SCAN | AX_RET_HIER | 1336 | 12024 | 2 |
| 152 | TABLE ACCESS BY USER ROWID | RETAILER_HIERARCHY | | | |
| 153 | NESTED LOOPS | | | | |
| 154 | BUFFER SORT | | 3 | 54 | |
| 155 | CONNECT BY PUMP | | | | |
|*156 | INDEX FAST FULL SCAN | XPKRETAILER_HIERARCHY | 3 | 54 | 2 |
|*157 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*158 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
|*159 | TABLE ACCESS BY INDEX ROWID | USER_RETAILER_MAP | 1 | 30 | 2 |
|*160 | INDEX UNIQUE SCAN | XPKGSS_USER_RETAILER_MAP | 45770 | | 1 |
Predicate Information (identified by operation id):
1 - filter("from$_subquery$_001"."PARENT_RETAILER_ID" IS NULL)
2 - filter("from$_subquery$_001"."PARENT_RETAILER_ID" IS NULL)
7 - access("A"."RETAILER_ID"="VW_NSO_1"."$nso_col_1")
8 - access("B"."RETAILER_ID"="A"."RETAILER_ID")
10 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
11 - filter("B"."STATUS"='ACTIVE')
13 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A" WHERE "A"."USER_ID"='ALEX.CAYLES
S@GMACIO' AND "A"."RETAILER_ID"=:B1 AND "A"."MANAGED_BY"='Y'))
15 - access("RETAILER_HIERARCHY"."PARENT_RETAILER_ID"="A"."RETAILER_ID")
17 - access("A"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "A"."MANAGED_BY"='Y')
23 - filter("SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL)
24 - filter("A"."MANAGED_BY"='Y')
25 - access("A"."RETAILER_ID"=:B1 AND "A"."USER_ID"='ALEX.CAYLESS@GMACIO')
26 - filter(UPPER("SYS_ALIAS_1"."STATUS")='ACTIVE' AND EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILE
R_MAP" "C" WHERE "C"."USER_ID"='ALEX.CAYLESS@GMACIO' AND "C"."RETAILER_ID"=:B1 AND "C"
."MANAGED_BY"='Y'))
27 - filter( EXISTS (SELECT /*+ */ 0 FROM "USER_RETAILER_MAP" "A","RETAILER" "B", (SELECT /*+ */ "
SYS_ALIAS_1"."RETAILER_ID" "$nso_col_1" FROM "RETAILER_HIERARCHY" "SYS_ALIAS_1" WHERE
"SYS_ALIAS_1"."PARENT_RETAILER_ID"=NULL) "VW_NSO_3" WHERE "A"."RETAILER_ID"="VW_NSO_3"
."$nso_col_1" AND "B"."RETAILER_ID"="A"."RETAILER_ID" AND UPPER("B"."STATUS")='ACTIVE' -
Need Suggestions on the below posted message(SID)
Hi all,
There is an InfoObject ZPRINTDOCC, it never had navigational attributes. but this was a daily load and had millions of records. Now as per the requirement we had to add 2 attributes to this InfoObject and use it as Navigational Attributes. so we had included them in the development and tranported this to production. As this ZPRINTDOCC never had X and Y Tables, this transports took days to get transported as to create SID's and etc for this million's of records. So we finally cancelled this transport
Today we have another requirement, we have to add the 4 fields to an existing InfoObject ZCTRACCC(Contract Account), this already has an X and Y tables, and lot of Navigational Attributes, so in this case if we add 4 new fields to ZCTRACCC and use them as time dependent/ Navigational Attributes, will this transport from dev to prod also take days to create SID's ???
Currently the number of records present in this ZCTRACCC is 200,000.
Please give me ur comments.
Thanks,
SowrabhHi Aduri,
Thanks for you reply,
For ZPRINTDOCC infoobject we dint have X/Y Tables, but for ZCTRACCC infobject we have existing X/Y Tables. And also for ZCTRACCC we have many existing Navigational Attributes, So adding 5 more attributes for this ZCTRACCC InfoObject, which have to be used as Time Dependent Navigational Attributes, will it take more time SID creation in this scenario ???
Can you please tel me what is PRS ??? TR means Tranport Request i suppose???
Am i rite...
Thanks in Advance,
Sowrabh -
Need Help with the below query
Hi All,
I'm working on Oracle HRMS tables which have date tracking facility.
I'm working on Oracle 10G.
I have a table per_all_assignments_f(seeded) which contains the employee related information.
It has normal hours and the assignment_id(primary key) in the table
The data is something like
assignment_id
123 30 01-Jan-2000 31-dec-2009
123 32 01-Jan-2010 31-dec-2012
123
assignment_id
Normal_hours
Effective_start_Date
Effective_end_Date
123
30
01-Jan-2000
31-dec-2009
123
32
01-Jan-2010
31-dec-2012
123
40
01-Jan-20103
40 01-jan-2013 31-dec-4712
Now I'd like to pass the latest date(sysdate) to a function which should give me the
last changed normal hours as on today. In this case 32.
select normal_hours from per_all_assignments_f where
assignment_id=123
and trunc(latest_date) between effective_start_date and effective_end_date
This will give me the latest normal hours of 40 but I want the last changed hours irrespective of how many ever be the changes.
hope I'm clear in specifying my requirement.
Appreciate your time
Thanks,
AJ877722 wrote:
It has normal hours and the assignment_id(primary key) in the table
How PK value is repeating in your sample data!
877722 wrote:
This will give me the latest normal hours of 40 but I want the last changed hours irrespective of how many ever be the changes.
hope I'm clear in specifying my requirement.
Nope. What is "changed hours"? Not able to break your source code! a tough one, I say.
By the way, follow the link shared by Karthick and will be easy to answer for anyone.
Thanks! -
Need explanation about the abstractportal mode
Hai all
can any one explain me why we are using different modes in abstractportal component,what is the purpose ,can u explain with examples?
default CONTENT
when a user is not authenticated LOGON
Hide a portal component. HIDEMODE
Display the error returned by a component. ERROR
Start the component in a test mode. TEST
Preview of the component. PREVIEW
Help text of the component. Development model to provide
help files in the par file.
HELP
Edit and save the profile of a component. EDIT
A short text explaining the purpose of the component. ABOUT
Description ModeHi Balaji.
an iView can display (or even not display anything at all - if it hides itself, that's the HIDEMODE) different things or in different states. If it should not be displayed at all, see above. The "normal" content is displayed within the CONTENT mode. If you want to edit the profile of the component (i.e. personalize the iView), this is done within the EDIT mode. If an iView is previewed from within the PCD, this is done within the PREVIEW mode (you may differentiate this mode from the CONTENT mode, as maybe you don't want some things to happen if the iView is previewed without it's page context etc).
Also check out the APIDoc: https://media.sdn.sap.com/javadocs/NW04/SPS15/ep/com/sapportals/portal/prt/pom/NodeMode.html
... as well as some examples, here how the to hide an iView: http://help.sap.com/saphelp_nw2004s/helpdata/en/b7/60b54066ea8531e10000000a1550b0/frameset.htm or how to check the called mode in a test scenario: http://help.sap.com/saphelp_nw2004s/helpdata/en/4d/a7b7424ddcda11e10000000a155106/frameset.htm
Hope it helps
Detlev -
Need to fetch the last record/row from a table
Hi,
I have a requirement like fetching the closing balance of the last record of the table and inserting the same into the opening balance of the immediatetly created next record.
In simple words, I need to fetch a value from the last row of the record.
For example, I use the below query,
select rownum, empno, ename from emp
where rownum = (select count(rownum) from emp);
But, the above query does not return any of the record.
Hence, need help on this.
Regards,
Shivakumar A
Edited by: shiva on Mar 27, 2011 10:14 PMRows in a table are inherently unordered. In order to introduce the concept of "first" and "last", you would need to specify how to order the rows which would require that there was one or more columns in the table that you could order by in order to determine the "last" record.
In your closing balance example, if we assume that there is something like a BALANCE_DATE column,
SELECT account_number, balance_amount, balance_date
FROM (
SELECT account_number,
balance_amount,
balance_date,
rank() over (partition by account_number order by balance_date desc) rnk
FROM table_of_balances )
WHERE rnk = 1Justin -
How to achieve the below output
Hi All,
I have a source table, and i need to generate the below output using Data Services.
Source Table:
Legacy_number
Legacy_name
Address
z_inscope
z_sold_to
z_ship_to
z_invoice_to
123
sam
123 main st
Y
y
N
N
345
PAUL
234 oxford st
y
y
N
N
345
PAUL
234 oxford st
y
n
n
y
456
alex
34 e ave
y
y
n
n
456
alex
34 e ave
y
n
y
n
456
alex
34 e ave
y
n
n
y
Output Table:
Legacy_number
Legacy_name
Address
z_inscope
z_sold_to
z_ship_to
z_invoice_to
123
sam
123 main st
Y
y
N
N
345
PAUL
234 oxford st
y
y
N
y
456
alex
34 e ave
y
y
y
y
We nee to generate a table which need to have only single Legacy_number in output table and z_inscope, z_sold_to, z_ship_to,z_invoice_to have to check their values in source table and replaced their columns with the following priority order Y,y,N,n in Output table.
for explanation see below example.
1. for 345 Legacy number we have y & n for z_sold_to column. In output table that column need to be replaced with y as y priority is higher than n.
2. for 456 Legacy number we have n & y & n for z_ship_to column. In output table that column need to be replaced with y as y priority is higher than n.
Thanks in advance.Hello
This is possible using lots of various techniques. You allude to a technique in your question - priority.
For each z column (I hate adding a z - is this from ECC?!), add a new column via a query and assign a priority to each value. In a second query get the max priority for each column for the key (this will return only 1 row per key), then convert the priority back to the actual value.
Michael -
How we can handle the below doubt in Java Script!!
Hi All,
I need to handle the below scenerio in javascript, i am very poor in scripting langauage could any help me out.
Below are the three where we have specail character
words as
1. transfer (…)
2. Shell’s
3. Vitol – as
The above 3 are having some specail characters which we need to
replace as mentioned below
need to use a Function/Method in some scripting language like Java
script to replace the special character with a predefined sequence eg:
single quote with “a1b1” before inserting the data in to the data base
and then while retrieving the record from the database replace “a1b1”
with single quote.
Note#:It is a text area where user can either enter or copy and paste
the content.
Thanks,
Anoo..Hi Anoo,
always remember to put your apex and database versions, it makes it easier to help.
You mentioned stripping out special characters and then putting them back for display. Is there a particular reason why?
If you're having difficulty querying the 'special' characters from SQL, you can create a view to handle that complexity.
The examples you gave don't contain any characters you can't query on. Maybe I'm missing something.
Kofi
Maybe you are looking for
-
Why Aperture doesn't send the RAW file to Photoshop
I've seen the complaint about Aperture not passing the original RAW file to Photoshop in several places in this forum. I think I have a reason for why Aperture doesn't work this way. The reason has to do with the 1st law of digital RAW photography. "
-
InDesign 7.0.4 OS X 10.6.8 Crashing on Auto Linking when Opening
Folks, I am having some trouble with many machines running Adobe InDesign CS5 7.0.4 (installed as part of Adobe CS5 Design Standard and Adobe CS5 Design Premium) across multiple machines. When opening InDesign CS5 by double clicking a .indd file I am
-
What adobe version do i need to watch tv / movies on my kindle hd
what adobe software do i need on my kindle hd to watch tv and movies
-
This computer is not authorized to play "insertnamehere.m4v"
I purchased an HD show last night through the iTunes store last night. I've been trying to play it this morning, but when I do, I get the error message above advising me that the computer isn't authorized. The only problem is that I have authorized.
-
How to create SDA file for using AXIS Framework in the SOAP Adapter
Hi experts, I have the following question: How I can create the SDA file aii_af_axisprovider.sda for using the AXIS Framework in the SOAP Adpater described in http://help.sap.com/saphelp_nw04/helpdata/en/45/a4f8bbdfdc0d36e10000000a114a6b/content.htm