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.
Similar Messages
-
Hi,
Ii need to merge the below 2 queries.could you please help some one.
primary foreign key relation of major_id column
major.major_id primary key.
major_inactive_list.major_id referential integrity
SELECT m.major_inactive_id, m.institution_id, m.major_id, m.created_on,
m.modified_on, m.created_by, m.modified_by, m.active_status
FROM major_inactive_list m
WHERE m.institution_id IN (1, 5)
ORDER BY m.institution_id
SELECT M.major_id ,
M.major_name ,
M.major_code ,
M.major_comment,
M.delete_status,
M.active_status,
M.institution_id,
M.default_major
FROM major M
WHERE (M.institution_id IN (1, 5, 6))
AND M.delete_status = '0'
AND M.active_status = '1'
AND (M.major_id NOT IN (768002, 767978))
OR M.institution_id = 6
AND M.active_status = '0'
AND M.delete_status = '0'
ORDER BY M.institution_id DESC, UPPER (M.major_name)need to re write as a single query instead of 2 queries.There should be some logic behind making it as a single query. I was looking for you to explain that. If you ask me to make it a single query without giving any details i would do this.
with t1
as
SELECT m.major_inactive_id, m.institution_id, m.major_id, m.created_on,
m.modified_on, m.created_by, m.modified_by, m.active_status
FROM major_inactive_list m
WHERE m.institution_id IN (1, 5)
t2 as
SELECT M.major_id ,
M.major_name ,
M.major_code ,
M.major_comment,
M.delete_status,
M.active_status,
M.institution_id,
M.default_major
FROM major M
WHERE M.institution_id IN (1, 5, 6)
AND M.delete_status = '0'
AND M.active_status = '1'
AND M.major_id NOT IN (768002, 767978)
OR M.institution_id = 6
AND M.active_status = '0'
AND M.delete_status = '0'
select t1.*, t2.*
from t1, t2
where t1.major_id = t2.major_id -
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. -
GridControl show the last two rows in blank
I'm using JDeveloper 3.2.2 with jdk 1.3 developing a swing
application.
I have a form with a gridControl binded to one view of my bc4j
application module.
When the number of records from the view excedes the maximum
number of rows visibles in the area of the gridControl the last
two rows of the gridControl are showed blank.
There is no problem when I scroll through the grid control.
This problem doesn't appear using JDK 1.2.2, provided with
Jdeveloper, but I would like to use 1.3.1.
Thanks in advance
Alex.You don't need to do Sum for this, you should use Sum for all rows purpose only..
$.rawValue = subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[0]. SUBTOTAL + subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[1].SUBT OTAL -
When using private browsing to view image results in Safari 5.1.3, only the first two rows of results are visible, the following four or so rows display greyed out place holders, the remainder of the results page is blank, and the safe search button is inoperable. When I turn off private browsing and refresh the page, everything works again.
Anyone else having this problem?I have got the same behaviour after the last Safari Update to 5.1.3. It seems that Safari now handles some scripts in a new way. If you debug the Google Website, you will see, that there is some Javascript Error, that seems to prevent to write into local cache. After some searching I wasn't able to finde a solution for this problem, other then disabling Javascript while private browsing to prevent the script loading. You then are able to use Google with the old layout. The option to disable JavaScript can be found in the Menu "Developer", wich has to be enabled in Safari in the options first.
In my opinion this is a bug that is now occuring, because Apple changed something in private browsing and that has to be fixed by Google now, to run again. Or we will have to wait for 5.1.4, as you can read online Apple will change and bugfix the javascript engine in that version, perhaps this fixes the problem as well. I hope so!
If anyone is in the developer program perhaps you could test this with the beta of 5.1.4 and tell us if it works. -
I have a MBP 15" with Iphoto 9. When I right click on icon in dock 3 iPhoto libraries come up; one empty, one with 35,000 photos and one with 30,000 photos. How can I delete the empty library and merge the other two without getting duplicates?
You can delete the empty one by dragging it to the trash ( test everything before emptying the trash)
Merging libraries requires iPhoto Library Manager - http://www.fatcatsoftware.com/iplm/ - it is the only current solution to merging libraries
LN -
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?
-
How can I calculate the sum of the first two rows in a table?
I have a table with a repeating row that, when data is merged, always has three rows:
Support type 1
1,234,456
Support type 2
221,556
Interest
11.222
I have a field where I want to show the sum of Support types 1 and 2.
I do not want to add the interest to this.
I'm using FormCalc with the following script on the calculate event of the Total field, which is in the same subform but not in the table:
data.JP_Page1.subform_Hidden.sub_SupportTotals.NumericField1::calculate - (FormCalc, client)
$.rawValue = Sum(subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[0].SUBTOTAL, subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[1].SUBTOTAL)
I've tried this using both decimal and numeric field types, neither work.
I feel like I must be hitting a syntax issue, but the code checker isn't exposing it.
Can anyone help me figure out what is wrong with my script?
Thanks!
JanetYou don't need to do Sum for this, you should use Sum for all rows purpose only..
$.rawValue = subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[0]. SUBTOTAL + subform_Hidden.sub_SupportTotals.tbl_SupportSubtotals.DataRow[1].SUBT OTAL -
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 -
Help needed to merge values from two tables -
We have these three test tables shown, which have a common ID; And amount fields; I want the -------
test1.val = test2.val + test3.val
when they have common ids in them;
I have shown the test data below: And the expected output;
NOTE: In database with real table values - each of them have millions of rows in them. So effeciency is very important here;
SQL> desc test1;
Name Null? Type
ID NUMBER
VAL NUMBER
SQL> desc test2;
Name Null? Type
ID NUMBER
VAL NUMBER
SQL> desc test3;
Name Null? Type
ID NUMBER
VAL NUMBER
SQL> select * from test1;
ID VAL
1 50
2 50
3 55
4 60
5 20
5 rows selected.
SQL> select * from test2;
ID VAL
1 25
1 25
2 5
2 5
4 75
5 rows selected.
SQL> select * from test3;
ID VAL
1 25
1 25
2 5
2 25
2 25
5 10
6 rows selected.
I EXPECT the output to be:
SQL> select * from test1;
ID VAL
1 100
2 65
3 20
4 75
3 20
5 10
6 rows selected.Need help with the update queries - joining three tables -
-
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 valueManoj0408 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". -
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 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' -
i have 50 contacts on my Macbook air and 350 on my iphone , i need to know how to merge them , iTunes is not syncing the contacts at all even when i choose the option to sync , i tried many ways !! apparently there is only an option to replace whats on the iPhone by the computer's contact but not the opposite . please help ...
With the iPhone connected have you checked Address Book as the app to sync to on the Info tab? If you have then go to the iSync app Preferences, and click Reset Sync History.
Maybe you are looking for
-
Hello ! When I extended the UIXPageBroker with MyPageBroker in order to read a configuration from the uix-config.xml (necessary for activating PPR) and replacing it inside web.xml, I observed that you cannot preview any uiXML page... Please give me a
-
SCH-LC11, new windows 8 laptop boots all other devices off
We just purchased a new Windows 8 MSI laptop. We cannot get any other device to connect when it is using our SCH-LC11. So,we can have a Windows 7 Dell laptop, our Dell Streak and our 2 Droid phones connected, but when we connect with this new laptop,
-
Get additional local skype to go number
Hi, I'm one of the users with an old account and one central skype-to-go number with voice menue (a much better system, but that's not the issue now). I used to be able to get an additional local number to use on holidays for example. Just last Decem
-
Try to open multipul photos in Camera raw
When I try to open multipul raw photos from cs6 mini bridge, after selecting them, none open up. If I do one it works fine. I also tried the review mode and only one opens...
-
Hi, Why FileNotFound is checked exception while NullPointer is unchecked exception? Whether file is present or not is going to be known at run time so is the case with NullPointer as run time you will come to know ur object is null. What is that File