Requesting Minor Help Please... in a Query
Hi All,
Below is my query, The time i exceute it, outer select clause gives me 'Colomn ambiguously defined' error msg.
Without outer select clause, it goes fine. Please guide me, what i miss here.
Also would be grateful, if anyone suggest me about writing this query in a better or optimized way. Thanks
SELECT MAX(A.START_FX_TRAN_ID)
,MAX(A.end_fx_tran_id)
,A.entered_dt_ts
,A.USER_NAME
,A.trade_dt
,A.deal_number
,A.fx_deal_type
,A.orientation_buysell
,A.base_ccy
,A.base_ccy_amt
,A.secondary_ccy
,A.secondary_ccy_amt
,A.MATURITY_DT
,A.TRADE_RT
,A.FORWARD_PTS
,A.CORPORATE_PIPS
,A.DEAL_OWNER_INITIALS
,A.CORPORATE_DEALER
,A.PROFIT_CENTER_CD
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,A.counterparty_nm
,A.counterparty_number
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL from
(SELECT
start_tx.fx_tran_id START_FX_TRAN_ID
,end_tx.fx_tran_id end_fx_tran_id
,start_tx.entered_dt_ts
,USER USER_NAME
,start_tx.trade_dt
,start_tx.deal_number
,start_tx.fx_deal_type
,start_tx.orientation_buysell
,start_tx.base_ccy
,start_tx.base_ccy_amt
,start_tx.secondary_ccy
,start_tx.secondary_ccy_amt
,start_tx.MATURITY_DT
,start_tx.TRADE_RT
,start_tx.FORWARD_PTS
,start_tx.CORPORATE_PIPS
,start_tx.DEAL_OWNER_INITIALS
,start_tx.CORPORATE_DEALER
,start_tx.PROFIT_CENTER_CD
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,start_tx.counterparty_nm
,start_tx.counterparty_number
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
FROM
(SELECT * FROM fx_transactions WHERE gmt_conv_entered_dt_ts >= TO_DATE('20-Nov-2013 4:00:23 AM','DD-Mon-YYYY HH:MI:SS AM')) start_tx
,(SELECT * FROM fx_transactions WHERE gmt_conv_entered_dt_ts <= TO_DATE('20-Nov-2013 4:59:59 PM','DD-Mon-YYYY HH:MI:SS AM')) end_tx WHERE
NVL(start_tx.corporate_dealer,'nullX') = NVL(end_tx.corporate_dealer,'nullX') AND
start_tx.COUNTERPARTY_NM = end_tx.COUNTERPARTY_NM AND
start_tx.COUNTERPARTY_NUMBER = end_tx.COUNTERPARTY_NUMBER AND
start_tx.fx_deal_type = end_tx.fx_deal_type AND
start_tx.BASE_CCY = end_tx.BASE_CCY AND
start_tx.SECONDARY_CCY = end_tx.SECONDARY_CCY AND
start_tx.ORIENTATION_BUYSELL != end_tx.ORIENTATION_BUYSELL
AND start_tx.fx_tran_id = 1855303
) A
LEFT OUTER JOIN
(SELECT
start_tx.fx_tran_id START_FX_TRAN_ID
,end_tx.fx_tran_id end_fx_tran_id
,start_tx.entered_dt_ts
,USER
,start_tx.trade_dt
,start_tx.deal_number
,start_tx.fx_deal_type
,start_tx.orientation_buysell
,start_tx.base_ccy
,start_tx.base_ccy_amt
,start_tx.secondary_ccy
,start_tx.secondary_ccy_amt
,start_tx.MATURITY_DT
,start_tx.TRADE_RT
,start_tx.FORWARD_PTS
,start_tx.CORPORATE_PIPS
,start_tx.DEAL_OWNER_INITIALS
,start_tx.CORPORATE_DEALER
,start_tx.PROFIT_CENTER_CD
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,start_tx.counterparty_nm
,start_tx.counterparty_number
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
FROM
(SELECT * FROM fx_transactions WHERE gmt_conv_entered_dt_ts >= TO_DATE('20-Nov-2013 4:00:23 AM','DD-Mon-YYYY HH:MI:SS AM')) start_tx
,(SELECT * FROM fx_transactions WHERE gmt_conv_entered_dt_ts <= TO_DATE('20-Nov-2013 4:59:59 PM','DD-Mon-YYYY HH:MI:SS AM')) end_tx
WHERE
NVL(start_tx.corporate_dealer,'nullX') = NVL(end_tx.corporate_dealer,'nullX') AND
start_tx.COUNTERPARTY_NM = end_tx.COUNTERPARTY_NM AND
start_tx.COUNTERPARTY_NUMBER = end_tx.COUNTERPARTY_NUMBER AND
start_tx.fx_deal_type = end_tx.fx_deal_type AND
start_tx.BASE_CCY = end_tx.BASE_CCY AND
start_tx.SECONDARY_CCY = end_tx.SECONDARY_CCY AND
start_tx.ORIENTATION_BUYSELL != end_tx.ORIENTATION_BUYSELL
AND
(start_tx.base_ccy_amt = end_tx.base_ccy_amt
OR
start_tx.secondary_ccy_amt = end_tx.secondary_ccy_amt)
AND start_tx.fx_tran_id = 1855303
) B
ON (A.START_FX_TRAN_ID=B.START_FX_TRAN_ID AND A.END_FX_TRAN_ID=B.END_FX_TRAN_ID)
LEFT OUTER JOIN
(SELECT
start_tx.fx_tran_id START_FX_TRAN_ID
,end_tx.fx_tran_id end_fx_tran_id
,start_tx.entered_dt_ts
,USER
,start_tx.trade_dt
,start_tx.deal_number
,start_tx.fx_deal_type
,start_tx.orientation_buysell
,start_tx.base_ccy
,start_tx.base_ccy_amt
,start_tx.secondary_ccy
,start_tx.secondary_ccy_amt
,start_tx.MATURITY_DT
,start_tx.TRADE_RT
,start_tx.FORWARD_PTS
,start_tx.CORPORATE_PIPS
,start_tx.DEAL_OWNER_INITIALS
,start_tx.CORPORATE_DEALER
,start_tx.PROFIT_CENTER_CD
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,start_tx.counterparty_nm
,start_tx.counterparty_number
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
FROM
(SELECT * FROM fx_transactions WHERE gmt_conv_entered_dt_ts >= TO_DATE('20-Nov-2013 4:00:23 AM','DD-Mon-YYYY HH:MI:SS AM')) start_tx
,(SELECT * FROM fx_transactions WHERE gmt_conv_entered_dt_ts <= TO_DATE('20-Nov-2013 4:59:59 PM','DD-Mon-YYYY HH:MI:SS AM')) end_tx
WHERE
NVL(start_tx.corporate_dealer,'nullX')= NVL(end_tx.corporate_dealer,'nullX') AND
start_tx.COUNTERPARTY_NM = end_tx.COUNTERPARTY_NM AND
start_tx.COUNTERPARTY_NUMBER = end_tx.COUNTERPARTY_NUMBER AND
start_tx.fx_deal_type = end_tx.fx_deal_type AND
start_tx.BASE_CCY = end_tx.BASE_CCY AND
start_tx.SECONDARY_CCY = end_tx.SECONDARY_CCY AND
start_tx.ORIENTATION_BUYSELL != end_tx.ORIENTATION_BUYSELL
AND
end_tx.base_ccy_amt BETWEEN (start_tx.base_ccy_amt - (start_tx.base_ccy_amt * :perc_dev/100)) AND (start_tx.base_ccy_amt + (start_tx.base_ccy_amt * :perc_dev/100))
OR
end_tx.secondary_ccy_amt BETWEEN (start_tx.secondary_ccy_amt - (start_tx.secondary_ccy_amt*:perc_dev/100) ) AND (start_tx.secondary_ccy_amt + (start_tx.secondary_ccy_amt*:perc_dev/100))
AND start_tx.fx_tran_id = 1855303
) C
ON (A.START_FX_TRAN_ID=C.START_FX_TRAN_ID AND A.END_FX_TRAN_ID=C.END_FX_TRAN_ID)
GROUP BY
A.entered_dt_ts
,USER
,A.trade_dt
,A.deal_number
,A.fx_deal_type
,A.orientation_buysell
,A.base_ccy
,A.base_ccy_amt
,A.secondary_ccy
,A.secondary_ccy_amt
,A.MATURITY_DT
,A.TRADE_RT
,A.FORWARD_PTS
,A.CORPORATE_PIPS
,A.DEAL_OWNER_INITIALS
,A.CORPORATE_DEALER
,A.PROFIT_CENTER_CD
,A.counterparty_nm
,A.counterparty_number
Sanjeev, Thanks for your precious time.
It works now but a.user didn't work well, i have given an alias name for user in A inline view and then used alias name in select and group by clause.
Similar Messages
-
SR_ Extended Classic Scenario : Request your help please
Hi Guru's,
We are implementing the EXTENDED CLASSIC SCENARIO in our project. kindly request your help.
in our project the SRM box is : G3OSBSR102.
R/3 backend Box is : RCHSBR3142.
Now when i create a shopping cart it should create the Purchase order In SRM( G3OSBSR102) and also copy the created purcahse order in teh backend system : RCHSBR3142.
The issue here is which Logical system should be populated in the field at item level when creating the shopping cart :BE_LOG_SYSTEM.
1) In this field: BE_LOG_SYSTEM.
If i populate the SRM local: G3OSBSR102., then it will consider the Business object type as : BUS2201and creates the local Po but while transfering this local created document(PO) to R/3 system is loosing the Logical system at the item level of the PO.
If i populate this field at the item level via DEBUGG mode then system is sucessfull in transferring the document to R/3.
2) In this field: BE_LOG_SYSTEM.
If i populate the SRM local: RCHSBR3142, then it will consider the Business object type as : BUS2012 and creates the purchase order in R/3 system and will not create teh local purchase order.
Kindly request your help for any further settings if i did miss.Appreciate your help in this regards.
Many Thanks,
Prasad NN.Hi ,
Go to SPRO
There is a node - Activate Extended Classic scenario
Do the config.
Regards
G.Ganesh Kumar -
R12 Payable Invoice Approval - Issue - Requesting URGENT help please
Hello,
This is on r12.1
For some reason all invoices entered on Invoice workbench goes into approval mode "Not required" after we check the "initate approval" checkbox on the Action button.
This is happening irrespective of any supplier, amount we use.
We have no customizations in AME and APINVAPR workflow.
The system options approval tab has check box "Use Workflow for Invoice Approva" CHECKED.
The checkbox "Force Invoice Approval" is UNCHECKED.
We have run out of options and the problem is still persistent.
Please advise. How can we have invoices go through approval and not have it "Not Required" all the time.
Thanks,
DarshHi Darsh,
can you review the AME configuration on the approval limits and the people assigned in the approval groups.
Also, is this is the first time you are using this feature ? If not, was it working fine before ....?
Also please check the below reference:
11i: APXINWKB - Invoice Approval Status Is Incorrectly Changed To Not Required when Approval is Initiated if Approval Group Contains FND Users [ID 331214.1]
Regards,
Ivruksha -
IMovie Newbie requests your help please!
Newbie Questions
I am a 3D artist so I render my images from the 3D software rather than shooting on video. I have rendered out my animation as images dog01.bmp, dog2.bmp, dog3.bmp etc. You get the idea! Well there are 271 .bmp images each 1mb in size = 271 MB. I tried importing them into iMovie and it took 2 minutes to import all of them.
Q1. I read the "iMovie Getting Started .pdf" but it wasn't clear as to what to do with a collection of images. What do I do once I have loaded all 271 images of my images into the "Clips" section of iMovie?
Q2. I noticed my images have a black bar above and below them. What can I do to fix this?
Image Type: .BMP
Image Size: 800 x 450 pixels (Is this size too big for imovie?)
PPI: 72
Frame File Size: 1 MB (Is this size too big for imovie?)
No. of Frames: 271
Total file size (272 images) = 280 MB
Q3. I can render my 3D animation in the following formats so can you tell me what formats are best?
-Animation
-Apple Intermediate Codec
-Apple Pixlet Video
-Apple VC H.263
-BMP
-Cinepak
-Component Video
-DV-PAL
-DV/DVCPRO-NTSC
-DVCPRO-PAL
-DVCPRO50-NTSC
-DVCPRO-PAL
-Graphics
-H.261
-H.263
-H.264
-JPEG 2000
-Motion JPEG A
-Motion JPEG B
-MPEG-4 Video
-None
-Photo-JPEG
-Planar RGB
-PNG
Your help is appreciated!a) you do yourself a favour, and choose in iM's prefs "import to timeline"... your clips go direct to timline, no hand-dropping of 271 (pheww!!) pics needed
b) dropping a folder of pics onto QTpro allows the conversion into a dv stream
c) if you anim app allows export as "video" choose "dv PAL/NTSC" (appropiate video standard in your country)
hope that helps... -
I am trying like **** to download itunes 10.6.3 (64 bit - Windows 7) and I keep getting "the installer was interrupted before the requested operations for iTunes could be completed. Your systems has not been modified." I NEED HELP, PLEASE!
I got it figured out myself... yaaaaay for me!
-
I can no longer access Bejeweled Blitz through facebook. I get the message, "your browser sent a request that this server could not understand. Size of a request header field exceeds server limit". I can access Bejeweled through FB using my husband's log in so to me that suggests the problem is with my log in. Help please.
Contact FB or use another browser.
-
I am trying to change country to US for iTunes on my iPad. After I select US in account setting and press NEXT I get message: "Cannot connect to iTunes" and then "The iTunes Store could not process your request. Please true again later". Help please.
downloaded the updated iTunes and that did nothing. I then went through the form about $ very VERY carefully and discovered one field left blank. Once that was filled in, everything worked and I now have my free app.
-
Help PLEASE!
Let me explain my situation:
- iTunes store has been working fine on all computers for the past few years.
- Modem gets struck by lightning last Mon.
- Get a new Netgear modem yesterday.
- Internet all working fine. Can browse, download etc. in browser (Mac App store, and iDevices App Stores all working fine, too)
- Cannot connect to iTunes store. Get error "We could not complete your iTunes Store request. The network connection was reset".
- I Get the same error on 2 MacBooks, but i can browse the store on my 2 Win7 PC's.
- I managed to connect and browse on my one MacBook using a 3G modem, but still no luck with the ADSL connection.
- I have tried connecting via wired (ethernet) connection to the modem. Still no luck.
- I have had this problem on iTunes 10.2, 10.4, 10.5 Beta, and 10.5.
Does anyone have any idea what is going on here? Any help and advice would be greatly appreciated!
Thanks!
George.
Modem Model no.: DGN 2200with everyone downloading the update, the servers are probably bogged down with requests, probably just wait it out and it will start to download and get you back up and runnin
dante -
Please could you help me with a query?
Please could someone help with the following query? I have 3 tables:
Books
BookCode........Name
1..................... Book1
2..................... Book2
3..................... Book3
4 ..................... Book4
5 .....................Book5
Categories
Catname..................... BookCode
Sport .....................1
Sport .....................2
Sport .....................3
News .....................2
News .....................3
News .....................4
NonFict .....................2
NonFict .....................5
Modern .....................1
Modern .....................2
Modern .....................5
Old .....................3
Old .....................4
Stock
CatName .....................Stocked
Sport .....................1
News .....................1
NonFict .....................NULL
Modern .....................NULL
Old .....................1
I need a query that selects all books.name where ALL of the book's related category names have stock records of NULL. So if the book is in 3 categories, all those categories need to be NULL in the stock table for a value to be returned.
Thanks very much.And here's another way using a set operator:
SQL> select b.name
2 ,count(*) cat_total
3 from books b
4 ,categories c
5 ,stock s
6 where b.bookcode = c.bookcode
7 and c.catname = s.catname
8 group by b.name
9 intersect
10 select b.name
11 ,count(*) cat_total
12 from books b
13 ,categories c
14 ,stock s
15 where b.bookcode = c.bookcode
16 and c.catname = s.catname
17 and s.stocked is null
18 group by b.name
19 ;
NAME CAT_TOTAL
Book5 2 -
Please help to modifiy this query for better performance
Please help to rewrite this query for better performance. This is taking long time to execute.
Table t_t_bil_bil_cycle_change contains 1200000 rows and table t_acctnumberTab countains 200000 rows.
I have created index on ACCOUNT_ID
Query is shown below
update rbabu.t_t_bil_bil_cycle_change a
set account_number =
( select distinct b.account_number
from rbabu.t_acctnumberTab b
where a.account_id = b.account_id
Table structure is shown below
SQL> DESC t_acctnumberTab;
Name Type Nullable Default Comments
ACCOUNT_ID NUMBER(10)
ACCOUNT_NUMBER VARCHAR2(24)
SQL> DESC t_t_bil_bil_cycle_change;
Name Type Nullable Default Comments
ACCOUNT_ID NUMBER(10)
ACCOUNT_NUMBER VARCHAR2(24) YIshan's solution is good. I would avoid updating rows which already have the right value - it's a waste of time.
You should have a UNIQUE or PRIMARY KEY constraint on t_acctnumberTab.account_id
merge rbabu.t_t_bil_bil_cycle_change a
using
( select distinct account_number, account_id
from rbabu.t_acctnumberTab
) t
on ( a.account_id = b.account_id
and decode(a.account_number, b.account_number, 0, 1) = 1
when matched then
update set a.account_number = b.account_number -
Could you please help me make this query less complicated
could you please help me make this query less complicated
select t1.R_OBJECT_ID
from dm_relation_sp a, ddt_resolution_sp t1
where a.parent_id = '0900000283560456' -----------ID
and a.child_id = t1.R_OBJECT_ID
union all
select t3.R_OBJECT_ID
from ddt_resolution_sp t3
where t3.R_OBJECT_ID in (select t2.child_id
from dm_relation_sp t2
where t2.parent_id in (select a.child_id
from asud_fsk.dm_relation_sp a, asud_fsk.ddt_resolution_sp t1
where a.parent_id = '0900000283560456' -----------ID
and a.child_id = t1.R_OBJECT_ID))
union all
select t4.R_OBJECT_ID
from ddt_resolution_sp t4
where t4.R_OBJECT_ID in(
select t3.child_id from dm_relation_sp t3
where t3.parent_id in (
select t2.child_id
from asud_fsk.dm_relation_sp t2
where t2.parent_id in (select a.child_id
from asud_fsk.dm_relation_sp a, asud_fsk.ddt_resolution_sp t1
where a.parent_id = '0900000283560456' -----------ID
and a.child_id = t1.R_OBJECT_ID))
and t3.relation_name = 'RESOLUTION_RELATION')
union all
select t5.R_OBJECT_ID
from ddt_resolution_sp t5
where t5.R_OBJECT_ID in
(select t4.child_id
from dm_relation_sp t4
where t4.parent_id in(
select t3.child_id from dm_relation_sp t3
where t3.parent_id in (
select t2.child_id
from asud_fsk.dm_relation_sp t2
where t2.parent_id in (select a.child_id
from asud_fsk.dm_relation_sp a, asud_fsk.ddt_resolution_sp t1
where a.parent_id = '0900000283560456' -----------ID
and a.child_id = t1.R_OBJECT_ID))
and t3.relation_name = 'RESOLUTION_RELATION')
and t4.relation_name = 'RESOLUTION_RELATION')
Edited by: user13025450 on 29.04.2010 16:23Hi,
Welcome to the forum! You'll find that there are many qualified people (such as Tubby) willing to help you. Will you do what you can to help them? In order to simplify the query you posted,someone will first have to understand what it does, what the tables that it uses are like, and what tools you have to work with (that is, what version of Oracle, and any other software you are using). To actually test their ideas, people will need versions of your tables.
Many people, if they spent enough time, might be able to figure out roughly what you are doing, make some tables themselves and test a solution. You can help with all of that. I assume you already know what the appliction is, and what this particular query is supposed to do: you don't have to figure out any of that, you just have to say it. You know what all your tables are, what the datatypes of all the columns are, and what kinds of data are in the tables: you don't have to guess at any of that.
Describe what you're doing. Think about it: how do we know that
SELECT NULL
FROM dual;doesn't do what you want?
Post CREATE TABLE and INSERT statements for a little sample data.
Post the results that this query is supposed to produce from those results. (Is it producing the right output now? Then it should be easy to post the correct results.)
Describe, as well as you can, how the present query is doing it.
Format your existing code, so it's easy to see what the different branches of the UNION are, and what the main clauses are in each one.
When posting formatted text (code or results) type these 6 characters
\(all small letters, inside curly brackets) before and after each formatted section, to keep this site from compressing the spaces.
Say what versions of Oracle (e.g. 10.2.0.3.0) and any other relevant software you are using.
I know it's a lot of work, but it really helps. You can do it as well (probably better) than anyone else, and if you're unwilling to do it, why should anyone else be willing? -
I have changed my apple id on itunes but can't change it on ipad. My old id asks for login but doesn't recognize password or birthday. Help please.
Hi on iPad itunes bottom of page Sign out then sign back in with new details. Cheers Brian
-
Hi
I have an issue in InDesign CS6. It has been happening the last couple of days now.
When i export to pdf. regardless of quality instead of being saved as a pdf it is being sent to Photoshop which then saves the file as a psd...
I have updated InDesign to the latest CS6 update which helped the issue yesterday but today the same problem is back. Help please what could be the problem and how do I fix it?
Any advice is very appreciated.
Thanks
SamExportPDF is a subscription service for exporting PDF files into Word and Excel, from Adobe Reader. I suspect you need the InDesign forum, as InDesign is the product here.
-
Help tune this monster query please
Hi, I have a query that runs for a long time. Its a system generated query but I need to improve its performance. I have enough indexes on the tables. Here is the query, its explain plan and the tkprof:
The QUERY
SELECT FD.FORM_ID, FD.FIELD_NAME, FD.FIELD_TEXT, FD.OPTION_TEXT, FD.OPTION_TYPE, FD.FIELD_ORDER, FD.LIST_ORDER,
FD.MULTIPLE_ANSWER, FD.FIELD_INSTANCE, NVL(AD.APPS,0) APPS
FROM (
SELECT FIELD_NAME, FIELD_VALUE, INSTANCE, COUNT(0) APPS
FROM APPLICATION_DATA AD
WHERE APPLICATION_ID IN (
SELECT A.APPLICATION_ID
FROM APPLICATIONS A
WHERE A.DELETED = 0 AND DECODE(A.TRAY,'Incomplete','Incomplete','Complete') = 'Complete' AND A.JOB_ID IN (
SELECT JOB_ID
FROM JOBS J
WHERE J.ACCOUNT_ID IN (
SELECT ACCOUNT_ID
FROM AGENCY_ACCOUNTS CONNECT BY ACCOUNT_ID = PRIOR AGENCY_ID START WITH ACCOUNT_ID = J.ACCOUNT_ID ) ) AND A.ACCOUNT_ID IN (
SELECT ACCOUNT_ID
FROM AGENCY_ACCOUNTS CONNECT BY ACCOUNT_ID = PRIOR AGENCY_ID START WITH ACCOUNT_ID = 113346 ) AND FIELD_NAME IN (
SELECT FIELD_NAME FROM APPLICATION_FIELDS
WHERE FIELD_TYPE IN ('Checkbox','Radio','Select','SelectM', 'RadioHoriz','RadioPara') ) )
GROUP BY FIELD_NAME, FIELD_VALUE, INSTANCE ) AD, (
SELECT AF.FORM_ID, AF.FIELD_NAME, AF.FIELD_TEXT, AFO.OPTION_TEXT, AFO.OPTION_TYPE, AF.FIELD_ORDER, AFO.LIST_ORDER,
DECODE(AF.FIELD_TYPE,'Checkbox',1,'SelectM',1,0) MULTIPLE_ANSWER, AF.FIELD_INSTANCE
FROM APPLICATION_FIELDS AF, APPLICATION_FIELD_OPTIONS AFO, JOB_FORMS JF
WHERE AFO.FIELD_NAME = AF.FIELD_NAME AND AFO.FORM_ID = AF.FORM_ID AND JF.FORM_ID = AF.FORM_ID AND AF.FIELD_TYPE IN
('Checkbox','Radio','Select','SelectM', 'RadioHoriz','RadioPara') AND JF.JOB_ID IN (
SELECT JOB_ID
FROM JOBS J
WHERE J.ACCOUNT_ID IN (
SELECT ACCOUNT_ID
FROM AGENCY_ACCOUNTS CONNECT BY ACCOUNT_ID = PRIOR AGENCY_ID START WITH ACCOUNT_ID = 113346 ) ) ) FD
WHERE AD.FIELD_NAME = FD.FIELD_NAME AND AD.FIELD_VALUE = FD.OPTION_TEXT AND AD.INSTANCE = FD.FIELD_INSTANCE
GROUP BY FD.FORM_ID, FD.FIELD_NAME, FD.FIELD_TEXT, FD.OPTION_TEXT, FD.OPTION_TYPE, FD.FIELD_ORDER, FD.LIST_ORDER,
FD.MULTIPLE_ANSWER, FD.FIELD_INSTANCE, NVL(AD.APPS,0)
ORDER BY FD.FORM_ID ASC, FD.FIELD_ORDER ASCEXPLAIN PLAN OUTPUT
PLAN_TABLE_OUTPUT
Plan hash value: 3519364953
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 120 | 763 (2)| 00:00:10 |
| 1 | SORT GROUP BY | | 1 | 120 | 763 (2)| 00:00:10 |
| 2 | VIEW | | 1 | 120 | 762 (1)| 00:00:10 |
| 3 | HASH GROUP BY | | 1 | 220 | 762 (1)| 00:00:10 |
|* 4 | FILTER | | | | | |
|* 5 | TABLE ACCESS BY INDEX ROWID | APPLICATION_DATA | 1 | 45 | 6 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
| 6 | NESTED LOOPS | | 40 | 8800 | 486 (2)| 00:00:06 |
|* 7 | HASH JOIN | | 60 | 10500 | 125 (4)| 00:00:02 |
|* 8 | HASH JOIN | | 60 | 7320 | 53 (6)| 00:00:01 |
| 9 | NESTED LOOPS | | 11 | 297 | 9 (12)| 00:00:01 |
| 10 | VIEW | VW_NSO_3 | 3 | 15 | 5 (0)| 00:00:01 |
| 11 | HASH UNIQUE | | 3 | 69 | | |
| 12 | TABLE ACCESS BY INDEX ROWID | JOBS | 3 | 30 | 3 (0)| 00:00:01 |
| 13 | NESTED LOOPS | | 3 | 69 | 5 (0)| 00:00:01 |
| 14 | VIEW | VW_NSO_1 | 1 | 13 | 2 (0)| 00:00:01 |
|* 15 | CONNECT BY WITH FILTERING | | | | | |
| 16 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | | | | |
PLAN_TABLE_OUTPUT
|* 17 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | 5 | 1 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | | | | |
| 19 | BUFFER SORT | | | | | |
| 20 | CONNECT BY PUMP | | | | | |
| 21 | TABLE ACCESS BY INDEX ROWID| AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
|* 22 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | | 1 (0)| 00:00:01 |
|* 23 | TABLE ACCESS FULL | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
|* 24 | INDEX RANGE SCAN | JOBS_ACCOUNT_ID | 3 | | 1 (0)| 00:00:01 |
|* 25 | INDEX RANGE SCAN | JOBS_FORMS_JID_FID | 4 | 88 | 1 (0)| 00:00:01 |
|* 26 | TABLE ACCESS FULL | APPLICATION_FIELDS | 3579 | 332K| 43 (3)| 00:00:01 |
| 27 | TABLE ACCESS FULL | APPLICATION_FIELD_OPTIONS | 32897 | 1702K| 72 (3)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 28 | INDEX RANGE SCAN | IDX$$_B8D40001 | 4 | | 3 (0)| 00:00:01 |
|* 29 | FILTER | | | | | |
| 30 | MERGE JOIN CARTESIAN | | 3 | 225 | 11 (0)| 00:00:01 |
| 31 | NESTED LOOPS | | 1 | 53 | 6 (0)| 00:00:01 |
| 32 | NESTED LOOPS | | 1 | 40 | 4 (0)| 00:00:01 |
|* 33 | TABLE ACCESS BY INDEX ROWID | APPLICATIONS | 1 | 30 | 3 (0)| 00:00:01 |
|* 34 | INDEX UNIQUE SCAN | APPS_APP_ID | 1 | | 2 (0)| 00:00:01 |
| 35 | TABLE ACCESS BY INDEX ROWID | JOBS | 18780 | 183K| 1 (0)| 00:00:01 |
|* 36 | INDEX UNIQUE SCAN | JOBS_JOB_ID | 1 | | 0 (0)| 00:00:01 |
|* 37 | VIEW | VW_NSO_2 | 1 | 13 | 2 (0)| 00:00:01 |
|* 38 | CONNECT BY WITH FILTERING | | | | | |
PLAN_TABLE_OUTPUT
| 39 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | | | | |
|* 40 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | 5 | 1 (0)| 00:00:01 |
| 41 | NESTED LOOPS | | | | | |
| 42 | BUFFER SORT | | | | | |
| 43 | CONNECT BY PUMP | | | | | |
| 44 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
|* 45 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | | 1 (0)| 00:00:01 |
|* 46 | TABLE ACCESS FULL | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
| 47 | BUFFER SORT | | 3 | 66 | 9 (0)| 00:00:01 |
| 48 | INLIST ITERATOR | | | | | |
|* 49 | INDEX RANGE SCAN | IDX$$_91CA0001 | 3 | 66 | 5 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 50 | FILTER | | | | | |
|* 51 | CONNECT BY WITH FILTERING | | | | | |
| 52 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | | | | |
|* 53 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | 5 | 1 (0)| 00:00:01 |
| 54 | NESTED LOOPS | | | | | |
| 55 | BUFFER SORT | | | | | |
| 56 | CONNECT BY PUMP | | | | | |
| 57 | TABLE ACCESS BY INDEX ROWID | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
|* 58 | INDEX UNIQUE SCAN | AGENCY_ACCOUNTS_ACCOUNT_ID | 1 | | 1 (0)| 00:00:01 |
|* 59 | TABLE ACCESS FULL | AGENCY_ACCOUNTS | 1 | 10 | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
4 - filter( EXISTS (SELECT 0 FROM "APPLICATIONS" "A","JOBS" "SYS_ALIAS_1", (SELECT "ACCOUNT_ID" "$nso_col_1"
FROM "AGENCY_ACCOUNTS" "AGENCY_ACCOUNTS" WHERE "ACCOUNT_ID"=NULL) "VW_NSO_2","APPLICATION_FIELDS"
"APPLICATION_FIELDS" WHERE EXISTS (SELECT 0 FROM "AGENCY_ACCOUNTS" "AGENCY_ACCOUNTS" WHERE "ACCOUNT_ID"=NULL AND
("ACCOUNT_ID"=:B1)) AND ("FIELD_TYPE"='Checkbox' OR "FIELD_TYPE"='Radio' OR "FIELD_TYPE"='RadioHoriz' OR
"FIELD_TYPE"='RadioPara' OR "FIELD_TYPE"='Select' OR "FIELD_TYPE"='SelectM') AND "FIELD_NAME"=:B2 AND
"A"."ACCOUNT_ID"="$nso_col_1" AND "A"."JOB_ID"="JOB_ID" AND "A"."APPLICATION_ID"=:B3 AND
DECODE("A"."TRAY",'Incomplete','Incomplete','Complete')='Complete' AND "A"."DELETED"=0))
PLAN_TABLE_OUTPUT
5 - filter("FIELD_NAME"="AF"."FIELD_NAME" AND "INSTANCE"="AF"."FIELD_INSTANCE")
7 - access("AFO"."FIELD_NAME"="AF"."FIELD_NAME" AND "AFO"."FORM_ID"="AF"."FORM_ID")
8 - access("JF"."FORM_ID"="AF"."FORM_ID")
15 - filter("ACCOUNT_ID"=113346)
17 - access("ACCOUNT_ID"=113346)
22 - access("ACCOUNT_ID"=NULL)
23 - access("ACCOUNT_ID"=NULL)
24 - access("J"."ACCOUNT_ID"="$nso_col_1")
25 - access("JF"."JOB_ID"="$nso_col_1")
26 - filter("AF"."FIELD_TYPE"='Checkbox' OR "AF"."FIELD_TYPE"='Radio' OR "AF"."FIELD_TYPE"='RadioHoriz' OR
"AF"."FIELD_TYPE"='RadioPara' OR "AF"."FIELD_TYPE"='Select' OR "AF"."FIELD_TYPE"='SelectM')
PLAN_TABLE_OUTPUT FOR THE QUERY
28 - access("FIELD_VALUE"="AFO"."OPTION_TEXT")
29 - filter( EXISTS (SELECT 0 FROM "AGENCY_ACCOUNTS" "AGENCY_ACCOUNTS" WHERE "ACCOUNT_ID"=NULL AND
("ACCOUNT_ID"=:B1)))
33 - filter(DECODE("A"."TRAY",'Incomplete','Incomplete','Complete')='Complete' AND "A"."DELETED"=0)
34 - access("A"."APPLICATION_ID"=:B1)
36 - access("A"."JOB_ID"="JOB_ID")
37 - filter("A"."ACCOUNT_ID"="$nso_col_1")
38 - filter("ACCOUNT_ID"=113346)
40 - access("ACCOUNT_ID"=113346)
45 - access("ACCOUNT_ID"=NULL)
46 - access("ACCOUNT_ID"=NULL)
PLAN_TABLE_OUTPUT
49 - access("FIELD_NAME"=:B1 AND ("FIELD_TYPE"='Checkbox' OR "FIELD_TYPE"='Radio' OR "FIELD_TYPE"='RadioHoriz'
OR "FIELD_TYPE"='RadioPara' OR "FIELD_TYPE"='Select' OR "FIELD_TYPE"='SelectM'))
50 - filter("ACCOUNT_ID"=:B1)
51 - filter("ACCOUNT_ID"=:B1)
53 - access("ACCOUNT_ID"=:B1)
58 - access("ACCOUNT_ID"=NULL)
59 - access("ACCOUNT_ID"=NULL)
106 rows selected.TKPROF FOR THE QUERY
call count cpu elapsed disk query current rows
Parse 1 0.05 0.08 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 17 1040.45 1018.36 0 48926569 0 229
total 19 1040.50 1018.44 0 48926569 0 229
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 68
Rows Row Source Operation
229 SORT GROUP BY (cr=48926569 pr=0 pw=0 time=1018362160 us)
454 VIEW (cr=48926569 pr=0 pw=0 time=1018361382 us)
454 HASH GROUP BY (cr=48926569 pr=0 pw=0 time=1018360468 us)
185302 FILTER (cr=48926569 pr=0 pw=0 time=877249113 us)
1440799 TABLE ACCESS BY INDEX ROWID APPLICATION_DATA (cr=11309333 pr=0 pw=0 time=213262026 us)
82907114 NESTED LOOPS (cr=174051 pr=0 pw=0 time=166906535 us)
1790 HASH JOIN (cr=625 pr=0 pw=0 time=41617 us)
121 HASH JOIN (cr=310 pr=0 pw=0 time=11263 us)
39 NESTED LOOPS (cr=121 pr=0 pw=0 time=6894 us)
44 VIEW VW_NSO_3 (cr=75 pr=0 pw=0 time=6424 us)
44 HASH UNIQUE (cr=75 pr=0 pw=0 time=6333 us)
44 TABLE ACCESS BY INDEX ROWID JOBS (cr=75 pr=0 pw=0 time=3090 us)
52 NESTED LOOPS (cr=32 pr=0 pw=0 time=58177 us)
7 VIEW VW_NSO_1 (cr=23 pr=0 pw=0 time=1242 us)
7 CONNECT BY WITH FILTERING (cr=23 pr=0 pw=0 time=1212 us)
1 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=3 pr=0 pw=0 time=185 us)
1 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=2 pr=0 pw=0 time=100 us)(object id 60086)
6 NESTED LOOPS (cr=20 pr=0 pw=0 time=590 us)
7 BUFFER SORT (cr=0 pr=0 pw=0 time=248 us)
7 CONNECT BY PUMP (cr=0 pr=0 pw=0 time=95 us)
6 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=20 pr=0 pw=0 time=314 us)
6 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=14 pr=0 pw=0 time=188 us)(object id 60086)
0 TABLE ACCESS FULL AGENCY_ACCOUNTS (cr=0 pr=0 pw=0 time=0 us)
44 INDEX RANGE SCAN JOBS_ACCOUNT_ID (cr=9 pr=0 pw=0 time=280 us)(object id 60253)
39 INDEX RANGE SCAN JOBS_FORMS_JID_FID (cr=46 pr=0 pw=0 time=968 us)(object id 60299)
3579 TABLE ACCESS FULL APPLICATION_FIELDS (cr=189 pr=0 pw=0 time=14469 us)
32524 TABLE ACCESS FULL APPLICATION_FIELD_OPTIONS (cr=315 pr=0 pw=0 time=32629 us)
82905323 INDEX RANGE SCAN IDX$$_B8D40001 (cr=173426 pr=0 pw=0 time=83870105 us)(object id 60121)
185297 FILTER (cr=37617236 pr=0 pw=0 time=749052070 us)
185297 MERGE JOIN CARTESIAN (cr=37617196 pr=0 pw=0 time=742583363 us)
185297 NESTED LOOPS (cr=35393366 pr=0 pw=0 time=706772617 us)
1139675 NESTED LOOPS (cr=9180841 pr=0 pw=0 time=84949686 us)
1140164 TABLE ACCESS BY INDEX ROWID APPLICATIONS (cr=5760834 pr=0 pw=0 time=46774108 us)
1440060 INDEX UNIQUE SCAN APPS_APP_ID (cr=4320774 pr=0 pw=0 time=24380604 us)(object id 60107)
1139675 TABLE ACCESS BY INDEX ROWID JOBS (cr=3420007 pr=0 pw=0 time=28126171 us)
1139675 INDEX UNIQUE SCAN JOBS_JOB_ID (cr=2280328 pr=0 pw=0 time=14563524 us)(object id 60252)
185297 VIEW VW_NSO_2 (cr=26212525 pr=0 pw=0 time=613602445 us)
6866175 CONNECT BY WITH FILTERING (cr=26212525 pr=0 pw=0 time=614183170 us)
1139675 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=3419025 pr=0 pw=0 time=24323520 us)
1139675 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=2279350 pr=0 pw=0 time=13905212 us)(object id 60086)
6838050 NESTED LOOPS (cr=22793500 pr=0 pw=0 time=388173853 us)
7977725 BUFFER SORT (cr=0 pr=0 pw=0 time=178812411 us)
7977725 CONNECT BY PUMP (cr=0 pr=0 pw=0 time=57522094 us)
6838050 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=22793500 pr=0 pw=0 time=179425469 us)
6838050 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=15955450 pr=0 pw=0 time=113988543 us)(object id 60086)
0 TABLE ACCESS FULL AGENCY_ACCOUNTS (cr=0 pr=0 pw=0 time=0 us)
185297 BUFFER SORT (cr=2223830 pr=0 pw=0 time=24721936 us)
1208625 INLIST ITERATOR (cr=2223830 pr=0 pw=0 time=26470412 us)
1208625 INDEX RANGE SCAN IDX$$_91CA0001 (cr=2223830 pr=0 pw=0 time=18174073 us)(object id 60129)
2 FILTER (cr=40 pr=0 pw=0 time=1292 us)
2 CONNECT BY WITH FILTERING (cr=40 pr=0 pw=0 time=1276 us)
2 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=6 pr=0 pw=0 time=86 us)
2 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=4 pr=0 pw=0 time=46 us)(object id 60086)
10 NESTED LOOPS (cr=34 pr=0 pw=0 time=791 us)
12 BUFFER SORT (cr=0 pr=0 pw=0 time=369 us)
12 CONNECT BY PUMP (cr=0 pr=0 pw=0 time=127 us)
10 TABLE ACCESS BY INDEX ROWID AGENCY_ACCOUNTS (cr=34 pr=0 pw=0 time=376 us)
10 INDEX UNIQUE SCAN AGENCY_ACCOUNTS_ACCOUNT_ID (cr=24 pr=0 pw=0 time=242 us)(object id 60086)
0 TABLE ACCESS FULL AGENCY_ACCOUNTS (cr=0 pr=0 pw=0 time=0 us)Any help in tuning this query to run faster will be highly appreciated. I also noticed merge join certesian on the tkprof and explain plan. Any idea in takling that will also be appreciated.
Cheers,
AdeIt's quite hard to tune a query without seeing the table structure and available indices as well as relationship between each other but I'll try.
In your sql which you've given the table alias AD, you have this filter criteria
AND FIELD_NAME IN (
SELECT FIELD_NAME
FROM APPLICATION_FIELDS
WHERE FIELD_TYPE IN ('Checkbox','Radio','Select','SelectM', 'RadioHoriz','RadioPara')
) </br>
My question is, is FIELD_NAME a column in the APPLICATION_DATA table? If it is, try moving this clause outside of the current sub-query it is in, i.e. one more level up. It looks like you put them inside the wrong level.
I would also try converting this <COL> IN <SUB-QUERY> to a join, if that wouldn't affect the no. of rows returned. I can't tell for sure since I dont know the relationship between your tables.
It looks to me like you're doing this
SELECT <col list>
FROM ( SELECT -- LEVEL 1
FROM APPLICATION_DATA AD
WHERE AD.APPLICAITON_ID IN ( -- LEVEL 2
SELECT
FROM APPLICATIONS A
WHERE A.JOB_ID IN (
<SUBQUERY>
AND A.ACCOUNT_ID IN (
<SUBQUERY>
AND FIELDNAME IN ( -- SHOULD BE INSIDE LEVEL1
<SUBQUERY>
) AD,
( SELECT ....
) FD
WHERE .... -
I have had to change my email address/Apple ID. My iPad recognises the new detail in iTunes and iCloud but when I go into iCloud through my MacBook Air, it requests a password for the old email account which I can no longer use. There is no Option to be able to change this email/ID detail as I cannot get further than the password request. Can anyone help please - this is driving me insane?!
Go to System Preferences and click Sign Out, select Delete at all the prompts, then sign back in with the changed ID? (Your iCloud data will disappear from your Mac when you sign out and choose Delete, but will still be in iCloud. Provided you are signing back into the same account your data will reappear on your Mac when you sign back in.)
Maybe you are looking for
-
Itunes unexpedly closes when i try to sync
I have an iphone and ipods. I have tried several times to sync each one and every time I get to step 2 or 3 out of 7 or 8 and then itunes "quits unexpedly" please help this is really frustrating! thank you!
-
Extracting XML values with namespace
Hi! I have a XML file:<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/styl.xsl"?> <wnio:Deklaracja xmlns:adr="http://crd.gov.pl/xm
-
What's the maximum RAM my Macbook Pro can support?
According to Apple's website, my Mac (MacBook Pro, 13-inch, late 2011) can support up to 8 GB of RAM (two cards of 4 GB each) as a max. Yet, in other websites (like Kingston's) and questions in Apple's Support Communities site itself I've seen that i
-
Top/Left Back Button in Settings does not work
When opening the Settings, it will present "navigate up" enabled. That is the wedge on the top/left next to the Firefox Icon in the Action Bar. ("actionBar.setDisplayHomeAsUpEnabled(true)") However, it does not work. Please implement the back-behavio
-
Re : Report Painter / Creating a link among 2 variations in Report Painter
Hi everyone, In my report painter, there are 2 variations which are 2 seperate fields of a table. I have a request which demands to link those variations to one to display as a hierarchy. For example : The variation 1 stands for the field of 'Company