UNION ALL: converting all columns to_char
I have a union all statement. I want to convert all the fields to character using to_char. Is there any quick way to do this or do i have to put to_char before each field?
Say you have three queries: one on Tab1, Tab2 and Tab3.
To order them in that way in your queryresult, you could do something like this:
select x.col1, x.col2, ...
from (select 1 OB_COLUMN, t.col1, t.col2, ...
from Tab1 t
union all
select 2, t.col1, t.col2, ...
from Tab2 t
union all
select 3, t.col1, t.col2, ...
from Tab3 t
order by ob_column) x
/This might even be better...
select x.col1, x.col2, ...
from (select 1 OB_COLUMN, t.col1, t.col2, ...
from Tab1 t
union all
select 2, t.col1, t.col2, ...
from Tab2 t
union all
select 3, t.col1, t.col2, ...
from Tab3 t) x
order by x.ob_column
/Edited by: Toon Koppelaars on Oct 10, 2009 10:58 AM
(added other alternative)
Similar Messages
-
Possible to emulate union all at column level?
The UNION ALL function of Oracle SQL is great for joining two matching results sets into one.
However, is it possible to use a similar approach to do this at column level?
EG:
The following query:
<pre>
select
cods.salesman, sum(cods.net_amount) ordval
from
ifsapp.cust_ord_back_stat cods
where
to_char(cods.statistic_date,'YYYYMMDD') = '20060314'
group by cods.salesman
</pre>
will produce details like:
<pre>
salesman ordval
ARNOTT 100
JONES 15
SMITH 300
</pre>
Showing the balance of orders for each on the 14 March 2006.
Then take the following:
<pre>
select
cods.salesman, sum(cods.net_amount) ordval
from
ifsapp.cust_ord_back_stat cods
where
to_char(cods.statistic_date,'YYYYMMDD') = '20060315'
group by cods.salesman
</pre>
will produce details like:
<pre>
salesman ordval
ARNOTT 120
JONES 5
THOMAS 10
</pre>
Showing the balance of orders for each on the 15 March 2006.
What I want to show is:
<pre>
salesman ordval1 ordval2 diff
ARNOTT 100 120 20
JONES 15 5 10-
SMITH 300 0 300-
THOMAS 0 10 10
</pre>
It seems quite complicated when I think of subqueries etc
ThanksApologies on formatting error. Resolved in some respects!
The UNION ALL function of Oracle SQL is great for joining two matching results sets into one.
However, is it possible to use a similar approach to do this at column level?
EG:
The following query:
select
cods.salesman, sum(cods.net_amount) ordval
from
ifsapp.cust_ord_back_stat cods
where
to_char(cods.statistic_date,'YYYYMMDD') = '20060314'
group by cods.salesmanwill produce details like:
salesman ordval
ARNOTT 100
JONES 15
SMITH 300Showing the balance of orders for each on the 14 March 2006.
Then take the following:
select
cods.salesman, sum(cods.net_amount) ordval
from
ifsapp.cust_ord_back_stat cods
where
to_char(cods.statistic_date,'YYYYMMDD') = '20060315'
group by cods.salesmanwill produce details like:
salesman ordval
ARNOTT 120
JONES 5
THOMAS 10Showing the balance of orders for each on the 15 March 2006.
What I want to show is:
salesman ordval1 ordval2 diff
ARNOTT 100 120 20
JONES 15 5 10-
SMITH 300 0 300-
THOMAS 0 10 10It seems quite complicated when I think of subqueries etc
Thanks -
OAF Export button fetching data in one column - view object using union all
Dear All,
Export button showing data in one column from view object,
View object is based on mulitple queries with union all ,
Please let me know the solution for this issue.
Thanks
Maheswara RajuMaheswara Raju,
As per my understanding you are not able to export all the View Attribute using export Button. Only the attribute which is used with the item/region will get exported.
There are few work around in case if you want to export the column without showing on OAF Page. Let me know.
Cheers
Gyan -
How can I join/Full outer join two different columns instead of union all?
Hi,
I have a scenario as the following:
I am performing set operations using obiee 11g where I want to take values from two different criteria. Howwver, I dont want union to take place, instead i want join to take place to see all the columns in the output.
For that, I tried changing the sql in advanced tab and tried to put full outer join instead of union all but its not allowing me to change.
How can I achieve it? please help.
Thanks.Hi,
My problem is that I am unable to modify the sql in advanced tab. Probably due to some security reason,it's restricting me to change.
Can you suggest me a way to change it?
Thanks.. -
Forms won't do order by after the formula columns or constants in union all
i have a big select as :
select * from
( select .....,id doc_id, '1' op from .....
union all
select ......., id doc_id, '2' op from .....
union all
select ......., id doc_id, '3' op from .....
) order by id, op
where i can have the same id for a number x >1 rows with diffrent values for op.
lets say 5 rows with values id plus 1,2,1,2,3 for op.
In a program unit i have a cursor with this select and i fetch every row and write them in a text file type .csv.
The problems are :
1) it won't do the order by after op ,
i say order by id, op but the result is only ordered after id
... id op
... 1 2
... 1 1
.... 1 2
2)
if i modify the select like this :
select ...., id, op from ---i put the aliases here instead of *
( select .....,id doc_id, '1' op from .....
union all
select ......., id doc_id, '2' op from .....
union all
select ......., id doc_id, '3' op from .....
) order by id, op
in the csv the column op in empty , so i only get the id information
... id op
... 1
... 1
.... 2
Any idea ?
Oh and my screen goes white , the form block sometimes when i have a "difficult "
select but after a while i get the result i wanted (message or csv file)select * from
( select .....,id doc_id, '1' op from .....
union all
select ......., id doc_id, '2' op from .....
union all
select ......., id doc_id, '3' op from .....
) order by id, op
The problems are :
1) it won't do the order by after op ,
i say order by id, op but the result is only ordered after id
select * from
( select .....,id doc_id, '1' op from .....
union all
select ......., id doc_id, '2' op from .....
union all
select ......., id doc_id, '3' op from .....
) order by 3,4
if[u] id is 3 column positions, and '1' op is 4 column positions in UNION-SELECT
Hope this helps -
SQL 2008 union all numeric column
Hi guys, I'm struggling with an union all. I tried to union a column float with a null column:
SELECT column 1,
column 2,
'' AS 'column 3'
FROM table a
UNION
SELECT column 1,
column 2,
column 3 FROM
table b
If column 3 is varchar everything ok, if ( as in my case) is numeric I got an error. Any sugegstion guys? Thanks as alwayseven the below would work, but your solution looks better as column3 is a numeric column...
SELECT column 1, column 2, '' AS 'column
3' FROM table a
UNION
SELECT column 1, column 2, Cast(column3
as varchar(100)) FROM table b -
Union All is not bring the second part columns to the report
I have 5 groups of series of Select statements and then I made a UNION ALL after the first group. Now it does run correctly and displays the output but it does not assign the second group' s field names.
For example. I am greatly abridging
Completed the SQL's needed to mimic a IBM i display screen. There are 5 product groups making up the screen. I was hoping to have one large Command SQL having the 5 SQLs using UNION ALL. This does 'compile' as a Command. However, it does only brings in the first part fields not the second. So this field is not included in the list of fields tree for COMMAND. PROGR2R2PST,
Is there something not correct how doing the UNION ALL? OUTPUT assigns the column name
of the first group to the second group. HLDGR1PUN 21454 87273
so if i wanted to have one large SQL with union ALLs, it wont work. is there something other than UNION ALL I should use? One idea is if I can have 5 commands to my disposal. I guess using subreports you can but it will be too slow.
SELECT
count(*) as PROGR1PST,
SELECT COALESCE(SUM(OdQty#),0)
FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTDTA.OEORD1
WHERE OHCOM# = TSCOM# AND OHORD# = TSORD# AND OHCOM# = ODCOM# AND OHORD# = ODORD#
AND TSSTAT IN('AEP','BGE')
AND OHORDT IN('RTR','INT','SAM')
AND OHREQD < replace(char(current date, iso), '-', '')
AND OHHLDC = ' '
AND ODPRLC = 'ENG'
AND substr(odprt#,1,5) <> 'NOENG' AND OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2 a
WHERE a.tsstat IN('AEP','BGE','EAS','REL','STP'))
) AS PROGR1PUN,
SELECT count(*)
FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTCCDTA.OETRA99
WHERE OHCOM# = TSCOM# AND OHORD# = TSORD#
AND (otCOM# = OHCOM# AND OTORD#= OHORD# AND ottrnc = 'AQC')
AND TSSTAT IN('AEP','BGE')
AND OHORDT IN('RTR','INT','SAM')
AND OHREQD = replace(char(current date, iso), '-', '') AND OHHLDC = ' ' AND OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2 a
WHERE a.tsstat IN('AEP','BGE','EAS','REL','STP'))
) AS PROGR1TOD,
etc..
UNION ALL
SELECT
count(*) as PROGR2R2PST,
(SELECT COALESCE(SUM(OdQty#),0) FROM ASTCCDTA.OEORH48,ASTCCDTA.TRNSTAT2,ASTDTA.OEORD1
WHERE OHCOM# = TSCOM# AND OHORD# = TSORD# AND OHCOM# = ODCOM# AND OHORD# = ODORD#
AND TSSTAT IN('AEP','BGE')
AND OHORDT IN('CUS','CIN','SMC','COC','DON')
AND OHREQD < replace(char(current date, iso), '-', '')
AND OHHLDC = ' '
AND ODPRLC = 'ENG'
AND substr(odprt#,1,5) <> 'NOENG' AND OHORD# in(SELECT a.TSORD# FROM ASTCCDTA.TRNSTAT2 a
WHERE a.tsstat IN('AEP','BGE','EAS','REL','STP'))
) AS PROGR2PUN,hi Paul,
a union combines record sets like this
field1 field2
1 2
union
field3 field4
2 8
will produce
field1 field2
1 2
2 8
note that there are no more field3 & field4 names. that's the way a union works.
if you need separate fields for your other values then you would need to use sub-queries instead. to do that delete "UNION ALL " and create sub-queries with anything that is beneath that statement. -
Union all not showing all columns of 2 Excel files
Hi
File Excel1.xls has 2 columns: first name and last name.
File Excel2.xls has 3 columns: first name, last name and middle name.
Why does "Union all" show only first and last names? I thought that it shows also the middle name. I see it by double clicking box
Union all. In box Union All Transformation Editor
I expect such a line:
Output column name: middle name
Union All Input 1: <#ignore>
Union All Input 2: middle name
Thanks!
gecHi,
I think you need to select <ignore> in union all input1 and select middlename in unionall input 2 and Type Middlename in Output Coulmn Name.
As Shown Below.
Hope this answer your question.
If it does mark this as answer please.
Regards
Kaushal -
hi Following is my query and am unable to accomplish my order by statement in Union All . please help me in this.
<code>
SELECT b.audit_trail_id,
TO_CHAR (b.last_update_date, 'DD-Mon-YYYY') "Revision Date",
(u.last_name || ', ' || u.first_name || ' ' || u.mi) "By",
b.col_name "Field",
b.new_value "New Value",b.previous_value "Old Value",
a.lot_id,
b.comment_text "Comments"
FROM clem_audit_trail b,lot a, users u
WHERE a.lot_id = b.lot_id(+)
AND u.user_id(+) = b.last_update_user_id
AND a.lot_id in (select lot_id from request_lot where request_id = 51914)
AND col_name IN
('Interim Release Date',
'Final Disposition Date',
'On Time Disposition',
'Intended Use',
'REJECTS_YN',
'# of QARs',
'# of Quality Events',
'# of LIRs',
'# of Change Controls',
'# of Batch Records',
'# of GMP Batch Records',
'EXPLANATION',
'QA Notes',
'GDMS_LINK')
AND UPPER (table_name) IN('LOT') order by b.last_update_date
UNION ALL
SELECT b.audit_trail_id,
TO_CHAR (b.last_update_date, 'DD-Mon-YYYY') "Revision Date",
(u.last_name || ', ' || u.first_name || ' ' || u.mi) "By",
b.col_name "Field",
b.new_value "New Value",b.previous_value "Old Value",
r.request_id,
b.comment_text "Comments"
FROM clem b,request r, users u
WHERE r.request_id = b.request_id(+)
AND u.user_id(+) = b.last_update_user_id
AND r.request_id = 51914
AND UPPER (table_name) IN ('REQUEST') AND
b.col_name IN ('Partial Release',
'All QP Docs in GDMS',
'Number of Batch Records',
'Request',
'QP Issues',
'Snag Comments',
'Responsible Group',
'Reason Late',
'Study Impact',
'Other Details',
'Request Status',
'QP Link to GDMS'
) order by b.last_update_date
</code>
If i execute individually it works fine, if i use union all it throughs error for me.
Any suggestion...Hi,
In a set operation (such as UNION) table aliases (such as b.) only have meaning within the branch in which they are defined. The ORDER BY clause is not part of any 1 branch, so a table alias can't be used there.
In most cases, you can use a column name (or alias) from the first branch, like this:
SELECT b.audit_trail_id,
TO_CHAR (b.last_update_date, 'DD-Mon-YYYY') "Revision Date",
order by "Revision Date"
;and you can always order by column number, like this:
SELECT b.audit_trail_id,
TO_CHAR (b.last_update_date, 'DD-Mon-YYYY') "Revision Date",
order by 2
;In this case, however, there's an extra problem. You're transforming the DATE to a string in the SELECT clause. The string is all that's available in the ORDER BY clause, and the string '19-NOV-2012' comes after the string '01-JAN-2015', because the character '1' comes after '0'. Perhaps the simplest solution is to have your front end, and not the query, format the dates. In SQL*Plus, you can do this:
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY';
SELECT b.audit_trail_id,
b.last_update_date AS "Revision Date",
order by 2
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
UNION ALL slow (cost goes from 75 and 173 to 450,789!)
Hi,
I have two Selects (lots of joins - big tables)
Select A) has an explain plan cost of 75
Select B) has an explain plan cost of 173
If I union (or union all) the cost goes up to 450,789!
I can paste in the queries, plans etc - but if anyone has any quick ideas that'd be great.
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
What I'd like is to force the optomiser to run each query sequentially - but not really sure how.
Any help would be really appreciated - I have few hairs left and am just about to tear the last one out!
Cheers,
PatrickAttached are the queries and the explain plan.
I have simply tried UNION and UNION ALL to see if there's a difference (expecting UNION ALL to be faster).. but (distinct) UNION Is what I want.
Queries
explain plan for
(SELECT ety_entity_identifier "a" ,
ety_current_name "b" ,
gment.ety_discriminant "c" ,
upper(ind_first_name)
|| ' '
|| upper(ind_last_name) "d" ,
CASE
WHEN ind_last_name = NULL
then null
END e
FROM gv_emr_entity_master m
INNER JOIN gv_ety_entities gv_ety
ON gv_ety.ety_entity_identifier = m.mtr_identifier
AND gv_ety.ety_ety_version = m.mtr_current_version
AND gv_ety.ety_reg_code = m.mtr_reg_code
INNER JOIN gm_ety_entities gment
ON gment.ety_id = gv_ety.ety_id
INNER JOIN gv_erl_entity_roles gve
ON m.mtr_identifier = gve.erl_entity_identifier
AND m.mtr_current_version = gve.erl_ety_version
INNER JOIN gm_erl_entity_roles gme
ON gve.erl_id = gme.erl_id
INNER JOIN gv_imr_individual_master gvm
ON gme.erl_ind_individual_identifier = gvm.mtr_identifier
AND gme.erl_ind_version = gvm.mtr_current_version
INNER JOIN gv_ind_individuals gvi
ON gvm.mtr_identifier = gvi.ind_individual_identifier
AND gvm.mtr_current_version = gvi.ind_ind_version
INNER JOIN gm_ind_individuals gmn
ON gvi.ind_id = gmn.ind_id
INNER JOIN gv_ias_individual_addresses gvad
ON gvi.ind_reg_code = gvad.ias_reg_code
AND gvi.ind_individual_identifier = gvad.ias_individual_identifier
AND gvi.ind_ind_version = gvad.ias_ind_version
INNER JOIN gm_rfr_repository_folder gmrfr
ON gmrfr.rfr_entity_identifier = gv_ety.ety_entity_identifier
INNER JOIN gm_rdt_repository_documents gmrdt
ON gmrdt.rdt_rfr_id = gmrfr.rfr_id
INNER JOIN rdi_repository_documents_info rdire
ON rdire.rdi_rdt_id = gmrdt.rdt_id
WHERE
gmrdt.rdt_dte_code IN ('OPD','PD')
AND TO_CHAR(rdire.rdi_submission_date, 'YYYY-MM-DD') >= TO_CHAR('2007-11-01')
and to_char(rdire.rdi_submission_date, 'YYYY-MM-DD') <= to_char('2009-01-05')
and rownum > 0
and rownum < 10
union all
SELECT ety_entity_identifier a ,
ety_current_name "b" ,
gment.ety_discriminant "c" ,
gment.ety_current_name "d" ,
gment.ety_entity_identifier "e"
FROM gv_emr_entity_master m
INNER JOIN gv_ety_entities gv_ety
ON gv_ety.ety_entity_identifier = m.mtr_identifier
AND gv_ety.ety_ety_version = m.mtr_current_version
AND gv_ety.ety_reg_code = m.mtr_reg_code
INNER JOIN gm_ety_entities gment
ON gment.ety_id = gv_ety.ety_id
INNER JOIN gv_erl_entity_roles gve
ON m.mtr_identifier = gve.erl_entity_identifier
AND m.mtr_current_version = gve.erl_ety_version
INNER JOIN gm_erl_entity_roles gm_erl
ON gve.erl_id = gm_erl.erl_id
INNER JOIN gv_ety_entities gv_ety_temp
ON gm_erl.erl_entity_identifier_assoc = gv_ety_temp.ety_entity_identifier
INNER JOIN gv_emr_entity_master gv_emr_master
ON gv_ety_temp.ety_entity_identifier = gv_emr_master.mtr_identifier
AND gv_ety_temp.ety_ety_version = gv_emr_master.mtr_current_version
INNER JOIN gm_ety_entities gm_ety_temp
ON gm_ety_temp.ety_id = gv_ety_temp.ety_id
INNER JOIN gv_eas_entity_addresses gva
ON gv_ety_temp.ety_reg_code = gva.eas_reg_code
AND gv_ety_temp.ety_entity_identifier = gva.eas_entity_identifier
AND gv_ety_temp.ety_ety_version = gva.eas_ety_version
INNER JOIN gm_rfr_repository_folder gmrfr
ON gmrfr.rfr_entity_identifier = gv_ety.ety_entity_identifier
INNER JOIN gm_rdt_repository_documents gmrdt
ON gmrdt.rdt_rfr_id = gmrfr.rfr_id
INNER JOIN rdi_repository_documents_info rdire
on rdire.rdi_rdt_id = gmrdt.rdt_id
WHERE
gmrdt.rdt_dte_code IN ('OPD','PD')
AND gm_erl.erl_rre_name = 'SHR'
AND TO_CHAR(rdire.rdi_submission_date, 'YYYY-MM-DD') >= TO_CHAR('2007-11-01')
and to_char(rdire.rdi_submission_date, 'YYYY-MM-DD') <= to_char('2009-01-05')
and rownum > 0
and rownum < 10
Plan hash value: 91542951
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 18 | 4905 | | 450K (46)| 01:30:10 |
| 1 | UNION-ALL | | | | | | |
|* 2 | COUNT STOPKEY | | | | | | |
|* 3 | FILTER | | | | | | |
|* 4 | HASH JOIN | | 173K| 47M| 38M| 249K (1)| 00:49:54 |
|* 5 | HASH JOIN | | 151K| 36M| 36M| 231K (1)| 00:46:24 |
|* 6 | HASH JOIN | | 151K| 34M| 30M| 203K (1)| 00:40:43 |
|* 7 | HASH JOIN | | 151K| 28M| 27M| 182K (1)| 00:36:35 |
|* 8 | HASH JOIN | | 151K| 25M| 23M| 170K (1)| 00:34:06 |
|* 9 | HASH JOIN | | 151K| 21M| 4840K| 140K (1)| 00:28:05 |
|* 10 | HASH JOIN | | 34132 | 4433K| 3464K| 127K (1)| 00:25:35 |
|* 11 | HASH JOIN | | 34419 | 3058K| 2776K| 120K (1)| 00:24:03 |
|* 12 | HASH JOIN | | 34229 | 2373K| 1912K| 117K (1)| 00:23:35 |
|* 13 | HASH JOIN | | 34229 | 1504K| 1440K| 114K (1)| 00:22:49 |
| 14 | NESTED LOOPS | | 34229 | 1036K| | 99509 (1)| 00:19:55 |
|* 15 | TABLE ACCESS FULL | RDI_REPOSITORY_DOCUMENTS_INFO | 34205 | 467K| | 31522 (2)| 00:06:19 |
|* 16 | TABLE ACCESS BY INDEX ROWID| GM_RDT_REPOSITORY_DOCUMENTS | 1 | 17 | | 2 (0)| 00:00:01 |
|* 17 | INDEX UNIQUE SCAN | SYS_C0082075 | 1 | | | 1 (0)| 00:00:01 |
| 18 | TABLE ACCESS FULL | GM_RFR_REPOSITORY_FOLDER | 2125K| 28M| | 11843 (1)| 00:02:23 |
| 19 | TABLE ACCESS FULL | GV_ETY_ENTITIES | 953K| 23M| | 1958 (1)| 00:00:24 |
| 20 | TABLE ACCESS FULL | GV_EMR_ENTITY_MASTER | 951K| 18M| | 758 (2)| 00:00:10 |
| 21 | TABLE ACCESS FULL | GM_ETY_ENTITIES | 945K| 37M| | 5120 (1)| 00:01:02 |
| 22 | TABLE ACCESS FULL | GV_ERL_ENTITY_ROLES | 4233K| 68M| | 6413 (1)| 00:01:17 |
|* 23 | TABLE ACCESS FULL | GM_ERL_ENTITY_ROLES | 3611K| 92M| | 22218 (1)| 00:04:27 |
| 24 | TABLE ACCESS FULL | GV_IMR_INDIVIDUAL_MASTER | 3994K| 83M| | 4547 (2)| 00:00:55 |
| 25 | TABLE ACCESS FULL | GV_IND_INDIVIDUALS | 3994K| 144M| | 9720 (1)| 00:01:57 |
| 26 | TABLE ACCESS FULL | GM_IND_INDIVIDUALS | 4008K| 68M| | 20842 (1)| 00:04:11 |
| 27 | INDEX FAST FULL SCAN | FKGV_IAS_IND592213_IDX | 4564K| 139M| | 6062 (1)| 00:01:13 |
|* 28 | COUNT STOPKEY | | | | | | |
|* 29 | FILTER | | | | | | |
|* 30 | HASH JOIN | | 1163K| 286M| 35M| 201K (1)| 00:40:16 |
|* 31 | HASH JOIN | | 150K| 33M| 30M| 180K (1)| 00:36:11 |
|* 32 | HASH JOIN | | 151K| 28M| 20M| 172K (1)| 00:34:25 |
| 33 | TABLE ACCESS FULL | GV_EMR_ENTITY_MASTER | 951K| 9M| | 758 (2)| 00:00:10 |
|* 34 | HASH JOIN | | 151K| 27M| 25M| 168K (1)| 00:33:46 |
|* 35 | HASH JOIN | | 151K| 23M| 2328K| 163K (1)| 00:32:47 |
|* 36 | TABLE ACCESS FULL | GM_ERL_ENTITY_ROLES | 99240 | 1162K| | 22205 (1)| 00:04:27 |
|* 37 | HASH JOIN | | 151K| 21M| 4840K| 140K (1)| 00:28:05 |
|* 38 | HASH JOIN | | 34132 | 4433K| 3464K| 127K (1)| 00:25:35 |
|* 39 | HASH JOIN | | 34419 | 3058K| 2776K| 120K (1)| 00:24:03 |
|* 40 | HASH JOIN | | 34229 | 2373K| 1912K| 117K (1)| 00:23:35 |
|* 41 | HASH JOIN | | 34229 | 1504K| 1440K| 114K (1)| 00:22:49 |
| 42 | NESTED LOOPS | | 34229 | 1036K| | 99509 (1)| 00:19:55 |
|* 43 | TABLE ACCESS FULL | RDI_REPOSITORY_DOCUMENTS_INFO | 34205 | 467K| | 31522 (2)| 00:06:19 |
|* 44 | TABLE ACCESS BY INDEX ROWID| GM_RDT_REPOSITORY_DOCUMENTS | 1 | 17 | | 2 (0)| 00:00:01 |
|* 45 | INDEX UNIQUE SCAN | SYS_C0082075 | 1 | | | 1 (0)| 00:00:01 |
| 46 | TABLE ACCESS FULL | GM_RFR_REPOSITORY_FOLDER | 2125K| 28M| | 11843 (1)| 00:02:23 |
| 47 | TABLE ACCESS FULL | GV_ETY_ENTITIES | 953K| 23M| | 1958 (1)| 00:00:24 |
| 48 | TABLE ACCESS FULL | GV_EMR_ENTITY_MASTER | 951K| 18M| | 758 (2)| 00:00:10 |
| 49 | TABLE ACCESS FULL | GM_ETY_ENTITIES | 945K| 37M| | 5120 (1)| 00:01:02 |
| 50 | TABLE ACCESS FULL | GV_ERL_ENTITY_ROLES | 4233K| 68M| | 6413 (1)| 00:01:17 |
| 51 | TABLE ACCESS FULL | GV_ETY_ENTITIES | 953K| 23M| | 1958 (1)| 00:00:24 |
| 52 | TABLE ACCESS FULL | GM_ETY_ENTITIES | 945K| 34M| | 5102 (1)| 00:01:02 |
| 53 | INDEX FAST FULL SCAN | FKGV_EAS_ENT111959_IDX | 7325K| 146M| | 7127 (1)| 00:01:26 |
Query Block Name / Object Alias (identified by operation id):
1 - SET$1
2 - SEL$B4C8BCFD
15 - SEL$B4C8BCFD / RDIRE@SEL$11
16 - SEL$B4C8BCFD / GMRDT@SEL$10
17 - SEL$B4C8BCFD / GMRDT@SEL$10
18 - SEL$B4C8BCFD / GMRFR@SEL$9
19 - SEL$B4C8BCFD / GV_ETY@SEL$1
20 - SEL$B4C8BCFD / M@SEL$1
21 - SEL$B4C8BCFD / GMENT@SEL$2
22 - SEL$B4C8BCFD / GVE@SEL$3
23 - SEL$B4C8BCFD / GME@SEL$4
24 - SEL$B4C8BCFD / GVM@SEL$5
25 - SEL$B4C8BCFD / GVI@SEL$6
26 - SEL$B4C8BCFD / GMN@SEL$7
27 - SEL$B4C8BCFD / GVAD@SEL$8
28 - SEL$5ECD7CF3
33 - SEL$5ECD7CF3 / GV_EMR_MASTER@SEL$17
36 - SEL$5ECD7CF3 / GM_ERL@SEL$15
43 - SEL$5ECD7CF3 / RDIRE@SEL$22
44 - SEL$5ECD7CF3 / GMRDT@SEL$21
45 - SEL$5ECD7CF3 / GMRDT@SEL$21
46 - SEL$5ECD7CF3 / GMRFR@SEL$20
47 - SEL$5ECD7CF3 / GV_ETY@SEL$12
48 - SEL$5ECD7CF3 / M@SEL$12
49 - SEL$5ECD7CF3 / GMENT@SEL$13
50 - SEL$5ECD7CF3 / GVE@SEL$14
51 - SEL$5ECD7CF3 / GV_ETY_TEMP@SEL$16
52 - SEL$5ECD7CF3 / GM_ETY_TEMP@SEL$18
53 - SEL$5ECD7CF3 / GVA@SEL$19
Predicate Information (identified by operation id):
2 - filter(ROWNUM<10)
3 - filter(ROWNUM>0)
4 - access("GVI"."IND_REG_CODE"="GVAD"."IAS_REG_CODE" AND "GVI"."IND_INDIVIDUAL_IDENTIFIER"="GVAD"."IAS_INDIVIDUAL_IDENT
IFIER" AND "GVI"."IND_IND_VERSION"="GVAD"."IAS_IND_VERSION")
5 - access("GVI"."IND_ID"="GMN"."IND_ID")
6 - access("GVM"."MTR_IDENTIFIER"="GVI"."IND_INDIVIDUAL_IDENTIFIER" AND
"GVM"."MTR_CURRENT_VERSION"="GVI"."IND_IND_VERSION")
7 - access("GME"."ERL_IND_INDIVIDUAL_IDENTIFIER"="GVM"."MTR_IDENTIFIER" AND
"GME"."ERL_IND_VERSION"="GVM"."MTR_CURRENT_VERSION")
8 - access("GVE"."ERL_ID"="GME"."ERL_ID")
9 - access("M"."MTR_IDENTIFIER"="GVE"."ERL_ENTITY_IDENTIFIER" AND "M"."MTR_CURRENT_VERSION"="GVE"."ERL_ETY_VERSION")
10 - access("GMENT"."ETY_ID"="GV_ETY"."ETY_ID")
11 - access("GV_ETY"."ETY_ENTITY_IDENTIFIER"="M"."MTR_IDENTIFIER" AND
"GV_ETY"."ETY_ETY_VERSION"="M"."MTR_CURRENT_VERSION" AND "GV_ETY"."ETY_REG_CODE"="M"."MTR_REG_CODE")
12 - access("GMRFR"."RFR_ENTITY_IDENTIFIER"="GV_ETY"."ETY_ENTITY_IDENTIFIER")
13 - access("GMRDT"."RDT_RFR_ID"="GMRFR"."RFR_ID")
15 - filter(TO_CHAR(INTERNAL_FUNCTION("RDIRE"."RDI_SUBMISSION_DATE"),'YYYY-MM-DD')>='2007-11-01' AND
TO_CHAR(INTERNAL_FUNCTION("RDIRE"."RDI_SUBMISSION_DATE"),'YYYY-MM-DD')<='2009-01-05')
16 - filter("GMRDT"."RDT_DTE_CODE"='OPD' OR "GMRDT"."RDT_DTE_CODE"='PD')
17 - access("RDIRE"."RDI_RDT_ID"="GMRDT"."RDT_ID")
23 - filter("GME"."ERL_IND_INDIVIDUAL_IDENTIFIER" IS NOT NULL AND "GME"."ERL_IND_VERSION" IS NOT NULL)
28 - filter(ROWNUM<10)
29 - filter(ROWNUM>0)
30 - access("GV_ETY_TEMP"."ETY_REG_CODE"="GVA"."EAS_REG_CODE" AND
"GV_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"="GVA"."EAS_ENTITY_IDENTIFIER" AND
"GV_ETY_TEMP"."ETY_ETY_VERSION"="GVA"."EAS_ETY_VERSION")
31 - access("GM_ETY_TEMP"."ETY_ID"="GV_ETY_TEMP"."ETY_ID")
32 - access("GV_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"="GV_EMR_MASTER"."MTR_IDENTIFIER" AND
"GV_ETY_TEMP"."ETY_ETY_VERSION"="GV_EMR_MASTER"."MTR_CURRENT_VERSION")
34 - access("GM_ERL"."ERL_ENTITY_IDENTIFIER_ASSOC"="GV_ETY_TEMP"."ETY_ENTITY_IDENTIFIER")
35 - access("GVE"."ERL_ID"="GM_ERL"."ERL_ID")
36 - filter("GM_ERL"."ERL_ENTITY_IDENTIFIER_ASSOC" IS NOT NULL AND "GM_ERL"."ERL_RRE_NAME"='SHR')
37 - access("M"."MTR_IDENTIFIER"="GVE"."ERL_ENTITY_IDENTIFIER" AND "M"."MTR_CURRENT_VERSION"="GVE"."ERL_ETY_VERSION")
38 - access("GMENT"."ETY_ID"="GV_ETY"."ETY_ID")
39 - access("GV_ETY"."ETY_ENTITY_IDENTIFIER"="M"."MTR_IDENTIFIER" AND
"GV_ETY"."ETY_ETY_VERSION"="M"."MTR_CURRENT_VERSION" AND "GV_ETY"."ETY_REG_CODE"="M"."MTR_REG_CODE")
40 - access("GMRFR"."RFR_ENTITY_IDENTIFIER"="GV_ETY"."ETY_ENTITY_IDENTIFIER")
41 - access("GMRDT"."RDT_RFR_ID"="GMRFR"."RFR_ID")
43 - filter(TO_CHAR(INTERNAL_FUNCTION("RDIRE"."RDI_SUBMISSION_DATE"),'YYYY-MM-DD')>='2007-11-01' AND
TO_CHAR(INTERNAL_FUNCTION("RDIRE"."RDI_SUBMISSION_DATE"),'YYYY-MM-DD')<='2009-01-05')
44 - filter("GMRDT"."RDT_DTE_CODE"='OPD' OR "GMRDT"."RDT_DTE_CODE"='PD')
45 - access("RDIRE"."RDI_RDT_ID"="GMRDT"."RDT_ID")
Column Projection Information (identified by operation id):
1 - STRDEF[200], STRDEF[4000], STRDEF[400], STRDEF[4000], STRDEF[200]
2 - "GMN"."IND_LAST_NAME"[VARCHAR2,400], "GMN"."IND_FIRST_NAME"[VARCHAR2,400],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200]
3 - "GMN"."IND_LAST_NAME"[VARCHAR2,400], "GMN"."IND_FIRST_NAME"[VARCHAR2,400],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200]
4 - (#keys=3) "GMN"."IND_LAST_NAME"[VARCHAR2,400], "GMN"."IND_FIRST_NAME"[VARCHAR2,400],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200]
5 - (#keys=1) "GVI"."IND_INDIVIDUAL_IDENTIFIER"[VARCHAR2,200], "GVI"."IND_IND_VERSION"[NUMBER,22],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200], "GVI"."IND_REG_CODE"[VARCHAR2,200], "GMN"."IND_LAST_NAME"[VARCHAR2,400],
"GMN"."IND_FIRST_NAME"[VARCHAR2,400]
6 - (#keys=2) "GVI"."IND_INDIVIDUAL_IDENTIFIER"[VARCHAR2,200], "GVI"."IND_IND_VERSION"[NUMBER,22],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200], "GVI"."IND_REG_CODE"[VARCHAR2,200], "GVI"."IND_ID"[NUMBER,22]
7 - (#keys=2) "GVM"."MTR_IDENTIFIER"[VARCHAR2,200], "GVM"."MTR_CURRENT_VERSION"[NUMBER,22],
"GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400]
8 - (#keys=1) "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GME"."ERL_IND_VERSION"[NUMBER,22],
"GME"."ERL_IND_INDIVIDUAL_IDENTIFIER"[VARCHAR2,200]
9 - (#keys=2) "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GVE"."ERL_ID"[NUMBER,22]
10 - (#keys=1) "M"."MTR_IDENTIFIER"[VARCHAR2,200], "M"."MTR_CURRENT_VERSION"[NUMBER,22],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000]
11 - (#keys=3) "M"."MTR_IDENTIFIER"[VARCHAR2,200], "M"."MTR_CURRENT_VERSION"[NUMBER,22], "GV_ETY"."ETY_ID"[NUMBER,22]
12 - (#keys=1) "GV_ETY"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200], "GV_ETY"."ETY_REG_CODE"[VARCHAR2,200],
"GV_ETY"."ETY_ID"[NUMBER,22], "GV_ETY"."ETY_ETY_VERSION"[NUMBER,22]
13 - (#keys=1) "GMRFR"."RFR_ENTITY_IDENTIFIER"[VARCHAR2,200]
14 - (#keys=0) "GMRDT"."RDT_RFR_ID"[NUMBER,22]
15 - "RDIRE"."RDI_RDT_ID"[NUMBER,22]
16 - "GMRDT"."RDT_RFR_ID"[NUMBER,22]
17 - "GMRDT".ROWID[ROWID,10]
18 - "GMRFR"."RFR_ID"[NUMBER,22], "GMRFR"."RFR_ENTITY_IDENTIFIER"[VARCHAR2,200]
19 - "GV_ETY"."ETY_REG_CODE"[VARCHAR2,200], "GV_ETY"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GV_ETY"."ETY_ETY_VERSION"[NUMBER,22], "GV_ETY"."ETY_ID"[NUMBER,22]
20 - "M"."MTR_REG_CODE"[VARCHAR2,200], "M"."MTR_IDENTIFIER"[VARCHAR2,200], "M"."MTR_CURRENT_VERSION"[NUMBER,22]
21 - "GMENT"."ETY_ID"[NUMBER,22], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400]
22 - "GVE"."ERL_ENTITY_IDENTIFIER"[VARCHAR2,200], "GVE"."ERL_ETY_VERSION"[NUMBER,22], "GVE"."ERL_ID"[NUMBER,22]
23 - "GME"."ERL_ID"[NUMBER,22], "GME"."ERL_IND_INDIVIDUAL_IDENTIFIER"[VARCHAR2,200], "GME"."ERL_IND_VERSION"[NUMBER,22]
24 - "GVM"."MTR_IDENTIFIER"[VARCHAR2,200], "GVM"."MTR_CURRENT_VERSION"[NUMBER,22]
25 - "GVI"."IND_REG_CODE"[VARCHAR2,200], "GVI"."IND_INDIVIDUAL_IDENTIFIER"[VARCHAR2,200],
"GVI"."IND_IND_VERSION"[NUMBER,22], "GVI"."IND_ID"[NUMBER,22]
26 - "GMN"."IND_ID"[NUMBER,22], "GMN"."IND_FIRST_NAME"[VARCHAR2,400], "GMN"."IND_LAST_NAME"[VARCHAR2,400]
27 - "GVAD"."IAS_REG_CODE"[VARCHAR2,200], "GVAD"."IAS_INDIVIDUAL_IDENTIFIER"[VARCHAR2,200],
"GVAD"."IAS_IND_VERSION"[NUMBER,22]
28 - "GM_ETY_TEMP"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GM_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200]
29 - "GM_ETY_TEMP"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GM_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200]
30 - (#keys=3) "GM_ETY_TEMP"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GM_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200]
31 - (#keys=1) "GV_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200], "GV_ETY_TEMP"."ETY_ETY_VERSION"[NUMBER,22],
"GV_ETY_TEMP"."ETY_REG_CODE"[VARCHAR2,200], "GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400],
"GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GM_ETY_TEMP"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GM_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200]
32 - (#keys=2) "GV_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200], "GV_ETY_TEMP"."ETY_ETY_VERSION"[NUMBER,22],
"GV_ETY_TEMP"."ETY_ID"[NUMBER,22], "GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200], "GV_ETY_TEMP"."ETY_REG_CODE"[VARCHAR2,200]
33 - "GV_EMR_MASTER"."MTR_IDENTIFIER"[VARCHAR2,200], "GV_EMR_MASTER"."MTR_CURRENT_VERSION"[NUMBER,22]
34 - (#keys=1) "GV_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200], "GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400],
"GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GV_ETY_TEMP"."ETY_REG_CODE"[VARCHAR2,200], "GV_ETY_TEMP"."ETY_ID"[NUMBER,22], "GV_ETY_TEMP"."ETY_ETY_VERSION"[NUMBER,22]
35 - (#keys=1) "GM_ERL"."ERL_ENTITY_IDENTIFIER_ASSOC"[VARCHAR2,200], "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000],
"GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200], "GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400]
36 - "GM_ERL"."ERL_ID"[NUMBER,22], "GM_ERL"."ERL_ENTITY_IDENTIFIER_ASSOC"[VARCHAR2,200]
37 - (#keys=2) "GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GVE"."ERL_ID"[NUMBER,22]
38 - (#keys=1) "M"."MTR_IDENTIFIER"[VARCHAR2,200], "M"."MTR_CURRENT_VERSION"[NUMBER,22],
"GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000]
39 - (#keys=3) "M"."MTR_IDENTIFIER"[VARCHAR2,200], "M"."MTR_CURRENT_VERSION"[NUMBER,22], "GV_ETY"."ETY_ID"[NUMBER,22]
40 - (#keys=1) "GV_ETY"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200], "GV_ETY"."ETY_REG_CODE"[VARCHAR2,200],
"GV_ETY"."ETY_ID"[NUMBER,22], "GV_ETY"."ETY_ETY_VERSION"[NUMBER,22]
41 - (#keys=1) "GMRFR"."RFR_ENTITY_IDENTIFIER"[VARCHAR2,200]
42 - (#keys=0) "GMRDT"."RDT_RFR_ID"[NUMBER,22]
43 - "RDIRE"."RDI_RDT_ID"[NUMBER,22]
44 - "GMRDT"."RDT_RFR_ID"[NUMBER,22]
45 - "GMRDT".ROWID[ROWID,10]
46 - "GMRFR"."RFR_ID"[NUMBER,22], "GMRFR"."RFR_ENTITY_IDENTIFIER"[VARCHAR2,200]
47 - "GV_ETY"."ETY_REG_CODE"[VARCHAR2,200], "GV_ETY"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GV_ETY"."ETY_ETY_VERSION"[NUMBER,22], "GV_ETY"."ETY_ID"[NUMBER,22]
48 - "M"."MTR_REG_CODE"[VARCHAR2,200], "M"."MTR_IDENTIFIER"[VARCHAR2,200], "M"."MTR_CURRENT_VERSION"[NUMBER,22]
49 - "GMENT"."ETY_ID"[NUMBER,22], "GMENT"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GMENT"."ETY_CURRENT_NAME"[VARCHAR2,4000], "GMENT"."ETY_DISCRIMINANT"[VARCHAR2,400]
50 - "GVE"."ERL_ENTITY_IDENTIFIER"[VARCHAR2,200], "GVE"."ERL_ETY_VERSION"[NUMBER,22], "GVE"."ERL_ID"[NUMBER,22]
51 - "GV_ETY_TEMP"."ETY_REG_CODE"[VARCHAR2,200], "GV_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GV_ETY_TEMP"."ETY_ETY_VERSION"[NUMBER,22], "GV_ETY_TEMP"."ETY_ID"[NUMBER,22]
52 - "GM_ETY_TEMP"."ETY_ID"[NUMBER,22], "GM_ETY_TEMP"."ETY_ENTITY_IDENTIFIER"[VARCHAR2,200],
"GM_ETY_TEMP"."ETY_CURRENT_NAME"[VARCHAR2,4000]
53 - "GVA"."EAS_REG_CODE"[VARCHAR2,200], "GVA"."EAS_ENTITY_IDENTIFIER"[VARCHAR2,200], "GVA"."EAS_ETY_VERSION"[NUMBER,22]Edited by: user12839343 on Jun 14, 2010 6:43 PM -
UNION ALL and UNION performance issue
Hi All,
I am trying to figure out the data for which only receive transaction has been done and further processing is pending. These transactions include all PO, RMA , ISO etc...
I have to use UNION ALL in this case as for RMA and ISO, details which i want are not able to gather in a single query.
But query is taking a lot of time ...may be around 30..mins in UNION ALL while 6 to 7 mins in UNION.
To get all records I must have to use UNION ALL...
So kindly suggest the solution for this problem
Thanks
Sachin
Query is given below...
SELECT /* + FIRST_ROWS */ DECODE(rsl.SOURCE_DOCUMENT_CODE,'REQ',(SELECT org1.ORGANIZATION_NAME
FROM org_organization_definitions org1
WHERE org1.ORGANIZATION_ID =
rsl.FROM_ORGANIZATION_ID)) Vendor_Name
,rsh.RECEIPT_NUM Receipt_Number
,TO_CHAR(rt3.TRANSACTION_DATE,'Mon-DD-YYYY HH:MM:SS') Receipt_Date_and_Time
,msi.SEGMENT1 Part_Number
,msi.DESCRIPTION Part_Name
,rt3.QUANTITY Quantity
,rt3.UNIT_OF_MEASURE UOM
,NULL ASL_Status
--for ISO no asl flag ASL Flag
,TO_CHAR(TRUNC((((86400*(SYSDATE-rt3.TRANSACTION_DATE))/60)/60)/24))|| ' Days ' || TO_CHAR(TRUNC(((86400*(SYSDATE-rt3.TRANSACTION_DATE))/60)/60)-24*(TRUNC((((86400*(SYSDATE-rt3.TRANSACTION_DATE))/60)/60)/24)))|| ' Hours' Days_and_hours_passed
,DECODE(
NVL(msi.max_minmax_quantity,0) ,
0 , 0 ,
(NVL(msi.max_minmax_quantity,0) -
NVL(inmohqd.onhand,0))
* 100
/ NVL(msi.max_minmax_quantity,0)
) gap_percent
FROM rcv_transactions rt3
,rcv_shipment_headers rsh
,rcv_shipment_lines rsl
,mtl_system_items msi
,org_organization_definitions org
--,MTL_ONHAND_QUANTITIES_DETAIL moqhd
,(SELECT NVL(SUM(primary_transaction_quantity),0) onhand,INVENTORY_ITEM_ID item_id,ORGANIZATION_ID organization_id
FROM mtl_onhand_quantities_detail
WHERE SUBINVENTORY_CODE NOT IN ('Wip_SF','Wip_Int','Reject','Scrap','FG Trading','FG')
GROUP BY INVENTORY_ITEM_ID, ORGANIZATION_ID) inmohqd
WHERE inmohqd.item_id(+) = msi.INVENTORY_ITEM_ID
AND inmohqd.organization_id(+) = msi.ORGANIZATION_ID
--AND inmoqhd.SUBINVENTORY_CODE NOT IN ('Wip_SF','Wip_Int','Reject','Scrap','FG Trading','FG')
AND msi.INVENTORY_ITEM_ID = rsl.ITEM_ID
AND rsh.SHIPMENT_HEADER_ID = rsl.SHIPMENT_HEADER_ID
AND org.ORGANIZATION_ID = rt3.ORGANIZATION_ID
AND msi.ORGANIZATION_ID = rt3.ORGANIZATION_ID
AND rsh.SHIPMENT_HEADER_ID = rt3.SHIPMENT_HEADER_ID
AND rsl.SHIPMENT_HEADER_ID = rt3.SHIPMENT_HEADER_ID
AND rsl.SHIPMENT_LINE_ID = rt3.SHIPMENT_LINE_ID
AND rt3.PO_HEADER_ID IS NULL
AND TRUNC(rt3.TRANSACTION_DATE) <= TRUNC(p_tilldate)
AND rsl.TO_ORGANIZATION_ID = p_organization_id
AND rsh.ORGANIZATION_ID = p_organization_id
AND CONCAT(TRIM(rt3.SHIPMENT_HEADER_ID),TRIM(rt3.SHIPMENT_LINE_ID)) IN
SELECT CONCAT(TRIM(rt1.SHIPMENT_HEADER_ID),TRIM(rt1.SHIPMENT_LINE_ID))
FROM rcv_transactions rt1
WHERE NOT EXISTS(
SELECT 1
FROM rcv_transactions rt2
WHERE rt2.TRANSACTION_TYPE <> 'RECEIVE'
AND rt1.SHIPMENT_HEADER_ID = rt2.SHIPMENT_HEADER_ID
AND rt1.SHIPMENT_LINE_ID = rt2.SHIPMENT_LINE_ID
AND rt2.ORGANIZATION_ID = p_organization_id
UNION
SELECT /* + FIRST_ROWS */ pv.VENDOR_NAME Vendor_Name
,rsh.RECEIPT_NUM Receipt_Number
,TO_CHAR(rt.TRANSACTION_DATE,'Mon-DD-YYYY HH:MM:SS') Receipt_Date_and_Time
,msi.SEGMENT1 Part_Number
,msi.DESCRIPTION Part_Name
,rt.QUANTITY Quantity
,rt.UNIT_OF_MEASURE UOM
--start 001
,NVL((SELECT DISTINCT DECODE (ASL_STATUS_ID,1,'New',2,'Approved','To be checked')
FROM po_approved_supplier_list pasl
WHERE pasl.item_id=rsl.ITEM_ID
AND pasl.VENDOR_ID(+) = pv.VENDOR_ID
AND pasl.VENDOR_SITE_ID(+) = pvs.VENDOR_SITE_ID),'No_data') ASL_Status
--end 001
,TO_CHAR(TRUNC((((86400*(SYSDATE-rt.TRANSACTION_DATE))/60)/60)/24))|| ' Days ' || TO_CHAR(TRUNC(((86400*(SYSDATE-rt.TRANSACTION_DATE))/60)/60)-24*(TRUNC((((86400*(SYSDATE-rt.TRANSACTION_DATE))/60)/60)/24)))|| ' Hours' Days_and_hours_passed ,DECODE(
NVL(msi.max_minmax_quantity,0) ,
0 , 0 ,
(NVL(msi.max_minmax_quantity,0) -
NVL(inmohqd.onhand,0))
* 100
/ NVL(msi.max_minmax_quantity,0)
) gap_percent
FROM rcv_transactions rt
,po_vendors pv
,po_vendor_sites_all pvs
,rcv_shipment_headers rsh
,rcv_shipment_lines rsl
,mtl_system_items msi
,org_organization_definitions org
--,mtl_onhand_quantities_detail moqhd
,(SELECT NVL(SUM(primary_transaction_quantity),0) onhand,INVENTORY_ITEM_ID item_id,ORGANIZATION_ID organization_id
FROM mtl_onhand_quantities_detail
WHERE SUBINVENTORY_CODE NOT IN ('Wip_SF','Wip_Int','Reject','Scrap','FG Trading','FG')
GROUP BY INVENTORY_ITEM_ID, ORGANIZATION_ID) inmohqd
WHERE inmohqd.item_id(+) = msi.INVENTORY_ITEM_ID
AND inmohqd.ORGANIZATION_ID(+) = msi.ORGANIZATION_ID
--AND inmoqhd.SUBINVENTORY_CODE NOT IN ('Wip_SF','Wip_Int','Reject','Scrap','FG Trading','FG')
AND msi.INVENTORY_ITEM_ID = rsl.ITEM_ID
AND rsh.SHIPMENT_HEADER_ID = rsl.SHIPMENT_HEADER_ID
AND pv.VENDOR_ID = pvs.VENDOR_ID
AND org.ORGANIZATION_ID = rt.ORGANIZATION_ID
AND msi.ORGANIZATION_ID = rt.ORGANIZATION_ID
AND pvs.VENDOR_SITE_ID = rt.VENDOR_SITE_ID
AND pv.VENDOR_ID = rt.VENDOR_ID
AND rsh.SHIPMENT_HEADER_ID = rt.SHIPMENT_HEADER_ID
AND rsl.SHIPMENT_HEADER_ID = rt.SHIPMENT_HEADER_ID
AND rsl.SHIPMENT_LINE_ID = rt.SHIPMENT_LINE_ID
AND TRUNC(rt.TRANSACTION_DATE) <= TRUNC(p_tilldate)
AND rsl.TO_ORGANIZATION_ID = p_organization_id
AND CONCAT(TRIM(rt.SHIPMENT_HEADER_ID),TRIM(rt.SHIPMENT_LINE_ID)) IN
SELECT CONCAT(TRIM(rt1.SHIPMENT_HEADER_ID),TRIM(rt1.SHIPMENT_LINE_ID))
FROM RCV_TRANSACTIONS rt1
WHERE rt1.TRANSACTION_TYPE = 'RECEIVE'
AND rt1.DESTINATION_TYPE_CODE = 'RECEIVING'
AND rt1.PO_HEADER_ID IS NOT NULL
AND NOT EXISTS(
SELECT 1
FROM RCV_TRANSACTIONS rt2
WHERE rt2.SHIPMENT_HEADER_ID = rt1.SHIPMENT_HEADER_ID
AND rt2.SHIPMENT_LINE_ID = rt1.SHIPMENT_LINE_ID
AND rt2.TRANSACTION_TYPE <> 'RECEIVE'
)In this case, for selected columns, all data is same for one of the RMA with more than one line. So UNION will skip one of the records. However, shipment line id are different for both records, so by selecting it in select list is solving the problem and so no need to use UNION ALL. But, anyhow UNION ALL is better than UNION in performance as it does not require to sort. Then why I am facing this problem...
Kindly suggest
Regards,
Sachin -
Inventory on Hand Report - Using Union ALL - need two fields to be part of the group
Hi all,
I have created an Inventory "on Hand" Report that takes the Current Inventory from the Item Entry table and the Sales from Unposted Sales Line table and Transfers in and out from the Unposted Transfer Line table. I have joined the tables
using the UNION ALL function.
My problem is that the Transfer table has two locations whereas the other tables only have one. I am grouping on Location code from the Item Entry table which is equivalent to BOTH Transfer from location and the Transfer to.
As an example, there are 15lbs of inventory for Product A in Location #1 with a transfer out of 15 lbs. The Transfer out is going to Location #2
I don't know how to write the query or set up the group so that it recognizes both the Transfer to and the Transfer From fields
I want the report to look similar to the one below but I can only get it to show one of the locations. Is there some way to use the Union function and have one field in the first table be or equivalent to two fields in another?
Location Code
Item No.
Lbs
Sales Orders
Transfer Out
Transfer In
Available Inventory
Location #1
Product A
15
-15
Location #1
15
-15
Location #2
Product A
15
15
Location #2
15
15Hi Igor,
You can get a custom sort order added to your IP column without the need for a second column.
Consider that the sorting is done strictly left-to-right across a string in the column. The string can be any valid HTML content. So, you could wrap your string within, say, a SPAN tag and add an attribute to that tag that contains the sort order you need before the text that is displayed to the user. As long as the attribute is correctly structured (that is, all instances are of the same length, for example), then sorting will work correctly. For example:
SELECT
'<span title="' || PAD_IP_ADDRESS(IP) || '">' || IP || '</span>' Y
FROM ...Now you need to ensure that the PAD_IP_ADDRESS() function returns the correct values. In IP addresses, you have anything from "0.0.0.0" to "255.255.255.255". To get them to sort "numerically", you need to pad one or two digit numbers to get three digit numbers for each value - so, "0.0.0.0" becomes "000.000.000.000". You could create a function to do this - something like:
CREATE OR REPLACE FUNCTION PAD_IP_ADDRESS
pIP IN VARCHAR2
RETURN VARCHAR2
IS
vIP VARCHAR2(15);
vTEMP APEX_APPLICATION_GLOBAL.VC_ARR2;
vSEP VARCHAR2(1);
BEGIN
vSEP := '';
vIP := '';
vTEMP := APEX_UTIL.STRING_TO_TABLE(pIP,'.');
FOR x IN 1..vTEMP.COUNT
LOOP
vIP := vIP || vSEP || TRIM(TO_CHAR(TO_NUMBER(vTEMP(x)),'000'));
vSEP := '.';
END LOOP;
RETURN vIP;
END;The output from this would look something like:
<span title="001.001.001.001">1.1.1.1</span>
<span title="002.255.255.255">2.255.255.255</span>
<span title="010.001.199.098">10.1.199.098</span>Andy -
Return data from all columns apart from a certain data type.
Bit stuck on something, hope somebody here can help:
I want to do a 'select * from ' a table, to return all columns except ones of a certain datatype. ie. I want to return data from all columns, excluding columns of datatype 'SDO_GEOMETRY'.
This gives me the list of columns:
SELECT COLUMN_NAME
FROM USER_TAB_COLUMNS
WHERE TABLE_NAME = 'ORDER_ITEM'
AND DATA_TYPE <> 'SDO_GEOMETRY'; But I can't seem to take it any further...
Now if I knew the columns beforehand, then of course I could just list them, excluding the geometry column, but this is to be used for a plug-in for MS Word, where a user can pick database columns to dynamically fill a report from - but I don't want the geometry columns as these can't be handled in this way.Hi Reggie,
> connects to the database and presents a list of tables
My guess is that this macro is written so it selects from all_tab_cols.
Change that plugin and let it select from a view like the one above. That way, the users won't be able to see/pick anything that you are not able/willing to present for them.
Edit:
You could even tease your users, and let them see the columns, but not being able to pick them.
create or replace view available_tab_columns
as
select decode(pickable.data_type, null, 0, 1) pickable
,atc.* -- narrow down yourself
from all_tab_cols atc -- or maybe user_tab_cols
,(select 'CHAR' data_type from dual union all
select 'DATE' from dual union all
select 'NUMBER' from dual
-- complete positive list, yourself
) pickable
where atc.data_type = pickable.data_type(+);Regards
Peter
Message was edited by:
Peter Gjelstrup -
Function module u0091GET_PRINT_PARAMETERSu0092 Not showing all columns
Hello all,
I am using function module GET_PRINT_PARAMETERS
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
DESTINATION = LOC_DEST
COPIES = WF_COPIES
LIST_NAME = WF_LISTNAME
LIST_TEXT = WF_LISTTEXT
IMMEDIATELY = ' '
RELEASE = ' '
NEW_LIST_ID = 'X'
EXPIRATION = WF_DAYS
LINE_SIZE = 132
LINE_COUNT = 65
LAYOUT = 'X_65_132'
SAP_COVER_PAGE = 'X'
RECEIVER = 'SAP*'
DEPARTMENT = ''
NO_DIALOG = 'X'
IMPORTING
OUT_PARAMETERS = WF_PARAMS
VALID = WF_VALID.
NEW-PAGE PRINT ON PARAMETERS WF_PARAMS NO DIALOG.
PERFORM WRITE_PDF_SUMMARY USING P_VALID P_COND P_ZMGC P_ZOGC P_PDF.
NEW-PAGE PRINT OFF.
But in my report there are 10 columns and in download file its showing only 6 columns .If I increase that size to X_65_200 Then it shows all columns But its not readable. Please tell me how can I use that fix size X_65_132 & it will show all columns .
Message was edited by:
megha waykarYou r right,But that program is already developed in following sequence
*==> 1. Create Virtual Spool
using FUNCTION 'GET_PRINT_PARAMETERS'
*==> 2. Write Report to Virtual Spool. Use NEW-PAGE PRINT ON option.
NEW-PAGE PRINT ON PARAMETERS WF_PARAMS NO DIALOG.
PERFORM WRITE_PDF_SUMMARY USING P_VALID
NEW-PAGE PRINT OFF.
*===> 3. Prepare Path and set spool number.
*===> 4. Convert List to PDF format.
Use function 'CONVERT_ABAPSPOOLJOB_2_PDF'
*==> 5. download PDF file
CALL FUNCTION 'GUI_DOWNLOAD'.
and it's not showing readable download file.
I don't have to change whole coding. I just want to increase that font. -
Is there a way to match all columns in a table?
Oracle 11.1.0.7:
Is there any way to say match all the columns of Table A with Table B? For eg:
Table A
id
name
Table B
id
name
Is there a way to say match all the columns with similar column in other in a select instead of doing "where A.id = B.id and A.name = b.name"? I am trying to write a compare script to test that replication is indeed doing the right thing.user628400 wrote:
If 2 columns have null values does it match that too? I'll run some tests.It does
SQL> ed
Wrote file afiedt.buf
1 with a as (select 1 col1, null col2 from dual
2 union all
3 select 2 col1, null col2 from dual
4 union all
5 select null, null from dual),
6 b as (select 1, null from dual
7 union all
8 select null, null from dual)
9 select *
10 from a
11 minus
12 select *
13* from b
SQL> /
COL1 C
2
While I was doing the comparision I found that if column x in Table A has "null" and same column x in table B has "null" and if I do "where A.x = B.x" then it doesn't return the row. I am not sure why. Does "minus" work the same way?That's because NULL will never equal any value (including NULL) and NULL will never not equal any value (including NULL). That is
NULL = 1 is unknown (which maps to false)
NULL = NULL is unknown
NULL != 1 is unknown
NULL != NULL is unknown
If you want to compare columns that may have NULL values, you need to use IS NULL and IS NOT NULL or use the NVL function to map NULL values to a non-NULL but impossible value, i.e.
WHERE (a.x = b.x OR
(a.x is null and b.x is null))or
WHERE nvl(a.x,-17) = nvl(b.x,-17)assuming that -17 is not a valid value for either a.x or b.x
Justin
Maybe you are looking for
-
I need to upgrade my ram on a pavilion dv 6000 and how would i do that?
i only have 912 MB of ram which is suckish so how would i upgrade my ram i would like to get 2 1GB sticks to put in my comp can u tell me what type of ram i would buy and where i would get it like (best buy,etc)? INFO MODEL:HP Pavilion dv6000 Proces
-
Web page content missing in Safari
When viewing a web page in Safari several drop down links are missing. (As compared to viewing in Explorer). How do I get them to appear in Safari as they are crucial to the navigation of the site?
-
Dear all, When a purchase order is rejected (ME29N), the on-order stock is not updated automatically - until the purchase order item positions are deleted in this purchase order. So a plant controller who rejects a PO (and would not be authorized to
-
The installation of FMS 3.5.1 r516 Development fatally failed on our Windows 2008 R2 Server. We tried an R1 server and that one installed with no issues. It gets past the MS C++ installer, then shortly after: Problem signature: Problem Event Name:
-
How to set default file browser and web browser
I am using openbox as the window manager and don't have a desktop environment. My file browser is pcmam file manager and my web browser is chromium. I add export BROWSER=/usr/bin/pcmanfm in .bashrc so that the system uses pcman file manager to open a