Ora 00918 normalizing problem using cartesian product

I am using a cartesian product to normalise a table. Is there a better way of doing this to avoid the 00918 error?
Thanks in advance ...
select
/* select clause */
from
z_dvo_proj_milestone_summary t1,
z_dvo_proj_milestone_summary t2
where
/* where clause */
create or replace view z_dvo_proj_milestone_summary as
select
query1.projid
,query1.projname
,query1.projtype
,query1.projcode
,query1.report_month
,query1.report_year
,query1.SubProjID
,query1.DVONUM
,query1.measure_type
,query1.MEASURE
,hier.level0_vosa_prj_type
from
(select
score.project as projid
,srm.name as projname
,hier.level0_vosa_prj_type as projtype
,score.code as projcode
,score.report_month as report_month
,score.report_year as report_year
,CASE
when (subprojtab.subprojid = 1) then score.sub_project_1
when (subprojtab.subprojid = 2) then score.sub_project_2
End as SubProjID
,dvonumtab.dvonum as DVONUM
,typetab.measure_type as measure_Type
,CASE
WHEN (subprojtab.subprojid = 1) then
CASE
when typetab.measure_type = 'baseline' then
CASE
when (dvonumtab.dvonum = 1) then score.proj1_dvo1_baseline
when (dvonumtab.dvonum = 2) then score.proj1_dvo2_baseline
End
when typetab.measure_type = 'planned' then
CASE
when (dvonumtab.dvonum = 1) then score.proj1_dvo1_planned
when (dvonumtab.dvonum = 2) then score.proj1_dvo2_planned
End
End
WHEN (subprojtab.subprojid = 2) then
CASE
when typetab.measure_type = 'baseline' then
CASE
when (dvonumtab.dvonum = 1) then score.proj2_dvo1_baseline
when (dvonumtab.dvonum = 2) then score.proj2_dvo2_baseline
End
when typetab.measure_type = 'planned' then
CASE
when (dvonumtab.dvonum = 1) then score.proj2_dvo1_planned
when (dvonumtab.dvonum = 2) then score.proj2_dvo2_planned
End
End
End as MEASURE
from
ODF_CA_PROJSCORE score
left outer join
srm_projects srm on (srm.id = score.project)
left outer join
Z_PROJECT_HIERARCHY hier on (srm.id = hier.level0)
Join
(select 1 as subprojid from dual
union
select 2 as subprojid from dual) subprojtab on (1=1)
/* There will be 11 measures here eventually */
Join
(select 'baseline' as measure_type from dual
union
select 'planned' as measure_type from dual) typetab on (1=1)
Join
(select 1 as dvonum from dual
union
select 2 as dvonum from dual) dvonumtab on (1=1)
WHERE
(CASE
when (subprojtab.subprojid = 1) then score.sub_project_1
when (subprojtab.subprojid = 2) then score.sub_project_2
End) IS NOT NULL) query1
left outer join Z_PROJECT_HIERARCHY hier
on (query1.SubProjID = hier.level0)

I am using a cartesian product to normalise a table. Is there a better way of doing this to avoid the 00918 error?
Thanks in advance ...
select
/* select clause */
from
z_dvo_proj_milestone_summary t1,
z_dvo_proj_milestone_summary t2
where
/* where clause */
create or replace view z_dvo_proj_milestone_summary as
select
query1.projid
,query1.projname
,query1.projtype
,query1.projcode
,query1.report_month
,query1.report_year
,query1.SubProjID
,query1.DVONUM
,query1.measure_type
,query1.MEASURE
,hier.level0_vosa_prj_type
from
(select
score.project as projid
,srm.name as projname
,hier.level0_vosa_prj_type as projtype
,score.code as projcode
,score.report_month as report_month
,score.report_year as report_year
,CASE
when (subprojtab.subprojid = 1) then score.sub_project_1
when (subprojtab.subprojid = 2) then score.sub_project_2
End as SubProjID
,dvonumtab.dvonum as DVONUM
,typetab.measure_type as measure_Type
,CASE
WHEN (subprojtab.subprojid = 1) then
CASE
when typetab.measure_type = 'baseline' then
CASE
when (dvonumtab.dvonum = 1) then score.proj1_dvo1_baseline
when (dvonumtab.dvonum = 2) then score.proj1_dvo2_baseline
End
when typetab.measure_type = 'planned' then
CASE
when (dvonumtab.dvonum = 1) then score.proj1_dvo1_planned
when (dvonumtab.dvonum = 2) then score.proj1_dvo2_planned
End
End
WHEN (subprojtab.subprojid = 2) then
CASE
when typetab.measure_type = 'baseline' then
CASE
when (dvonumtab.dvonum = 1) then score.proj2_dvo1_baseline
when (dvonumtab.dvonum = 2) then score.proj2_dvo2_baseline
End
when typetab.measure_type = 'planned' then
CASE
when (dvonumtab.dvonum = 1) then score.proj2_dvo1_planned
when (dvonumtab.dvonum = 2) then score.proj2_dvo2_planned
End
End
End as MEASURE
from
ODF_CA_PROJSCORE score
left outer join
srm_projects srm on (srm.id = score.project)
left outer join
Z_PROJECT_HIERARCHY hier on (srm.id = hier.level0)
Join
(select 1 as subprojid from dual
union
select 2 as subprojid from dual) subprojtab on (1=1)
/* There will be 11 measures here eventually */
Join
(select 'baseline' as measure_type from dual
union
select 'planned' as measure_type from dual) typetab on (1=1)
Join
(select 1 as dvonum from dual
union
select 2 as dvonum from dual) dvonumtab on (1=1)
WHERE
(CASE
when (subprojtab.subprojid = 1) then score.sub_project_1
when (subprojtab.subprojid = 2) then score.sub_project_2
End) IS NOT NULL) query1
left outer join Z_PROJECT_HIERARCHY hier
on (query1.SubProjID = hier.level0)

Similar Messages

  • Problem using Change production and SFC step status with Simultanious group

    Hello,
    We just upgraded to ME 5.2 SP5 patch which was released two days back, the problem with Simultanious group is fixed and SFC gets the correct next step as per defined in the router (Previously there was bug).
    But when we try to use change production and put SFC in simultanious router at some particular operation as que it is getting in que at all operations and really can be started and completed even at the last operation.
    Same is the case with step status if we put it in que at some intermediate operation all operation listed above are becoming in que irrespective of the flow defined in simultanious router.
    Please let me know how to handle this.
    Regards,
    Pushkar Patil

    Hi Pushkar,
    It seems to be a bug. I would suggest opening a ticket on this.
    Regards,
    Alex.

  • What is the use of Cartesian Product or Cross join?

    Dear friends...
        I have done with inner join, self join and outer join. But I m getting confused with cross join. I know it used to produce Cartesian product of two table. But I wanted to know what is the use of Cartesian product in real life? In
    which situation we can use Cartesian product or cross join? I wanted some real life examples on Cartesian product. Please help me.

    Sometimes you get requirement stating that all combinations should be considered and in this scenario CROSS JOIN comes in play.
    If you have Products and Stores table, by using CROSS JOIN you can get the combination of all stores and all products and then you can JOIN this result set to other tables.
    Please refer:  The power of the Cross Join
    Cheers,
    Vaibhav Chaudhari
    [MCTS],
    [MCP]

  • ORA-00918: column ambiguously defined : while using inner Select

    Hi
    could you please help me to solve the following from.
    I have a query like this
    SELECT * FROM (SELECT ZMV.VENDOR_NAME,FR.PO_NUM,ZMV.PART_NUMBER,FR.ZAC_ITEM_DESCRIPTION,ZMV.QUANTITY_ORDERED,FR.QUANTITY_RECEIVED,ZMV.PO_UOM_CODE,FR.VENDOR_INV,FR.FORWARDER_REF,FR.PCS,TY.DESCRIPTION,FR.GROSS_WGT,FR.NET_WGT,FR.CFT,TR.DESCRIPTION,FR.PRO,FR.FORWARDER_REMARK,FR.RECAP_ID,FR.ZAC_REMARK,FR.SHIPMENT_BY FROM FWD_RECAP FR,ZAC_METRO_VIEW ZMV,FWD_MASTER_TYPE TY,FWD_MASTER_TRUCK TR WHERE FR.TYPE_ID=TY.TYPE_ID AND FR.TRUCK_ID=TR.TRUCK_ID AND FR.PO_LINE_ID=ZMV.PO_LINE_ID AND FR.PACKAGE_ID=0 AND FR.OPERATIONING_UINT_ID=511 AND FR.FORWARDER='METRO,ITALY' ORDER BY FR.PO_LINE_ID DESC) WHERE ROWNUM <=10
    But while executing the following error showing,
    SELECT * FROM (SELECT ZMV.VENDOR_NAME,FR.PO_NUM,ZMV.PART_NUMBER,FR.ZAC_ITEM_DESCRIPTION,ZMV.QUANTIT
    ERROR at line 1:
    ORA-00918: column ambiguously defined
    For this problem i got some answers from web sites, they saying as follows, but i am using like that only.
    (ORA-00918: COLUMN AMBIGUOUSLY DEFINED)
    Use table aliases and prefix all column names by their aliases when more than one table is involved in a query. This reduces parse time AND prevents future syntax errors if someone adds a column to one of the tables with the same name as a column in another table.
    awaiting your immediate reply
    Thankyou
    Jobin [[email protected]]

    In your inline view you have fields
    TY.DESCRIPTION and TR.DESCRIPTION which are the same
    name DESCRIPTION for covered SQL.
    place TY.DESCRIPTION TY_DESCRIPTION and
    TR.DESCRIPTION TR_DESCRIPTION in your code:
    SELECT * FROM (SELECT ZMV.VENDOR_NAME,FR.PO_NUM,ZMV.PART_NUMBER,FR.ZAC_ITEM_DESCRIPTION,ZMV.QUANTITY_ORDERED,FR.QUANTITY_RECEIVED,ZMV.PO_UOM_CODE,FR.VENDOR_INV,FR.FORWARDER_REF,FR.PCS,TY.DESCRIPTION TY_DESCRIPTION ,FR.GROSS_WGT,FR.NET_WGT,FR.CFT,TR.DESCRIPTION TR_DESCRIPTION,FR.PRO,FR.FORWARDER_REMARK,FR.RECAP_ID,FR.ZAC_REMARK,FR.SHIPMENT_BY FROM FWD_RECAP FR,ZAC_METRO_VIEW ZMV,FWD_MASTER_TYPE TY,FWD_MASTER_TRUCK TR WHERE FR.TYPE_ID=TY.TYPE_ID AND FR.TRUCK_ID=TR.TRUCK_ID AND FR.PO_LINE_ID=ZMV.PO_LINE_ID AND FR.PACKAGE_ID=0 AND FR.OPERATIONING_UINT_ID=511 AND FR.FORWARDER='METRO,ITALY' ORDER BY FR.PO_LINE_ID DESC) WHERE ROWNUM <=10
    Rgds

  • Trying to launch photoshop cs3 on a mac running OS10.6.8 i keep getting the error message: Licensing for this product has stopped working  you cannot use this product at this time. You must repair the problem by uninstalling and then reinstalling this pro

    trying to launch photoshop cs3 on a mac running OS10.6.8 i keep getting the error message: Licensing for this product has stopped working  you cannot use this product at this time. You must repair the problem by uninstalling and then reinstalling this product or contacting your IT adminstrator or Adobe customer support for help
    I already Uninstalled and reinstalled the product and it still does not work.

    Hi,
    Try to uninstall the software again and you have to manually
    Delete the following folders:
    [Startup Disk]/Library/Application Support/Adobe/Adobe PCD
    [Startup Disk]/Library/Application Support/Adobe/caps
    [Startup Disk]/Library/Application Support/Adobe/backup
    [Startup Disk]/Library/Preferences/FLEXnet Publisher/
    [Startup Disk]/Library/Application Support/FLEXnet Publisher/
    Go to Applications-->Utilities-->Disk Utility, Open it and Select the MAC HD and then click on Repair permissions.
    After that try to run the cleaner tool as mentioned by kglad.
    Restart machine and then try to install again.
    *** Make sure , you only delete these folders if there is no other adobe applications installed on the machine. As if you have any other Adobe application of the suite ( not free applications ) then it will be a problem.

  • My Adobe Acrobat 9 Standard stopped working after I performed an msconfig. I get the following message: "You cannot use this product at this time. You must repair the problem by uninstalling and reinstalling this product..." I installed this on Jan. 7, 20

    My Adobe Acrobat 9 Standard stopped working after I performed an msconfig. I get the following message: "You cannot use this product at this time. You must repair the problem by uninstalling and reinstalling this product..." I installed this on Jan. 7, 2010 and I have since misplaced the disk.
    How do I fix the problem?

    Hi Ali,
    You can download Acrobat 9 Std. from: https://files.acrobat.com/a/preview/8d640488-4a92-4f7d-b50b-d8eb7f96bff8
    and reinstall the software.
    Regards,
    Rave

  • HT201210 nowadays have many user have problem with update to ios7 and need active with apple id maybe in the future in order escape from these problems must be stop use these products else. Because of simple user don't know about this technology and somet

    nowadays have many user have problem with update to ios7 and need active with apple id maybe in the future in order escape from these problems must be stop use these products else. Because of simple user don't know about this technology and sometime just hear from other user that it 's difficult to use then force they change phone that use to handle to another.

    It is a feature to discourage the theft of iPhones by making them useless if resold. It's not going anywhere. It's simple: just don't buy a phone until you make sure that the activation lock has been disabled.

  • Join the same view using 2 different conditions, getting error ORA-00918

    Hi, I am trying to do a full outer join using the same view with different where conditions. Sample code below. I am getting the error "ORA-00918: column ambiguously defined". I have used as much alias as I can on the select statements but it gives me the same error.
    The weird thing is, RIGHT OUTER JOIN and LEFT OUTER JOIN will work fine. Only FULL OUTER gives the error above.
    Thanks in advance for your help.
    SELECT firsttable.<column_name>, secondtable.<columnname>
    FROM
    SELECT ...
    FROM V_MYVIEW
    WHERE <column_name> IN (1,2)
    ) firsttable
    FULL OUTER JOIN
    SELECT ...
    FROM V_MYVIEW
    WHERE <column_name> IN (3,4)
    ) secondtable
    ON firsttable.<column_name> and secondtable.<column_name>

    ON firsttable.<column_name> and secondtable.<column_name> ON firsttable.<column_name> = secondtable.<column_name>

  • You cannot use this product at this time. You must repair the problem by uninstalling and then reinstalling the product or contacting your IT administrator or adobe customer support for help....here I am

    You cannot use this product at this time. You must repair the problem by uninstalling and then reinstalling the product or contacting your IT administrator or adobe customer support for help

    This forum is none of those things.  That being said, we may be able to help.
    Have you tried uninstalling and reinstalling the product?  If not, please consider following these instructions:
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    -Noel

  • I cannot utilize my Adobe documents - I get this error message - "You cannot use this product at this time.  You must repair the problem by uninstalling and then reinstalling this product or contacting your IT administrator or Adobe customer support for h

    I cannot utilize my Adobe documents - I get this error message - “You cannot use this product at this time.  You must repair the problem by uninstalling and then reinstalling this product or contacting your IT administrator or Adobe customer support for help.”

    Thank you!  My solution was different.  I had turned off services in MSCONFIG and did not turn them back on.  After I turned services back on, Acrobat started  working again without the nag error and impedance to use the program.  I appreciate your input!  Adobe customer service/tech support was dismally disappointing.

  • CARTESIAN PRODUCT problem

    hello,
    i m trying to find the difference for calculating the DIFFENCE IN STOCK FOR OPC,PPC,CLINKER BY USING FOLLOWING SQL-QUERY
    SELECT TO_CHAR(a.dateofmtrl,'YYYY') YEAR,
    SUM(a.rm1) - SUM(b.rm1) - SUM(c.rm1) OPC,
    SUM(a.rm2) - SUM(b.rm2) - sum(c.rm2) PPC,
    SUM(a.rm3) - SUM(b.rm3) - sum(c.rm3) CLINKER
    FROM rawmtrl_graph a
    INNER JOIN rawmtrl_graph b ON TO_CHAR(a.dateofmtrl,'YYYY') =TO_CHAR(B.dateofmtrl,'YYYY')
    INNER JOIN rawmtrl_graph c ON TO_CHAR(a.dateofmtrl,'YYYY') =TO_CHAR(C.dateofmtrl,'YYYY')
    WHERE a.mtrl_flag='P'
    AND b.mtrl_flag='D'
    AND c.mtrl_flag='CS'
    GROUP BY TO_CHAR(a.dateofmtrl,'YYYY')
    BUT IT IS GIVING CARTESIAN PRODUCT...
    HOW TO MODIFY THE QUERY FOR FINDING EXACT FIGURE??????
    THANKS IN ADVENCE FOR ANY HELP.....

    Hi,
    please always put your code between two lines starting with {noformat}{noformat}.
    Additionally when you put insert statement put them entirely and not copying from one table we don't have.
    Here the way to get the result you want:SELECT EXTRACT(YEAR FROM dateofmtrl) yr
    , SUM(CASE mtrl_flag WHEN 'P' THEN rm1 ELSE -rm1 END) AS opc
    , SUM(CASE mtrl_flag WHEN 'P' THEN rm2 ELSE -rm2 END) AS ppc
    , SUM(CASE mtrl_flag WHEN 'P' THEN rm3 ELSE -rm3 END) AS clinker
    FROM rawmtrlgraph
    GROUP BY EXTRACT(YEAR FROM dateofmtrl);
    YR OPC PPC CLINKER
    2011 50 54 55
    2012 -49 -3 -11
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • My problem is Apple products used to work so well and be so easy to use.  What happened?

    My problem is Apple products used to work so well and be so easy to use.  What happened?  Whether its transferring Word and Pages documents, downloading and using iBooks, etc.

    Apple products still work so well and are easy to use....what's the problem?

  • Phone 5 freezes at lock screen but control centre and answering calls woriks, to work again i should press lock button then it works normally and freezes again if i leave it for 1min or less icant understand what problem isit,restored in dfu,normal no use

    phone 5 freezes at lock screen but control centre and answering calls woriks, to work again i should press lock button then it works normally and freezes again if i leave it for 1min or less icant understand what problem isit,restored in dfu,normal no use i still have problem please try to sovle it

    i tried it but no use
    i restored it as new device and kept it idle over night but no use

  • Download problems.., Flash Player.  Says I've succeeded, but can't use Avery products.

    Not succeeding in downloading Flash Player.  Says I've succeeded, but can't use Avery products.

    Hi,
    What operating system is your computer running on?
    Please click on this link to verify if Flash Player has beenn successfully installed : About Flash Player
    If it cannot detect Flash Player, use this link to download the full installers : http://forums.adobe.com/thread/909550
    The page which the link directs you to should also show the version of Flash Player installed.
    Please verify if that meets the requirement for the software you are trying to use.
    Also, when you try to use the products you've mentioned, what is the exact error message you see?
    Thanks

  • Cartesian Product from in-line queries

    I have the following query:
    SELECT AUDIT_MONTH, AUDITS, DEFECTS
    FROM
    select distinct(to_char(AUDIT_DATE,'MM/YY')) as AUDIT_MONTH
    from v_safety_audit_records
    select count(distinct(AUDIT_ID)) AUDITS
    from v_safety_audit_records
    group by to_char(AUDIT_DATE,'MM/YY')
    select count(KEY_ID) DEFECTS
    from v_safety_audit_records
    where SUBAREA_ID NOT LIKE '_98'
    and SUBAREA_ID NOT LIKE '_99'
    group by to_char(AUDIT_DATE,'MM/YY')
    but it keeps giving me a cartesian product. Is there a way to re-write this so that I only get the month, the number of audits, and number of defects on a line rather than number of months x number of months worth of lines? I can't seem to get the join conditions worked out... I can re-write this all using views, but as it is for a single report, I'd rather not bother with more views if I can avoid it.
    Thanks in advance.

    The problem is that the query doesn't return a single row and isn't meant to. I tried:
    SELECT
    select distinct(to_char(AUDIT_DATE,'MM/YY'))
    from v_safety_audit_records
    group by to_char(AUDIT_DATE,'MM/YY')
    ) AUDIT_MONTH,
    select count(distinct(AUDIT_ID))
    from v_safety_audit_records
    group by to_char(AUDIT_DATE,'MM/YY')
    ) AUDITS,
    select count(KEY_ID)
    from v_safety_audit_records
    where SUBAREA_ID NOT LIKE '_98'
    and SUBAREA_ID NOT LIKE '_99'
    group by to_char(AUDIT_DATE,'MM/YY')
    ) DEFECTS
    FROM DUAL;
    and got "ORA-01427: single-row subquery returns more than one row". It would be a good idea if I only needed it for one month, however.

Maybe you are looking for

  • I can no longer add music to my phone after using tones

    I got a new iPhone 5C and I am trying to make tones for it.  I used an app to make a tone and when I enable Synching Tones All Tones I can no longer add music to my phone through iTunes.  When I try to drag and drop a music file the icon has a red ci

  • Since installing iTunes 12 on Win 8 I can no longer download my podcasts.

    Since installing iTunes 12 I can no longer download podcasts. Can anyone help with this problem?

  • Opening a new page via "open in new tab" doesn't load new page anymore

    I have been using firefox for a long time now because I love it's option of opening in a new tab while staying on the tab I am currently using. Recently, over the last week or so, when I open a link using a new tab, the page doesn't load in the new t

  • How to add image

    Hi, Does anyone have a good example or best practice when adding an image to a data entry such as users registry to HTML Client? I have a user administration application and I will like for the admin user to be able to add an image to the user. Thank

  • Lost my photo library!!!!!

    While I was doing some work on my powerbook, I inadvertantly created a new photo library which wiped out my original library. I see my albums still memory but I can not important them into the photo library anymore. At this point iPhoto does not allo