Why don't this query fails??

Hi All,
A little brainstorming ....
I am providing the sql here..
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as dss
SQL>
SQL>   UPDATE dw_mmg_cat_us
  2    SET    dw_eftv_to = TRUNC(sysdate)
  3    WHERE  (mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id) IN
  4           (SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
  5           FROM   dw_mmg_cat_us
  6           WHERE  dw_eftv_to is null
  7           AND    mcv_mc_mc_id = 'DUMP_NO'
  8           MINUS
  9           SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
10           FROM   merc_mmg_catus
11          WHERE  mcv_mc_mc_id = 'DUMP_NO');
0 rows updated
SQL>
SQL> SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
  2  FROM   dw_mmg_cat_us
  3  WHERE  dw_eftv_to is null
  4  AND    mcv_mc_mc_id = 'DUMP_NO'
  5  MINUS
  6  SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
  7  FROM   merc_mmg_catus
  8  WHERE  mcv_mc_mc_id = 'DUMP_NO'
  9  /
SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
FROM   dw_mmg_cat_us
WHERE  dw_eftv_to is null
AND    mcv_mc_mc_id = 'DUMP_NO'
MINUS
SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
FROM   merc_mmg_catus
WHERE  mcv_mc_mc_id = 'DUMP_NO'
ORA-00904: "MCV_MC_MC_ID": invalid identifier
SQL> desc dw_mmg_cat_us
Name         Type         Nullable Default Comments                                                        
MCV_MC_MC_ID VARCHAR2(10)                  Merchandise category                                            
MCV_MCV_ID   VARCHAR2(10)                  The value for the category                                      
MMG_MMGL_ID  NUMBER(3)                     The unique identifier of the MMGL                               
MMG_MMG_ID   VARCHAR2(10)                  The identifier of the MMG, unique within the significant level  
DW_EFTV_FROM DATE                          Date the relationship was effective from No direct mapping from 
DW_EFTV_TO   DATE         Y                Date the relationship is effective to No direct mapping from exi
SQL> select * from merc_mmg_catus where rownum < 5;
MMG_ART_MMG_ID MC_MC_ID   MCV_MCV_ID
            12 CLASSTYPE  O
            13 CLASSTYPE  O
            14 CLASSTYPE  O
            15 CLASSTYPE  O
SQL>
SQL> SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
  2  FROM   merc_mmg_catus
  3  WHERE  mcv_mc_mc_id = 'DUMP_NO'
  4  /
SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
FROM   merc_mmg_catus
WHERE  mcv_mc_mc_id = 'DUMP_NO'
ORA-00904: "MCV_MC_MC_ID": invalid identifierHere merc_mmg_catus is the synonym it is not a table? But this object does not have mcv_mc_mc_id,mmg_mmg_id
these two field so why the above update statement is not failing. if i separately select this query it throws error as above.. then why this is not throwing in the update statement.
Thanks,
Sid

>
SQL>   UPDATE dw_mmg_cat_us
  2    SET    dw_eftv_to = TRUNC(sysdate)
  3    WHERE  (mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id) IN
  4           (SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
  5           FROM   dw_mmg_cat_us
  6           WHERE  dw_eftv_to is null
  7           AND    mcv_mc_mc_id = 'DUMP_NO'
  8           MINUS
  9           SELECT mcv_mc_mc_id,mcv_mcv_id,mmg_mmg_id
10           FROM   merc_mmg_catus
11          WHERE  mcv_mc_mc_id = 'DUMP_NO');When resolving names that have no prefix, Oracle will have to try and figure out what you mean.
The column names in line 9 have no prefix, so Oracle will try to figure it out.
It will check if the columns come from the table(s) in the from clause (line 10), as that is not the case it can find the column names in the table in line 1.
So I think it has resolved the names to be like this:
SQL>   UPDATE dw_mmg_cat_us d3
  2    SET    d3.dw_eftv_to = TRUNC(sysdate)
  3    WHERE  (d3.mcv_mc_mc_id,d3.mcv_mcv_id,d3.mmg_mmg_id) IN
  4           (SELECT d1.mcv_mc_mc_id,d1.mcv_mcv_id,d1.mmg_mmg_id
  5           FROM   dw_mmg_cat_us d1
  6           WHERE  d1.dw_eftv_to is null
  7           AND    d1.mcv_mc_mc_id = 'DUMP_NO'
  8           MINUS
  9           SELECT d3.mcv_mc_mc_id,d3.mcv_mcv_id,d3.mmg_mmg_id
10           FROM   merc_mmg_catus d2
11          WHERE  d2.mcv_mc_mc_id = 'DUMP_NO');Which doesn't make much sense, but is syntactically valid.
If you make a habit of prefixing column names, you would probably have written something like:
SQL>   UPDATE dw_mmg_cat_us d3
  2    SET    d3.dw_eftv_to = TRUNC(sysdate)
  3    WHERE  (d3.mcv_mc_mc_id,d3.mcv_mcv_id,d3.mmg_mmg_id) IN
  4           (SELECT d1.mcv_mc_mc_id,d1.mcv_mcv_id,d1.mmg_mmg_id
  5           FROM   dw_mmg_cat_us d1
  6           WHERE  d1.dw_eftv_to is null
  7           AND    d1.mcv_mc_mc_id = 'DUMP_NO'
  8           MINUS
  9           SELECT d2.mcv_mc_mc_id,d2.mcv_mcv_id,d2.mmg_mmg_id
10           FROM   merc_mmg_catus d2
11          WHERE  d2.mcv_mc_mc_id = 'DUMP_NO');Which would have failed because Oracle could see that d2 does not have those columns.

Similar Messages

  • Getting Error while running this query

    Hi,
    SELECT SUM(BATCHWISE_COUNT) TOTALBATCHCOUNT,
         TO_CHAR(SUM(BATCHWISEAMOUNT),'9,99,99,99,99,99,99,99,990.99') TOTALAMOUNT ,
         SUM(SLIP_RECORDS) TOTALSLIPCOUNT,
         SUM(CHEQUEONLY_RECORD) TOTALCHEQUECOUNT
    from (SELECT COUNT(TI.FLDITEMINITIALID) BATCHWISE_COUNT from TBLITEMINITIAL TI),
    (select SUM(IT.FLDAMOUNT)/100 BATCHWISEAMOUNT from TBLITEMINFOTRANS IT ),
    (SELECT COUNT(FLDITEMINITIALID) FROM TBLITEMINITIAL TI WHERE FLDBATCHNUMBER NOT IN (select FLDBATCHNUMBER from TBLITEMINITIAL_DEL where TI.FLDCAPTURINGDATE=FLDCAPTURINGDATE) AND TI.FLDITEMTYPE = 'P' AND TI.FLDCAPTURINGMODE = 'CP') SLIP_RECORDS,
    (SELECT COUNT(FLDITEMINITIALID) FROM TBLITEMINITIAL TI WHERE FLDBATCHNUMBER NOT IN (select FLDBATCHNUMBER from TBLITEMINITIAL_DEL where TI.FLDCAPTURINGDATE=FLDCAPTURINGDATE) AND FLDITEMTYPE = 'C' AND FLDCAPTURINGMODE = 'CO') CHEQUEONLY_RECORD
    from TBLITEMINITIAL TI,
                   TBLITEMINFO II,
                   TBLITEMINFOTRANS IT
              WHERE     II.FLDITEMINITIALID                    = TI.FLDITEMINITIALID
              AND     II.FLDITEMID                         = IT.FLDITEMID
              GROUP BY TRUNC(TI.FLDCAPTURINGDATE),TI.FLDBATCHNUMBER,TI.FLDCAPTURINGBRANCH,TI.FLDSCANNERID)
    Im geeting error
    ORA-00933: SQL command not properly ended
    when running this query
    I don't know what mistake i have done in this query , Kindly help for solving this issue
    Thanks
    Bala,
    Edited by: 965937 on Feb 11, 2013 9:25 PM

    Dear Friend
    Try with the query below,
    <<
    SELECT SUM(BATCHWISE_COUNT) TOTALBATCHCOUNT,
    TO_CHAR(SUM(BATCHWISEAMOUNT),'9,99,99,99,99,99,99,99,990.99') TOTALAMOUNT ,
    SUM(SLIP_RECORDS) TOTALSLIPCOUNT,
    SUM(CHEQUEONLY_RECORD) TOTALCHEQUECOUNT
    from (SELECT COUNT(TI.FLDITEMINITIALID) BATCHWISE_COUNT from TBLITEMINITIAL TI),
    (select SUM(IT.FLDAMOUNT)/100 BATCHWISEAMOUNT from TBLITEMINFOTRANS IT ),
    (SELECT COUNT(FLDITEMINITIALID) FROM TBLITEMINITIAL TI WHERE FLDBATCHNUMBER NOT IN (select FLDBATCHNUMBER from TBLITEMINITIAL_DEL where TI.FLDCAPTURINGDATE=FLDCAPTURINGDATE) AND TI.FLDITEMTYPE = 'P' AND TI.FLDCAPTURINGMODE = 'CP') SLIP_RECORDS,
    (SELECT COUNT(FLDITEMINITIALID) FROM TBLITEMINITIAL TI WHERE FLDBATCHNUMBER NOT IN (select FLDBATCHNUMBER from TBLITEMINITIAL_DEL where TI.FLDCAPTURINGDATE=FLDCAPTURINGDATE) AND FLDITEMTYPE = 'C' AND FLDCAPTURINGMODE = 'CO') CHEQUEONLY_RECORD
    from TBLITEMINITIAL TI,
    TBLITEMINFO II,
    TBLITEMINFOTRANS IT
    WHERE II.FLDITEMINITIALID = TI.FLDITEMINITIALID
    AND II.FLDITEMID = IT.FLDITEMID
    GROUP BY TRUNC(TI.FLDCAPTURINGDATE),TI.FLDBATCHNUMBER,TI.FLDCAPTURINGBRANCH,TI.FLDSCANNERID;
    Regards
    Ahamed Rafeeque Cherkala
    Edited by: Ahamed Rafeeque on Feb 12, 2013 3:20 AM

  • Why between for date is not returning data for this query ?

    Hello,
    i have a table with this structure and i am writing this query for fetching some rows based on some condition , but this query is not returning any data . Can you please tell why ?
    ID     DT
    003     11/8/2011
    002     10/8/2011
    001     9/8/2011
    And the query is :
    SELECT * FROM TABLE_NAME WHERE DT BETWEEN TO_DATE('08/08/2011','dd/mm/yyyy') AND TO_DATE('12/08/2011','dd/mm/yyyy');
    Edited by: bootstrap on Aug 13, 2011 7:10 AM

    >
    >
    but what is the problem with that, why that date is not matched when i am providing the date format ?Which part don't you understand? You did not use TO_DATE while inserting data and default date format was mm/dd/yyyy, right? Same default date format is used if you issue:
    SELECT * FROM TABLE_NAME Your original post states the above select returns:
    ID     DT
    003     11/8/2011
    002     10/8/2011
    001     9/8/2011So dates you inserted are November 8, 2011, October 8 2011 and September 8 2011. Now TO_DATE('08/08/2011','dd/mm/yyyy') is August 8 2011 and TO_DATE('12/08/2011','dd/mm/yyyy') is August 12 2011. So obviously:
    SELECT * FROM TABLE_NAME WHERE DT BETWEEN TO_DATE('08/08/2011','dd/mm/yyyy') AND TO_DATE('12/08/2011','dd/mm/yyyy');will not return any rows. Bottome line - never write code that uses implicit date conversions since your code becomes client NLS settings dependent and might work for one client and fail or produce wrong results for other client.
    SY.

  • Why is this query not using the index?

    check out this query:-
    SELECT CUST_PO_NUMBER, HEADER_ID, ORDER_TYPE, PO_DATE
    FROM TABLE1
    WHERE STATUS = 'N'
    and here's the explain plan:-
    1     
    2     -------------------------------------------------------------------------------------
    3     | Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
    4     -------------------------------------------------------------------------------------
    5     | 0 | SELECT STATEMENT | | 2735K| 140M| 81036 (2)|
    6     |* 1 | TABLE ACCESS FULL| TABLE1 | 2735K| 140M| 81036 (2)|
    7     -------------------------------------------------------------------------------------
    8     
    9     Predicate Information (identified by operation id):
    10     ---------------------------------------------------
    11     
    12     1 - filter("STATUS"='N')
    There is already an index on this column, as is shown below:-
         INDEX_NAME INDEX_TYPE     UNIQUENESS     TABLE_NAME     COLUMN_NAME     COLUMN_POSITION
    1     TABLE1_IDX2 NORMAL     NONUNIQUE     TABLE1      STATUS     1
    2     TABLE1_IDX NORMAL     NONUNIQUE     TABLE1     HEADER_ID     1
    So why is this query not using the index on the 'STATUS' Column?
    I've already tried using optimizer hints and regathering the stats on the table, but the execution plan still remains the same, i.e. it still uses a FTS.
    I have tried this command also:-
    exec dbms_stats.gather_table_stats('GECS','GEPS_CS_SALES_ORDER_HEADER',method_opt=>'for all indexed columns size auto',cascade=>true,degree=>4);
    inspite of this, the query is still using a full table scan.
    The table has around 55 Lakh records, across 60 columns. And because of the FTS, the query is taking a long time to execute. How do i make it use the index?
    Please help.
    Edited by: user10047779 on Mar 16, 2010 6:55 AM

    If the cardinality is really as skewed as that, you may want to look at putting a histogram on the column (sounds like it would be in order, and that you don't have one).
    create table skewed_a_lot
    as
       select
          case when mod(level, 1000) = 0 then 'N' else 'Y' end as Flag,
          level as col1
       from dual connect by level <= 1000000;
    create index skewed_a_lot_i01 on skewed_a_lot (flag);
    exec dbms_stats.gather_table_stats(user, 'SKEWED_A_LOT', cascade => true, method_opt => 'for all indexed columns size auto');Is an example.

  • More than maximum 5 filtered album lists trying to register. This will fail,Why i am getting this error when i pick video from Photo library.

    I am able to pick 4 videos from the Photo library in my iPhoneAPP but when i try to pick 5th one it throws an error:
    "More than maximum 5 filtered album lists trying to register. This will fail,Why i am getting this error when i pick video from Photo library."

    Hello Tate r Bulic
    I don't have any idea how to remove this error,can i pick more than 5 videos from the photo library...
    If it's then please help me and gimme idea..Thanks

  • Why this query required 2 extra columns in GROUP BY

    Hi All,
    This is my query:
    SELECT "parent_level_id",
           "parent_level_name"
           "parent_level_id",                    
           "child_level_id",
           "child_level_name",
           "scenario_id",
           "scenario_name",
           "exported",
           "regress_cob",
           "scn_status_id",
           "tgt_scenario_name",
           "load_status_id",
           "load_count",
           "PRESENT_VALUE",
           "DELTA",
           "GAMMA",
           "VEGA",
           "PNL",
           "ORIGINAL_PRESENT_VALUE"
    FROM
    select   0-fssPV.feed_id                        as "parent_level_id",
             fssPV.feed_description                 as "parent_level_name",
             fssPV.book_id                          as "child_level_id",
             fssPV.book_display_name                as "child_level_name",
             fssPV.parent_scenario_id               as "scenario_id",
             fssPV.scenario_display_name            as "scenario_name",
             nvl(sc.exported, 'N')                  as "exported",
             nvl(fssPV.parent_regressed_cob_date,  fssPV.parent_cob_date)    as "regress_cob",
             fssPV.scn_status_id                    as "scn_status_id",
             fssPV.tgt_scenario_display_name        as "tgt_scenario_name",
             fssPV.load_status_id                   as "load_status_id",
             count(*)                               as "load_count",
            sum(fssPV.present_value)                as "PRESENT_VALUE",
             sum(fssPV.delta)                       as "DELTA",
             sum(fssPV.gamma)                       as "GAMMA",
             sum(fssPV.vega)                        as "VEGA",
             sum(fssPV.present_value) - sum (srbase.present_value) as "PNL",
                select SUM(vsr.original_present_value)
                from validated_position vp , validated_scenario_result vsr
                where
                VSR.FEED_INSTANCE_ID= fssPV.feed_instance_id
                AND VSR.COB_DATE= fssPV.cob_date
                and vsr.validated_position_id= vp.validated_position_id
                 AND vsr.scenario_id in  (SELECT   distinct mn.node_id as "SCENARIO_ID"
                                           FROM     TABLE(pack_scenarios_overview.splitInListIntoLeaves(a_scenario_list, '$', l_cobdate)) nodeIds,
                                                    marsnode mn
                                           WHERE    nodeIds.column_value = mn.node_id
                                           AND      mn.close_date is null
             ) "ORIGINAL_PRESENT_VALUE"
    from   (
    select fssTgts.*,
           mntgt.display_name        as "TGT_SCENARIO_DISPLAY_NAME",
           mnscenario.display_name   as "SCENARIO_DISPLAY_NAME",
           mnbook.display_name       as "BOOK_DISPLAY_NAME",
           fs.feed_description,
           sr.present_value,
           sr.delta,
           sr.gamma,
           sr.vega,
           p.position_id
    from (
    /** Treewalk to find Feed/Scenario dependencies **/
    Select fssBooks.feed_id,
           fssLinks.cob_date,
           fssLinks.scenario_id,
           fssBooks.load_status_id,
           fssBooks.scn_status_id,
           fssBooks.tgt_scenario_id,
           fssBooks.book_id,
           fssBooks.regressed_cob_date,
           fssLinks.feed_instance_id,
           fssLinks.parent_cob_date,
           fssLinks.parent_tgt_scenario_id,
           fssLinks.parent_regressed_cob_date,
           fssLinks.parent_scenario_id,
           fssLinks.parent_feed_instance_id
    from   (
    /** Treewalk (backwards) to find underlying data over FSS control table **/
    WITH fss AS
             /* Initial filter on feed_scenario_status for peformance           */
             /* cannot filter on scenario as we don't know the dependencies yet */
             ( select DISTINCT scenario_id,
                      f.cob_date,
                      f.scn_status_id,
                      f.regressed_cob_date,
                      f.tgt_scenario_id,
                      f.feed_id,
                      f.feed_instance_id
               from   feed_scenario_status f,
                      feed_group_xref fgx
               where    cob_date <= l_cobdate -- PVs for this cob must be loaded either today, or its regressed to a previous cob
               and    f.feed_id = fgx.feed_id
               and    fgx.feed_group_id like l_feed_group_id
               and    fgx.feed_id like l_feed_id
      select   feed_instance_id,
               scenario_id,
               prior scenario_id,
               cob_date,
               feed_id,
               scn_status_id,
               regressed_cob_date,
               /* Need to maintain the root values to identify the scenarios that users are seeing */
               CONNECT_BY_ISLEAF "ISLEAF",
               CONNECT_BY_ROOT scenario_id        as "PARENT_SCENARIO_ID",
               CONNECT_BY_ROOT feed_id            as "PARENT_FEED_ID",
               CONNECT_BY_ROOT cob_date           as "PARENT_COB_DATE",
               CONNECT_BY_ROOT tgt_scenario_id    as "PARENT_TGT_SCENARIO_ID",
               CONNECT_BY_ROOT regressed_cob_date as "PARENT_REGRESSED_COB_DATE",
               CONNECT_BY_ROOT feed_instance_id   as "PARENT_FEED_INSTANCE_ID"
      from     fss
      start with fss.cob_date = l_cobdate
      connect by (prior fss.regressed_cob_date = fss.cob_date and
                  prior fss.scenario_id = fss.scenario_id and
                  prior fss.feed_id = fss.feed_id and
                  prior fss.tgt_scenario_id is null
                 ) -- Connect if regressed (rule: same feed/book/scenario, different cob)
              or (prior fss.tgt_scenario_id = fss.scenario_id and
                  prior fss.cob_date = fss.cob_date and
                  prior fss.feed_id = fss.feed_id and
                  prior fss.feed_instance_id = fss.feed_instance_id
                 ) -- and connect if paste as (rule: same feed/cob/book, different scenario)
      ) fssLinks,
      feed_scenario_status fssBooks
    where isLeaf = 1
    and   fssLinks.parent_feed_id = fssBooks.feed_Id
    and   fssLinks.parent_cob_date = fssBooks.cob_date
    and   fssLinks.parent_scenario_id = fssBooks.scenario_id
    ) fssTgts,
    position p,
    scenario_result sr,
    marsnode mntgt,
    marsnode mnbook,
    marsnode mnscenario,
    feed_static fs
    where fssTgts.feed_id = fs.feed_id
    and   fssTgts.parent_tgt_scenario_id = mntgt.node_id (+)
    and   mntgt.close_date (+) is null
    and   fssTgts.feed_instance_id = p.feed_instance_id
    and   fssTgts.book_id = p.book_id
    and   fssTgts.cob_date = sr.cob_date
    and   fssTgts.scenario_id = sr.scenario_id
    and   p.feed_instance_id = sr.feed_instance_id
    and   p.position_id = sr.position_id
    and   p.book_id = mnbook.node_id
    and   mnbook.close_date is null
    and   fssTgts.parent_scenario_id = mnscenario.node_id
    and   mnscenario.close_date is null
    ) fssPV
    left outer join scenario_control sc
      on fssPV.parent_feed_instance_id = sc.feed_instance_id
      and upper(fssPV.scenario_display_name) = upper(sc.scenario)
    /* Join to SBM to calculate P&Ls */
    left outer join scenario_base_map sbm
      on  fssPV.scenario_id = sbm.scenario_id
      and sbm.begin_cob_date <= l_cobdate
      and sbm.end_cob_date > l_cobdate
    left outer join scenario_result srbase
      on  fssPV.cob_date = srbase.cob_date
      and fssPV.feed_instance_id = srbase.feed_instance_id
      and nvl(sbm.mapped_scenario_id, l_original_scn_id) = srbase.scenario_id
      and fssPV.position_id = srbase.position_id
    /* Only display (root) scenarios that users have selected */
    where fssPV.parent_scenario_id in (SELECT   distinct mn.node_id as "SCENARIO_ID"
                                       FROM     TABLE(pack_scenarios_overview.splitInListIntoLeaves(a_scenario_list, '$', l_cobdate)) nodeIds,
                                                marsnode mn
                                       WHERE    nodeIds.column_value = mn.node_id
                                       AND      mn.close_date is null
    group by fssPV.feed_id,
             fssPV.feed_description,
             fssPV.book_id,
             fssPV.book_display_name,
             fssPV.parent_scenario_id,
             fssPV.scenario_display_name,
             sc.exported,
             fssPV.parent_regressed_cob_date,
             fssPV.scn_status_id,
             fssPV.tgt_scenario_display_name,
             fssPV.load_status_id,
             fssPV.parent_cob_date
    --         fssPV.feed_instance_id,
    --         fssPV.cob_date
    );In this query for the initial section where I am selecting the "ORIGINAL_PRESENT_VALUE" part
                select SUM(vsr.original_present_value)
                from validated_position vp , validated_scenario_result vsr
                where
                VSR.FEED_INSTANCE_ID= fssPV.feed_instance_id
                AND VSR.COB_DATE= fssPV.cob_date
                and vsr.validated_position_id= vp.validated_position_id
                 AND vsr.scenario_id in  (SELECT   distinct mn.node_id as "SCENARIO_ID"
                                           FROM     TABLE(pack_scenarios_overview.splitInListIntoLeaves(a_scenario_list, '$', l_cobdate)) nodeIds,
                                                    marsnode mn
                                           WHERE    nodeIds.column_value = mn.node_id
                                           AND      mn.close_date is null
             ) "ORIGINAL_PRESENT_VALUE" Even though fssPV.feed_instance_id and fssPV.cob_date are not used anywhere in the SELECT clause requires tobe added to the final GROUP BY clause else
    the query though compiles successfully doesnt executes giving "Not a group by " error.
    Can anyone tell me why this is the problem and why these columns need to be added to the final GROUP BY clause.
    Rgds,
    Aashish

    Hi, Aashish,
    Aashish S. wrote:
    Even though fssPV.feed_instance_id and fssPV.cob_date are not used anywhere in the SELECT clause requires tobe added to the final GROUP BY clause else
    the query though compiles successfully doesnt executes giving "Not a group by " error.Actually, you are using both of those columns in the SELECT clause, when you compute original_present_value:
    select SUM(vsr.original_present_value)
    from validated_position vp , validated_scenario_result vsr
    where
    VSR.FEED_INSTANCE_ID= fssPV.feed_instance_id
    AND VSR.COB_DATE= fssPV.cob_date
    and vsr.validated_position_id= vp.validated_position_id
    AND vsr.scenario_id in  (SELECT   distinct mn.node_id as "SCENARIO_ID"
    FROM     TABLE(pack_scenarios_overview.splitInListIntoLeaves(a_scenario_list, '$', l_cobdate)) nodeIds,
    marsnode mn
    WHERE    nodeIds.column_value = mn.node_id
    AND      mn.close_date is null
    ) "ORIGINAL_PRESENT_VALUE" Since the scalar sub-query is correlated to fsspv.feed_instance_id and fsspv.cob_date, it is depenedant on those columns, the same as, say TRUNC (fsspv.cobb_date, 'YEAR') is depenedant on fsspv.cob_date.
    Perhaps you need to put SUM in the main query, not the scalar sub-query, or (probably faster) replace the scalar sub-query with a join. Without knowing your tables, or the results you want from your data, I can't say more.
    Whenever you have a problem, post a little sample data (CREATED TABLE and INSERT statements for all tables), and the results you want from that data.
    Simplify the problem as much as possible. In this case, I think you can show what the problem is using just two tables, the ones aliases fsspv and mn.
    If you can illustrate your problem using commonly available tables, like those in the scott schema, then you don't have to post any data; just the results you want.
    It looks like you're doing something like this:
    SELECT       job
    ,       COUNT (*)     AS cnt
    ,       (          -- Begin scalar sub_query to compute min_loc
                SELECT     MIN (loc)
              FROM     scott.dept
              WHERE     deptno     = e.deptno
           ) min_loc     -- End scalar sub_query to compute min_loc
    FROM       scott.emp     e
    GROUP BY  job
    ,            deptno     -- Omitting this causes ORA_00979: not a GROUP BY expression
    ;when you really should be doing something like this:
    SELECT       job
    ,       COUNT (*)     AS cnt
    ,       MIN ( (          -- Begin scalar sub_query to compute min_loc
                SELECT     loc
              FROM     scott.dept
              WHERE     deptno     = e.deptno
               ) ) min_loc     -- End scalar sub_query to compute min_loc
    FROM       scott.emp     e
    GROUP BY  job
    ;to get these results:
    JOB              CNT MIN_LOC
    CLERK              4 CHICAGO
    SALESMAN           4 CHICAGO
    PRESIDENT          1 NEW YORK
    MANAGER            3 CHICAGO
    ANALYST            2 DALLAS

  • After BI Stats installation: Why is this query not reporting on my query?

    Hi,
    ok, so I thought I was done with BI Stats installation and I run a query:
    Detailed Query Runtime Statistics: Analysis 0TCT_MC02_Q0200 0TCT_MC02
    which came with the installation.
    I see query QueryColleague in this query with the information:
    Time       = 21.992
    Time:Ste =29.480
    Counter  = 0
    1.
    What is the significance of these 3 figures (Time, Time:Ste, Counter)? Does it in any way give a sense of the performance of the query?
    2.
    Under the “Settings for BI Statistics” I verified and QueryColleague was set as:
    Statistics = D
    OLAP detail level = (blank)
    I have a query QueryMyOwn which following the installation guidelines, I set up as:
    Statistics = X
    OLAP detail level = 2
    I have since run QueryMyOwn a and run the delta process chains again but this query still not does appear in this “Detailed Query Runtime Statistics”. Any idea what may be going on?
    3.
    Am I misinterpreting this report? I thought it was going to show a list of queries which BS Stats has collected data and reporting on them.
    4.
    Which of the many queries which come with the BI Stats have you found useful so far? I will appreciate the reason. Any particular one standing out if you need to track why a particular report may not be performing well?
    Thanks

    Hi,
      I think you are viewing the queries from Admin cockpit 0TCT_MC02_Q0200 which has filter to display the query that had been executed  in last 24 hours.
    Most of the queries from Admin Cockpit will be help you to monitor the data load stats, which load taken long time to complete including the process chains, DTP etc. There are some other queries with have conditional / Expection which filter the data based on top 10 process etc.
    Few Queries that was useful to me are
    0TCT_MC22_Q0104 - Long term trends in total runtime
    0TCT_MC12_Q0110 - Process status
    0TCT_MC01_Q0122 - Deviation in runtime of BI Application Object
    Hope it helps,
    Cheers,
    Balaji

  • Please show this query, data not showing why?

    I created a report and write following query,it was working well since last 4 months but today automaticly not showing data I can undertstand why?
    Becuase I didnt make any changes in this query.
    Please help me
    Urgent
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    and merch_order.orderno not in
    (select export_order1.orderno from export_order1)
    ORDER BY MERCH_ORDER.ORDERNO
    there is no any error and msg header and footer print.

    Maybe , the query in "NOT IN" clause select export_order1.orderno from export_order1
    return the same rows as the following portion return....
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    OR
    there are no rows which conform to the joining condition between the two tables BUYER and MERCH_ORDER ....
    Regards,
    Simon

  • HT204291 Why don't I see the airplay icon in my settings? I have the ios7 installed now my netflix won't work as need to turn off mirroring..... And the airplay device is not installed.... Anyone help on this?.

    Why don't I see the airplay icon in my settings? I have the ios7 installed now my netflix won't work as need to turn off mirroring..... And the airplay device is not installed.... Anyone help on this?.

    Reboot your router. The icon only shows when connected to wifi and Apple TV or similar device. Same thing happened with my phone and the icon appeared in control center after router reboot.

  • Why don't the FAQ's in this Sub-Forum Work?

    Why don't the FAQ's in this Sub-Forum Work?  Not in Firefox 22.0 or IE 8-latest.

    They do now.

  • Why there is a error in this query ?

    why there is a error in this query ?
    declare
    v_exist pls_integer;
    v_search varchar2(255) := '175';
    v_sql varchar2(255);
    begin
    for s in
    (select table_name, column_name
    from user_tab_columns
    where data_type like '%CHAR%'
    order by table_name, column_name)
    loop
    v_sql := 'select count(*) from '||s.table_name||
    ' where instr('||s.column_name||',' || CHR(39)|| v_search|| CHR(39) ||') > 0';
    execute immediate v_sql into v_exist;
    if v_exist > 0 then
    dbms_output.put_line(s.table_name||'.'||s.column_name||' matches the string.');
    end if;
    end loop;
    end;
    Error:
    The following error has occurred:
    ORA-00933: SQL command not properly ended
    ORA-06512: at line 14
    Edited by: user575089 on Dec 23, 2009 4:14 AM
    Edited by: user575089 on Dec 23, 2009 4:14 AM

    See, Right now i am in schema and see below :
    set serveroutput on;
    declare
    v_exist pls_integer;
    v_search varchar2(255) := 'SCOTT';
    v_sql varchar2(255);
    begin
    for s in
    (select '"'||table_name||'"' table_name,'"'||column_name||'"' column_name
    from user_tab_columns
    where data_type like '%CHAR%'
    and table_name not like '%$%'
    order by table_name, column_name)
    loop
    v_sql := 'select count(*) from '||s.table_name||' where instr('||s.column_name||',' || CHR(39)|| v_search|| CHR(39)||') > 0';
    --dbms_output.put_line(v_sql);
    --execute immediate v_sql;
    execute immediate v_sql into v_exist;
    if v_exist > 0 then
    dbms_output.put_line(s.table_name||'.'||s.column_name||' matches the string.');
    end if;
    end loop;
    end;
    "EMP"."ENAME" matches the string.
    "EXCEPTIONS"."OWNER" matches the string.
    "FLOW_TABLE"."OBJECT_OWNER" matches the string.
    "MYEMP"."ENAME" matches the string.
    PL/SQL procedure successfully completed.
    I am getting output; that i search "SCOTT" word in my search string.

  • Why don't I have the invite icon on the bottom right hand side of my calendar?  How do I get this? And why wouldn't my 4S have it and everyone else's iPhone 4 does?

    Why don't I have the invite icon on the bottom right of my calendar screen and how do I get it?
    Why wouldn't my 4S have this? But iPhone 4 users do? It is already turned on in my settings but that icon is missing in my calendar.

    Welcome to the Apple Support Communities
    Note that iCloud isn't an app. Instead, to modify iCloud settings, go to Settings > iCloud, and tick all the iCloud services you want to use on the iPad

  • Why this Query is taking much longer time than expected?

    Hi,
    I need experts support on the below mentioned issue:
    Why this Query is taking much longer time than expected? Sometimes I am getting connection timeout error. Is there any better way to achieve result in shortest time.  Below, please find the DDL & DML:
    DDL
    BHDCollections
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[BHDCollections](
     [BHDCollectionid] [bigint] IDENTITY(1,1) NOT NULL,
     [GroupMemberid] [int] NOT NULL,
     [BHDDate] [datetime] NOT NULL,
     [BHDShift] [varchar](10) NULL,
     [SlipValue] [decimal](18, 3) NOT NULL,
     [ProcessedValue] [decimal](18, 3) NOT NULL,
     [BHDRemarks] [varchar](500) NULL,
     [Createdby] [varchar](50) NULL,
     [Createdon] [datetime] NULL,
     CONSTRAINT [PK_BHDCollections] PRIMARY KEY CLUSTERED
     [BHDCollectionid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    BHDCollectionsDet
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[BHDCollectionsDet](
     [CollectionDetailid] [bigint] IDENTITY(1,1) NOT NULL,
     [BHDCollectionid] [bigint] NOT NULL,
     [Currencyid] [int] NOT NULL,
     [Denomination] [decimal](18, 3) NOT NULL,
     [Quantity] [int] NOT NULL,
     CONSTRAINT [PK_BHDCollectionsDet] PRIMARY KEY CLUSTERED
     [CollectionDetailid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    Banks
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Banks](
     [Bankid] [int] IDENTITY(1,1) NOT NULL,
     [Bankname] [varchar](50) NOT NULL,
     [Bankabbr] [varchar](50) NULL,
     [BankContact] [varchar](50) NULL,
     [BankTel] [varchar](25) NULL,
     [BankFax] [varchar](25) NULL,
     [BankEmail] [varchar](50) NULL,
     [BankActive] [bit] NULL,
     [Createdby] [varchar](50) NULL,
     [Createdon] [datetime] NULL,
     CONSTRAINT [PK_Banks] PRIMARY KEY CLUSTERED
     [Bankid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    Groupmembers
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[GroupMembers](
     [GroupMemberid] [int] IDENTITY(1,1) NOT NULL,
     [Groupid] [int] NOT NULL,
     [BAID] [int] NOT NULL,
     [Createdby] [varchar](50) NULL,
     [Createdon] [datetime] NULL,
     CONSTRAINT [PK_GroupMembers] PRIMARY KEY CLUSTERED
     [GroupMemberid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[GroupMembers]  WITH CHECK ADD  CONSTRAINT [FK_GroupMembers_BankAccounts] FOREIGN KEY([BAID])
    REFERENCES [dbo].[BankAccounts] ([BAID])
    GO
    ALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_BankAccounts]
    GO
    ALTER TABLE [dbo].[GroupMembers]  WITH CHECK ADD  CONSTRAINT [FK_GroupMembers_Groups] FOREIGN KEY([Groupid])
    REFERENCES [dbo].[Groups] ([Groupid])
    GO
    ALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_Groups]
    BankAccounts
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[BankAccounts](
     [BAID] [int] IDENTITY(1,1) NOT NULL,
     [CustomerID] [int] NOT NULL,
     [Locationid] [varchar](25) NOT NULL,
     [Bankid] [int] NOT NULL,
     [BankAccountNo] [varchar](50) NOT NULL,
     CONSTRAINT [PK_BankAccounts] PRIMARY KEY CLUSTERED
     [BAID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[BankAccounts]  WITH CHECK ADD  CONSTRAINT [FK_BankAccounts_Banks] FOREIGN KEY([Bankid])
    REFERENCES [dbo].[Banks] ([Bankid])
    GO
    ALTER TABLE [dbo].[BankAccounts] CHECK CONSTRAINT [FK_BankAccounts_Banks]
    GO
    ALTER TABLE [dbo].[BankAccounts]  WITH CHECK ADD  CONSTRAINT [FK_BankAccounts_Locations1] FOREIGN KEY([Locationid])
    REFERENCES [dbo].[Locations] ([Locationid])
    GO
    ALTER TABLE [dbo].[BankAccounts] CHECK CONSTRAINT [FK_BankAccounts_Locations1]
    Currency
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Currency](
     [Currencyid] [int] IDENTITY(1,1) NOT NULL,
     [CurrencyISOCode] [varchar](20) NOT NULL,
     [CurrencyCountry] [varchar](50) NULL,
     [Currency] [varchar](50) NULL,
     CONSTRAINT [PK_Currency] PRIMARY KEY CLUSTERED
     [Currencyid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    CurrencyDetails
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[CurrencyDetails](
     [CurDenid] [int] IDENTITY(1,1) NOT NULL,
     [Currencyid] [int] NOT NULL,
     [Denomination] [decimal](15, 3) NOT NULL,
     [DenominationType] [varchar](25) NOT NULL,
     CONSTRAINT [PK_CurrencyDetails] PRIMARY KEY CLUSTERED
     [CurDenid] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    QUERY
    WITH TEMP_TABLE AS
    SELECT     0 AS COINS, BHDCollectionsDet.Quantity AS BN, BHDCollections.BHDDate AS CollectionDate, BHDCollectionsDet.Currencyid,
                          (BHDCollections.BHDCollectionid) AS DSLIPS, Banks.Bankname
    FROM         BHDCollections INNER JOIN
                          BHDCollectionsDet ON BHDCollections.BHDCollectionid = BHDCollectionsDet.BHDCollectionid INNER JOIN
                          GroupMembers ON BHDCollections.GroupMemberid = GroupMembers.GroupMemberid INNER JOIN
                          BankAccounts ON GroupMembers.BAID = BankAccounts.BAID INNER JOIN
                          Currency ON BHDCollectionsDet.Currencyid = Currency.Currencyid INNER JOIN
                          CurrencyDetails ON Currency.Currencyid = CurrencyDetails.Currencyid INNER JOIN
                          Banks ON BankAccounts.Bankid = Banks.Bankid
    GROUP BY BHDCollectionsDet.Quantity, BHDCollections.BHDDate, BankAccounts.Bankid, BHDCollectionsDet.Currencyid, CurrencyDetails.DenominationType,
                          CurrencyDetails.Denomination, BHDCollectionsDet.Denomination, Banks.Bankname,BHDCollections.BHDCollectionid
    HAVING      (BHDCollections.BHDDate BETWEEN @FromDate AND @ToDate) AND (BankAccounts.Bankid = @Bankid) AND (CurrencyDetails.DenominationType = 'Currency') AND
                          (CurrencyDetails.Denomination = BHDCollectionsDet.Denomination)
    UNION ALL
    SELECT     BHDCollectionsDet.Quantity AS COINS, 0 AS BN, BHDCollections.BHDDate AS CollectionDate, BHDCollectionsDet.Currencyid,
                          (BHDCollections.BHDCollectionid) AS DSLIPS, Banks.Bankname
    FROM         BHDCollections INNER JOIN
                          BHDCollectionsDet ON BHDCollections.BHDCollectionid = BHDCollectionsDet.BHDCollectionid INNER JOIN
                          GroupMembers ON BHDCollections.GroupMemberid = GroupMembers.GroupMemberid INNER JOIN
                          BankAccounts ON GroupMembers.BAID = BankAccounts.BAID INNER JOIN
                          Currency ON BHDCollectionsDet.Currencyid = Currency.Currencyid INNER JOIN
                          CurrencyDetails ON Currency.Currencyid = CurrencyDetails.Currencyid INNER JOIN
                          Banks ON BankAccounts.Bankid = Banks.Bankid
    GROUP BY BHDCollectionsDet.Quantity, BHDCollections.BHDDate, BankAccounts.Bankid, BHDCollectionsDet.Currencyid, CurrencyDetails.DenominationType,
                          CurrencyDetails.Denomination, BHDCollectionsDet.Denomination, Banks.Bankname,BHDCollections.BHDCollectionid
    HAVING      (BHDCollections.BHDDate BETWEEN @FromDate AND @ToDate) AND (BankAccounts.Bankid = @Bankid) AND (CurrencyDetails.DenominationType = 'COIN') AND
                          (CurrencyDetails.Denomination = BHDCollectionsDet.Denomination)),
    TEMP_TABLE2 AS
    SELECT CollectionDate,Bankname,DSLIPS AS DSLIPS,SUM(BN) AS BN,SUM(COINS)AS COINS  FROM TEMP_TABLE Group By CollectionDate,DSLIPS,Bankname
    SELECT CollectionDate,Bankname,count(DSLIPS) AS DSLIPS,sum(BN) AS BN,sum(COINS) AS coins FROM TEMP_TABLE2 Group By CollectionDate,Bankname
    HAVING COUNT(DSLIPS)<>0;

    Without seeing an execution plan of the query it is hard to suggest something useful. Try insert the result of UNION ALL to the temporary table and then perform an aggregation on that table, not a CTE.
    Just
    SELECT CollectionDate,Bankname,DSLIPS AS DSLIPS,SUM(BN) AS BN,SUM(COINS)AS COINS  FROM
    #tmp Group By CollectionDate,DSLIPS,Bankname
    HAVING COUNT(DSLIPS)<>0;
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Please see this query, not showing data Why?

    I created a report and write following query,it was working well since last 4 months but today automaticly not showing data I can undertstand why?
    Becuase I didnt make any changes in this query.
    Please help me
    Urgent
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    and merch_order.orderno not in
    (select export_order1.orderno from export_order1)
    ORDER BY MERCH_ORDER.ORDERNO

    Where "first table" is merch_order and "second table" is export_order1?
    How many distinct orders are in each table?
    Are there any NULL order numbers in either table?
    I'd put money on the fact that if commenting out a clause causes a number of rows to be returned, that clause is filtering out all the rows. You'll need to go through your data to figure out why the NOT IN clause is filtering out all your rows.
    Justin

  • TS3322 While trying to sync my iPhone, I get this message "This iPhone cannot be synced. You do not have enough access privileges for this operation." Why don't I have this access privilege? How do I fix this?

    While trying to sync my iPhone, I get this message "This iPhone cannot be synced. You do not have enough access privileges for this operation." Why don't I have this access privilege? How do I fix this?

    See if the user tip helps: https://discussions.apple.com/docs/DOC-6562

Maybe you are looking for

  • Data not getting populated in ESS Payslip in portal

    Hi All I am tryig to display Payslip in Portal. Have done all the necessary configuration in Benefits and payments->Salary statement->HRFOR/ EDTIN features. Correct Payslip form is visible but data is not getting populated in the payslip. Have tested

  • How do I get new tabs to open Home URL automatically instead of blank?

    When I open a new tab in Firefox 3.6.12, it always opens blank and I have to either type in a URL or use bookmarks to select the location. In Internet Explorer 8, I can have each new tab open my first home page URL automatically. Is there any way to

  • Updatable property of Calculated Field in ViewObject does not work

    Hello, I have set the Updatable property of some ViewObject attributes to "while new". In the page those attributes are shown as <af:inputListOfValues> components. When creating a new row, those components properly appear as enabled and let me insert

  • Purchase Order / Requisition Line Item Approval

    Hi Just wondering if Purchase Order / Purchase Requisition LINE ITEM approval is an option for workflow? Would the better solution be to use SRM line item approval on a shopping cart and create the Purchase Order from this?

  • Another schema reference in a stored procedure

    Hello - I need to call a stored procedure from another stored procedure in a different schema. Can this be done? For example: I am logged on as USER1 and I try to call these stored procedures from within a stored procedure: DO_STUFF (works - within o