Select query giving error

Hi can Some one help me how to fit the query in the Main query, I need to selete SYS_ID the below Work around query is getting the output correctly
but when i tried to put in the main query am getting ORA-00933 not sure how to fix this. Can some one advice me where am making wrong.
Work Around query :
   SELECT ALTID.B_SYS_ID FROM N08.B_ALT_ID_TB ALTID WHERE ALTID.B_ALT_ID
           IN ( SELECT MEDCO.RE_MEDCD_ID_NUM 
             FROM N09.T_MEDCD_ID MEDCO
          INNER JOIN N09.T_POLY POLY
                ON POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID) AS B_SYS_ID
Need to integerate the above column in the below query.
Main Query :
SELECT 'Diff' AS SC,
     POLY.ID,
      ALTID.B_SYS_ID FROM N08.B_ALT_ID_TB ALTID WHERE ALTID.B_ALT_ID
           IN ( SELECT MEDCO.RE_MEDCD_ID_NUM 
             FROM N09.T_MEDCD_ID MEDCO
          INNER JOIN N09.T_POLY POLY
                ON POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID) AS B_SYS_ID,
    NULL AS BEG_DT,
  NULL AS ID,
FROM
   N09.T_POLY POLY
Oracle Version : 10gR2
Thanks in advance.

Hi,
Hillbird wrote:
Hi Frank,
Thanks for your responces. The Error am getting is at line number 7 & col# 55 -- ON POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID) AS B_SYS_ID,.
I also changed the alias name in thesubquery as S-poly and left the main query alias as POLY. You still haven't posted a completed query, or any sample data and results.
But still i am getting the same error message.
Error Message
ORA-00933 : Sql command not properly ended
oo933 00000 - "Sql command not properly ended"
Vendor Code 933 Error at line 7 column 55
Iam framing a select query, The work around query is used to checkhow to reterive the value from the DB and with the business rules. on which the framing
select query the B_sys_id comes in column 3 and i still have more columns to select. Hence i even tried as below
SELECT 'Diff' AS SC,
POLY.ID,
ALTID.B_SYS_ID FROM N08.B_ALT_ID_TB ALTID WHERE ALTID.B_ALT_ID
IN ( SELECT MEDCO.RE_MEDCD_ID_NUM 
             FROM N09.T_MEDCD_ID MEDCO
             WHERE POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID),
NULL AS BEG_DT,
NULL AS ID,
FROM
N09.T_POLY POLY
But still the same error message i got.
Hence i just tried as below
SELECT 'Diff' AS SC,
1 as dummy,
2 as dummy_1,
ALTID.B_SYS_ID FROM N08.B_ALT_ID_TB ALTID WHERE ALTID.B_ALT_ID
IN ( SELECT MEDCO.RE_MEDCD_ID_NUM 
             FROM N09.T_MEDCD_ID MEDCO
          INNER JOIN N09.T_POLY POLY
ON POLY.RE_UNIQUE_ID = MEDCO.RE_UNIQUE_ID)
This is working.
Can you please let me know what is that i need to do if i want to add more columns in the select clause after
this line ON POLY.REUNIQUE_ID = MEDCO.RE_UNIQUE_ID)_
Thanks.
A query (not counting sub-queries) has, at most, only one of each type of clause: one SELECT clause, followed by one FROM clause, followed (optionally) by one WHERE clause. All items to be returned go together in the one SELECT clause. All tables needed are named in the on FROM clause. All filtering conditions go together in the one WHERE clause.
Perhaps you meant something like this:
SELECT  'Diff'           AS SC
,          POLY.ID
,           ALTID.B_SYS_ID
,       NULL AS BEG_DT
,     NULL AS ID
FROM     N08.B_ALT_ID_TB ALTID
JOIN    N09.T_POLY     POLY   ON  altid.column_a  = poly.column_b
WHERE      ALTID.B_ALT_ID     IN (
                      SELECT  MEDCO.RE_MEDCD_ID_NUM 
                         FROM    N09.T_MEDCD_ID           MEDCO
                         WHERE   POLY.RE_UNIQUE_ID      = MEDCO.RE_UNIQUE_ID
                  )With the little information I have, I can't even guess what the real join condition(s) might be. I used
ON  altid.column_a  = poly.column_bjust to show the correct syntax.

Similar Messages

  • Top N query giving error for oracle 8.0.6

    Dear All,
    We are executing this query SELECT XBLNR, WERKS, MATNR, MDV01, BACKFLQUANT, STATUS, SAPTIMESTAMP, PITSTIMESTAMP, PMTIMESTAMP, BATCH FROM (SELECT XBLNR, WERKS, MATNR, MDV01, BACKFLQUANT, STATUS, SAPTIMESTAMP, PITSTIMESTAMP, PMTIMESTAMP, BATCH FROM PMBPITS.PITS_UNITY WHERE STATUS = '01' ORDER BY PMTIMESTAMP) WHERE ROWNUM < 20
    on oracle 8.0.6 but this is giving the following error
    ora - 00907 missing right parenthesis error
    1. Is it that in the inner select we cannot use order by and where clause together.
    2. We also found that if we remove order by from inner select then the query is not giving error
    pls help . points will be awarded

    Hi,
    what ever the Aman said is correct. You check this is supported in 8.1.5, SQL allows you to embed the ORDER BY clause in a subquery and place the ROWNUM condition in the top-level query;
    'Top-N query' is a ORACLE 8i feature which is supported in SQL. However,
    Bug:855720 states the following:
    "PL/SQL does not support top-N queries (ORDER BY in SUBSELECT/SUBQUERY
    or VIEW. Since this feature is available in SQL, but not in PL/SQL,
    it has been logged as a Bug that will be fixed in 8.1.6."
    - Pavan Kumar N

  • Select query giving Time out dump

    Hi All,
        I have written a select query on a table in BW system.The code for the same is attached below.The table contains some 6,00,000 records.This query is giving a time out error.Kindly look into the query and advice ways to make it work.Thanks.
        IF NOT lt_temp[] IS INITIAL.
          SELECT /bic/zprrmatnr objvers /bic/zprclwynr /bic/zprrmdlr
                 FROM  /bic/pzprrmatnr
                 INTO CORRESPONDING FIELDS OF TABLE lt_zprrmatnr
                 FOR ALL ENTRIES IN lt_temp
                 WHERE /bic/zprclwynr = lt_temp-temp
                 AND   objvers = 'A'.
        ENDIF.
    Thanks and Regards,
    Faisal

    Not only is it BW, it is also a customer table. Have a look here on how to research yourself:
    Please Read before Posting in the Performance and Tuning Forum
    Thomas

  • Select-options in SELECT query - syntax error

    Hi all,
      I get the error below when I try to use the select options in a SELECT query . Please help me.
    "The IN operator with "SO_AWART" is followed neither by an internal
    table nor by a value list."
    The code i have used(Logical database  PNP is used):
    TABLES: pernr,
            catsdb.
    INCLUDE ztime_cwtr_top.    " global Data
    INCLUDE ztime_cwtr_f01.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    SELECT-OPTIONS SO_AWART FOR CATSDB-AWART.
    PARAMETERS P_THRES TYPE I.
    SELECTION-SCREEN END OF BLOCK B1.
    Get data from CATSDB table. Workdates within the date interval are considered.
      SELECT pernr workdate awart catsquantity beguz enduz status
      FROM catsdb
      INTO TABLE it_catsdb
      WHERE pernr  = pernr-pernr    AND
           workdate GE pn-begda     AND
           workdate LE pn-endda     AND
           status   IN ('20', '30') AND
           awart    IN  so_awart .
          awart    IN ('1100', '1137', '1138', '1139', '1140',
                      '1147', '1148', '1149', '1157', '2003' ).
    when I give the values directly i do not get any syntax error, but when I use select options in the where condition I get the syntax error.
    I have tried different options like using only the select-options in the where condition.
    Thanks in advance.....
    Madhu

    Solved.
    Code with syntax error:
    include z...top .
    include z...fo1.
    select-options: xxxxxxx
    Code  with no syntax error:
    select-options: xxxxxxx
    include z...top .
    include z...fo1.
    Thanks for all your help,
    Madhu

  • Select query - timeout error

    hi experts,
    I have written a pgm where i need to select records from BSAD table. This table has about 10 key fields. But according to my requirement, i can pass only 2 key fields to the table and have to fetch records from this table.  But it goes to dump (timout error) in BSAD select query.
    So  i have used PACKAGE SIZE 20 and tried to fetch only 20 records at a time from the table. But still, it takes lot of time in fetching records from BSAD table.
    Pls tell me what is the solution to avoid timeout error and how to fetch the records quickly.
    Regards,
    Shanthi

    I hope that your " two fields"  are BUKRS and KUNNR.  
    Consider this:  If I can't supply a value for the first field (after mandt), then the second, etc., the select is going to run FOREVER.  I think that, if you used ST05 and explained the BSAD open, you would see the problem. I'm guessing that you're not supplying a value for BUKRS, etc., and thereby causing a full table scan.   Or you may have supplied NOT operators in the where clause or included an order by statement.  Current ABAP CHECK tools (like SLIN or SCID) should point out problems in the where statement also...
    May I suggest utilizing SE11 and looking at BS* tables to see if there is an alternative data source where you can supply an EQ value for the first few fields (at least) of the index?  Or, post psuedocode so that the forum users can help you out.

  • Select query giving dump

    Hi,
    We have a select query written as below:
    SELECT  counter
                stokz
                pernr
                workdate
                rnplnr
                catshours
          FROM catsps
          INTO TABLE t_catsps
          WHERE pernr IN r_pernr
          AND   workdate IN s_wrkdt
          AND   rnplnr IN s_ntwrk
          AND   belnr IN s_docno
          AND   transfer NE 'X'.
    Here, the range which we are using has a record of more than 16000. At this particular portion of the code the program dumps. I suspect it is due to the excessive data records in the ranges option. Is there any remedy for this situation. Please help!

    Hi,
    check the inetrnal table strcure field are of same type of catsps table field which you are fetching
    Or try to USe into corresponding fields of table t_catsps.
    "check the inetrnal table strcure field are of same
    "type of catsps table field which you are fetching
    SELECT  counter
                 stokz
                 pernr
                 workdate
                 rnplnr
                 catshours
           FROM catsps
           INTO TABLE t_catsps   'Or try to USe into corresponding fields of table t_catsps
           WHERE pernr IN r_pernr
           AND   workdate IN s_wrkdt
           AND   rnplnr IN s_ntwrk     "check rnplnr and  s_ntwrk     are of same type
           AND   belnr IN s_docno      "Check belnr and s_docno are of same type
           AND   transfer NE 'X'.
    "hadle sy-subrc
    prabhudas
    Edited by: Rob Burbank on Sep 22, 2010 9:32 AM

  • Select...Model query giving error when compiled in form6i's WVI trigger

    friends i have this installed at my home;
    Forms [32 Bit] Version 6.0.8.25.2 (Production)
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    and i have a query which is running fine at the back-end,
    select avgprice
    from (
    select t.*
    from (
    select seq_no
    , invxh_DATE
    , INVXH_code
    , invxh_No
    , invxH_total_qty
    , INVXH_net_AMOUNT_Scy INVXH_net_AMOUNT_Scy
    , balqty
    , ROUND(balamt, 3) balamt
    , ROUND(avgprice, 10) avgprice
    , ROUND(cost, 3) cost
    from (select b.*,
    sum(decode(invxh_code, 'BUY', INVXH_total_QTY, -INVXH_total_QTY)) OVER (ORDER BY INVXh_DATE) BALQTY,
    row_number() over (order by INVXH_date) seq_no
    from invs_TXN_head b
    where INVXH_BROK_code = 'B00001'
    aND INVXH_Securit_CODE = 'S00001'
    and INVXH_date < to_DATE('25/02/2008','dd/mm/yyyy'))
    model
    dimension by (seq_no)
    measures (invxh_DATE
    , INVXh_code
    , INVXH_no
    , INVXH_total_qty
    , balqty
    , INVXH_net_AMOUNT_Scy
    , 0 balamt
    , 0 balamt2
    , 0 avgprice
    , 0 cost)
    rules (
    balamt[seq_no is any] = nvl(balamt[cv() - 1], 0) +
    decode(INVXH_code[cv()], 'BUY', INVXH_net_AMOUNT_Scy[cv()] , -(balamt[cv() -1] /
    balqty[cv() -1] * invxh_TOTAL_qty[cv()]) ) ,
    cost[seq_no is any] = decode(INVXH_code[cv()], 'SEL', balamt[cv() -1] /
    balqty[cv() -1] * invxh_TOTAL_qty[cv()], 0),
    avgprice[seq_no is any] = decode(INVXH_code[cv()], 'BUY', balamt[cv()] /
    balqty[cv()] , avgprice[cv() - 1])
    ) t
    order by seq_no desc
    ) where rownum = 1
    AVGPRICE
    2.17612187560
    but when i try make use of this query in 1 of my form Item's When-Validate-Trigger, replacing with form variables,
    declare
         avgprice1 number;
    begin
    select avgprice INTO AVGPRICE1
    from (
    select t.*
    from (
    select seq_no
    , invxh_DATE
    , INVXH_code
    , invxh_No
    , invxH_total_qty
    , INVXH_net_AMOUNT_Scy INVXH_net_AMOUNT_Scy
    , balqty
    , ROUND(balamt, 3) balamt
    , ROUND(avgprice, 10) avgprice
    , ROUND(cost, 3) cost
    from (select b.*,
    sum(decode(invxh_code, 'BUY', INVXH_total_QTY, -INVXH_total_QTY)) OVER (ORDER BY INVXh_DATE) BALQTY,
    row_number() over (order by INVXH_date) seq_no
    from invs_TXN_head b
    where INVXH_BROK_code = :INVXH_brok_CODE
    aND INVXH_Securit_CODE = :invxh_Securit_CODE
    and INVXH_date < to_DATE('25/02/2008','dd/mm/yyyy'))
    model
    dimension by (seq_no)
    measures (invxh_DATE
    , INVXh_code
    , INVXH_no
    , INVXH_total_qty
    , balqty
    , INVXH_net_AMOUNT_Scy
    , 0 balamt
    , 0 balamt2
    , 0 avgprice
    , 0 cost)
    rules (
    balamt[seq_no is any] = nvl(balamt[cv() - 1], 0) +
    decode(INVXH_code[cv()], 'BUY', INVXH_net_AMOUNT_Scy[cv()] , -(balamt[cv() -1] /
    balqty[cv() -1] * invxh_TOTAL_qty[cv()]) ) ,
    cost[seq_no is any] = decode(INVXH_code[cv()], 'SEL', balamt[cv() -1] /
    balqty[cv() -1] * invxh_TOTAL_qty[cv()], 0),
    avgprice[seq_no is any] = decode(INVXH_code[cv()], 'BUY', balamt[cv()] /
    balqty[cv()] , avgprice[cv() - 1])
    ) t
    order by seq_no desc
    ) where rownum = 1;
    :INVXH_gainloSs_AMOUNT_lcy := :INVXH_NET_AMOUNT_Scy - (:INVXH_TOTAL_QTY * avgprice1);
    end;
    it does'nt get complied & gives error as;
    Encountered the symbol "(" when expecting one of the following
    +, from+
    its actually pointing to this line of the above query;
    sum(decode(invxh_code, 'BUY', INVXH_total_QTY, -INVXH_total_QTY)) OVER (ORDER BY INVXh_DATE) BALQTY,
    at this position...*OVER (...*
    is it a form6i-10g compatibility issue or what else..?
    TYVM

    ok,, i have put my code in a stored function 'WTAG1' in the database. its working fine at the back-end.
    i am calling it now from forms WVI trigger in this way;
    declare
         avgprice1 number(14,10);
    begin
         avgprice1 := GET_WTAVG(:invxh_BROK_code, :INVXH_securit_CODE, TO_DATE(:INVXH_DATE,'DD/MM/YYYY'));      
    :INVXH_gainloSs_AMOUNT_lcy := :INVXH_NET_AMOUNT_Scy - (:INVXH_TOTAL_QTY * NVL(avgprice1,0));
    end;
    at run time m getting ORA-06502 ERROR,dont know why..?
    :INVXH_gainloSs_AMOUNT_lcy property is 9,999,999.000
    AT the back-end the query works fine aS below;
    SQL> @WTAG1
    Function created.
    SQL> SELECT GET_WTAVG('B00001','S00001',TO_DATE('27/4/2008','DD/MM/YYYY')) AG FROM DUAL;
    AG
    2.1761218756
    this iS my function;
    create or replace function GET_WTAVG(P_BROK_CODE IN VARCHAR2, P_SECURIT_CODE IN VARCHAR2, P_DATE IN DATE)
    return NUMBER Is
      v_avgprice NUMBER(14,10);
    BEGIN
    SELECT avgprice INTO V_avgprice
      FROM   (SELECT t.*
              FROM   (SELECT seq_no,
                             invxh_date,
                             invxh_code,
                             invxh_no,
                             invxh_total_qty,
                             invxh_net_amount_scy invxh_net_amount_scy,
                             balqty,
                             round(balamt, 3) balamt,
                             round(avgprice, 10) avgprice,
                             round(cost, 3) cost
                      FROM   (SELECT b.*,
                                     SUM(decode(invxh_code,
                                                'BUY',
                                                invxh_total_qty,
                                                -invxh_total_qty)) over(ORDER BY invxh_date) balqty,
                                     row_number() over(ORDER BY invxh_date) seq_no
                              FROM   invs_txn_head b
                              WHERE  invxh_brok_code = P_BROK_CODE
                              AND    invxh_securit_code = P_sECURIT_CODE
                              AND    invxh_date < to_char(P_DATE,'DD/MM/YYYY'))
    model
    dimension BY(seq_no)
    measures(invxh_date
    , invxh_code
    , invxh_no, invxh_total_qty
    , balqty
    , invxh_net_amount_scy
    , 0 balamt
    , 0 balamt2
    , 0 avgprice
    , 0 cost)
    rules
    balamt[seq_no IS ANY] = nvl(balamt[cv() - 1], 0) +
                            decode(invxh_code[cv()], 'BUY', invxh_net_amount_scy[cv()], - (balamt[cv() - 1] /
                            balqty[cv() - 1] * invxh_total_qty[cv()])),
    cost[seq_no IS ANY]   = decode(invxh_code[cv()], 'SEL', balamt[cv() - 1] /
                            balqty[cv() - 1] * invxh_total_qty[cv()], 0),
    avgprice[seq_no IS ANY] = decode(invxh_code[cv()], 'BUY', balamt[cv()] / balqty[cv()], avgprice[cv() - 1]))) t
              ORDER  BY seq_no DESC)
      WHERE  rownum = 1;
    RETURN V_avgprice;
    exception
    when TOO_MANY_ROWS
    then return 'Too Many Authors in that State';
    when NO_DATA_FOUND
    then return 'No Authors in that State';
    when others
    then raise_application_error(-20011,'Unknown Exception in authName Function');
    END GET_WTAVG;
    /

  • Select query gives error in Code inspector and extended program check

    Hi,
    I have a query .
    SELECT pernr
      FROM pa9100
      INTO TABLE t_nca_tab
      WHERE endda EQ c_date AND
      z_nca_required EQ c_yes.
    This query gives me an error in Code inspector like :
    Large table pa0001: No first field of table index in WHERE  condition
    I have one more query that gives error in extended program check
    SELECT SINGLE stell ename
          INTO (g_stell, g_name)
          FROM pa0001
          WHERE pernr EQ wa_nca_tab-pernr AND
                endda EQ c_date.
    The warning says:
    *In "SELECT SINGLE ...", the WHERE condition for the key field "SEQNR" does not
    test for equality. Therefore, the single record in question may not be unique.*
    Its too urgent.
    Please reply.
    Regards,
    Binay.

    The first field is PERNR .. so if UR not giving pernr it will fetch
    all the data from the said table and between the given dates ..
    Check if this is your requirement ...
    write the select as ...
    where r_pernr is a range ...
    SELECT pernr
    FROM pa9100
    INTO TABLE t_nca_tab
    WHERE pernr in r_pernr  <----
                 endda EQ c_date AND
                 z_nca_required EQ c_yes.
    As UR using select single it's expecting to use all the key
    fields in the where condition ...
    U can ignore this warning message

  • Full outer join query giving error

    Hi I have written the below query to get the fields below as an out put but am getting the error missing keyword..am not understanding where did i missed..i have done step by step query analysis..but could not find the error.
    Please help me in resolving the issue.
    Expected output Columns :*
    COUNTRY , TRN_TYPE ,SKU ,BIX_Customer ,PERIOD ,CURRENTSTOCK ,STOCK_VALUE ,SALES ,SALES_VALUE ,TARGET
    Query :_
    select (case when a.country is null then b.country when b.country is null then c.country else a.country end) AS COUNTRY,
    (case when a.Sale_Type is null then b.Stk_type when b.stk_type is null then c.Stk_type else a.Sale_Type end) AS TRN_TYPE,
    (case when a.sku is null then b.sku when b.sku is null then c.sku else a.sku end) AS SKU,
    (case when a.bix_customer is null then b.bix_customer_code when b.bix_customer_code is null then c.bix_customer_code else a.bix_customer end)AS BIX_Customer ,
    (case when a.period is null then TO_number(b.period) when b.period is null then TO_NUMBER(c.period) else a.period end) AS PERIOD,
    nvl(b.CURRENTSTOCK,0) AS CURRENTSTOCK,
    nvl(b.stock_value,0) AS STOCK_VALUE,
    nvl(a.sales,0) AS SALES,
    nvl(a.SALES_VALUE,0) AS SALES_VALUE,
    nvl(c.TARGET_QTY,0) AS TARGET
    from
    (select UPPER(c.cust_country_name) AS COUNTRY,
    DECODE(ds.account_key,7156,'SAMPLE',7157,'BONUS',7485,'SALE') AS Sale_Type,
    substr(i.item_code,7) AS SKU,
    c.bix_customer_code AS BIX_Customer,
    ds.descr as descr ,
    ds.period as period,
    sum(ds.quantity) AS SALES,
    sum(case when ds.local_value is null then ds.euro_value else ds.local_value END) AS SALES_VALUE
    FROM distributor_sales ds, customer c, item i
    where ds.customer_key=c.customer_key
    and ds.item_key= i.item_key
    group by ds.period,
    ds.account_key,
    c.cust_country_name,
    substr(i.item_code,7),
    c.bix_customer_code,
    ds.descr) a
    full outer join
    (SELECT UPPER(b.cust_country_name) AS COUNTRY,
    DECODE(s.stock_type,'SALE','SALE','SALES','SALE','BONUS','BONUS','SAMPLE','SAMPLE') AS Stk_type,
    substr(c.item_code,7) AS SKU,
    s.descr as descr,
    s.period as period,
    b.bix_customer_code,
    sum(s.CLOSING_STOCK) CURRENTSTOCK,
    sum(s.closing_stock*s.cif_price) STOCK_VALUE
    FROM STOCK s, customer b, item c
    WHERE s.customer_key=b.customer_key
    and s.item_key= c.item_key
    group by
    s.descr,
    s.stock_type,
    s.period, b.bix_customer_code,b.cust_country_name,substr(c.item_code,7) ) b
    full outer join
    (SELECT UPPER(cu.cust_country_name) AS COUNTRY,
    DECODE(t.description,'SALES TARGET','SALE') AS Stk_type,
    substr(it.item_code,7) AS SKU,
    t.channel as channel,
    t.period as period,
    cu.bix_customer_code as bix_customer_code,
    sum(t.quantity) TARGET_QTY
    FROM sales_target t, customer cu, item it
    WHERE t.customer_key=cu.customer_key
    and t.item_key= it.item_key
    group by
    t.channel,
    t.description,
    t.period, cu.bix_customer_code,cu.cust_country_name,substr(it.item_code,7) ) c
    on a.SKU=b.SKU
    and a.sku=c.SKU
    and b.sku=c.SKU
    and a.BIX_Customer=b.bix_customer_code
    and a.BIX_Customer=c.bix_customer_code
    and b.bix_customer_code=c.bix_customer_code
    and a.Sale_Type=b.Stk_type
    and a.Sale_Type=c.Stk_type
    and b.Stk_type=c.Stk_type
    and a.descr=b.descr
    and b.descr=c.channel
    and a.descr=c.channel
    and a.country=b.country
    and a.country=c.COUNTRY
    and b.country=c.COUNTRY
    and a.period=b.period
    and a.period=c.period
    and b.period=c.period;

    <tt>Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production</tt>
    You must be aware that you must cascade full outer joins
    with
    t1 as
    (select 1 key,1.1 data from dual union all
    select 3,1.3 from dual union all
    select 6,1.6 from dual union all
    select 7,1.7 from dual
    t2 as
    (select 2 key,2.2 data from dual union all
    select 3,2.3 from dual union all
    select 4,2.4 from dual union all
    select 6,2.6 from dual
    t3 as
    (select 4 key,3.4 data from dual union all
    select 5,3.5 from dual union all
    select 6,3.6 from dual union all
    select 7,3.7 from dual
    select nvl(x.key,t3.key) key,
           x.data_1,
           x.data_2,
           t3.data data_3
      from (select nvl(t1.key,t2.key) key,
                   t1.data data_1,
                   t2.data data_2
              from t1
                   full outer join
                   t2
                on t1.key = t2.key
           ) x
           full outer join
           t3
        on t3.key = x.key
    order by keyunless you can live with duplicate key rows you cannot avoid whenever all table pairs contain common keys (try the below using data from above)
    select coalesce(t1.key,t2.key,t3.key) key,
           t1.data data_1,
           t2.data data_2,
           t3.data data_3
      from t1
           full outer join
           t2
        on t1.key = t2.key
           full outer join
           t3
        on t3.key = t1.key
       and t3.key = t2.key
    order by key
    select coalesce(t1.key,t2.key,t3.key) key,
           t1.data data_1,
           t2.data data_2,
           t3.data data_3
      from t2
           full outer join
           t3
        on t2.key = t3.key
           full outer join
           t1
        on t1.key = t2.key
       and t1.key = t3.key
    order by key
    select coalesce(t1.key,t2.key,t3.key) key,
           t1.data data_1,
           t2.data data_2,
           t3.data data_3
      from t1
           full outer join
           t3
        on t1.key = t3.key
           full outer join
           t2
        on t2.key = t1.key
       and t2.key = t3.key
    order by keyRegards
    Etbin
    Edited by: Etbin on 10.4.2013 9:53
    If you're after
    select *
      from (select *
              from (select *
                      from t1
                   ) a
                   full outer join
                   (select *
                      from t2
                   ) b
                on t1.key = t2.key
           ) x
           full outer join
           t3
        on t3.key = x.key
    order by keyyou're presently at
    select *
      from (
                   (select *
                      from t1
                   ) a
                   full outer join
                   (select *
                      from t2
                   ) b
                on t1.key = t2.key
           ) x
           full outer join
           t3
        on t3.key = x.key
    order by keyORA-00933: SQL command not properly ended

  • SQL Query giving error in SAP B1 8.82 PL 09

    Hi all,
    Please check the query below.
    If we remove the Where condition from the Query it works fine.
    Otherwise it gives error. The error screen is also attached.
    [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types ntext and
    ntext are incompatible in the equal to operator. 'Blanket Agreement'(OOAT)(OUQR)

    Dear Nagarajan K,
    First of all Thank You for prompt reply to my query.
    Select * from oinv T0 where T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
    The issue with the above posted query is if you remove the filter conditions i.e where T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
    The query works.
    Put the filter condition back and it gives eror:
    [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types ntext and
    ntext are incompatible in the equal to operator. 'Blanket Agreement'(OOAT)(OUQR)
    What is possibly going wrong because data is there.

  • Post query giving error

    Declare
    cursor fin_ACNTs IS
    SELECT aCODE,dr,cr,seq
    FROM acnts
    where CCODE = :xH_ccode
    and Tcode = :XH_tCODE
    aND tNO = :xh_Tno
    order by seq;
    total_rows NUMBER;
    the above query will return 2 or 3 rows. for example,
    aCODE DR CR SEq
    P30737 1907.600 .000 B1
    P30737 .000 1907.600 B2
    I have 3 rows wise control fields on my form canvas
    r1c1 r1c2 r1c3 r1c4
    r2c1 r2c2 r2c3 r2c4
    r3c1 r3c2 r3c3 r3c4
    & I want to Store the above query result in Such way that
    the 1st row returned should be saved in r1c1 r1c2 r1c3 r1c4
    and the 2nd row returned in r2c1 r2c2 r2c3 r2c4
    if the query returns 2 rows
    i tried to incorporate it in thiS way, but needs SOme help;
    declare
    cursor fin_ACNTs IS
    SELECT aCODE,dr,cr,seq
    FROM acnts
    where CCODE = :xH_ccode
    and Tcode = :XH_tCODE
    aND tNO = :xh_Tno
    order by seq;
    total_rows NUMBER;
    begin
    FOR i IN fin_ACNTs LOOP
    :ctrl.Rc1 := i.aCODE;
    :ctrl.R[i]C2 := i.dr;
    :ctrl.R[i]C3 := i.cr;
    :ctrl.R[i]C4 := i.seq;
    num_total_rows := fin_ACNTs%ROWCOUNT;
    END LOOP;
    end;
    while compling the trigger am getting the errors;
    Error 49 line 15 column 5
    Bad bind var :ctrl.R
    Error 103 line 15 column 5
    Encountered th symbol "[" when expecting one of the following
    := . ( @ % ; indicator

    TYVM, Mr. Kuba,
    those 4 rows r1c1....did get filled properly. I have now 1 more problem. about this form so,
    I have a columnar tables
    inventotry_header (Inv_head) and
    inventory_detail (Inv_detail)
    in post-database-commit i am saving some details in to a 3rd table, ACNTS
    Inv_head is linked to inv_detail thru primary-foreign key, table ACNTS is independant.
    i have joined inv_head==>ACNTs in forms.
    i wrote this post-query Suggested by you. i want to display ONLY the control fields r1c1.....
    derived from the acnts table in post query and keep acnts table fields hidden.
    the acnts table should just be saved in the background(in post-database-commit) and
    its values will be displayed on form thru the control fields.
    but when i make the visible property of the acnts table fields to "NO", the post query result does not display
    the control fields r1c1.... and on querying, at first record it gives error,
    FRM-40106 No navigable items in destinations block
    and why i dont want to use the acnts tables for display, because i want to assign & display the control fields
    as i enter the details in inv_head and inv_detail, in the sequence of r1c1 r1c2 r1c3 r1c4....
    which i dont think will be possible with acnts tables (which is a linked actual db table).
    hope i have made it clear.

  • Select query giving ora-01555. Need help with tuning

    Hi,
    Following query of mine fails with ORA-01555:
    select xx from a where a.xx NOT IN (select xx from b where status=0)
    Tables a & b have million rows approx. How can I tune the query (to remove "NOT IN").
    The explain plan is:
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=705828732 Card=55061 Bytes=3468843)
    1 0 FILTER
    2 1 TABLE ACCESS (FULL) OF 'A' (Cost=1773 Card=55061 Bytes=3468843)
    3 1 PARTITION RANGE (ITERATOR)
    4 3 PARTITION LIST (ALL)
    5 4 TABLE ACCESS (FULL) OF 'B' (Cost=12819 Card=45553 Bytes=2596521)
    Thanks,
    Prachi

    You could try:
    select xx from a
    minus
    select xx from b
    where  status = 0;But it's not likely to be any better and it won't solve your ora-1555.
    The problem is not your select statement but some other process that is updating the rows you need and overwriting rollback segments.
    Do you have a large update process that is committing in a cursor for loop?

  • Infoset query giving error post upgrade

    Hi All,
    We have upgraded our system from BW 3.5 to BI 7. Post upgrade we are getting error while opening/executing queries on infoset.
    In ST22 the error is UNCAUGHT_EXCEPTION -CX_RSD_NAME_ERROR.
    The infoset is active.
    Thanks for the help.
    Regards,
    Niraj

    Dear Both,
    I resolved the problem by applying the solution suggested by Wond.
    The SP details are as below,
    SAP_BW     700     0015     SAPKW70015     SAP NetWeaver BI 7.0
    We were facing this issue in development system. We didn't faced this issue in sandbox which was a copy of production. We are in process of upgrading now quality.
    Points assigned to Wond.
    Thanks to both for help.
    Regards,
    Niraj

  • Select query output needed

    Hi
    SELECT CUREPRESS,PRODUCTIONCODE,YYYYMMDD STARTDATE,
    CASE
    WHEN SCHEDULE1 = 0 AND SCHEDULE2 = 0 AND SCHEDULE3 >0 AND ROUND(30-SCHEDULE3/CURECAPACITY*24,0)>24 THEN
              ROUND(30-(SCHEDULE3/CURECAPACITY*24),0)-24
    WHEN SCHEDULE1 = 0 AND SCHEDULE2 = 0 AND SCHEDULE3 >0 AND ROUND(30-SCHEDULE3/CURECAPACITY*24,0)<=24 THEN
              ROUND(30-SCHEDULE3/CURECAPACITY*24,0)
    WHEN SCHEDULE1 = 0 AND SCHEDULE2 >0 AND SCHEDULE3 >0 THEN
    ROUND(22-SCHEDULE2/CURECAPACITY*24,0)
    WHEN SCHEDULE1 > 0 AND SCHEDULE2 >0 AND SCHEDULE3 >0 THEN
    ROUND(14-SCHEDULE1/CURECAPACITY*24,0)
    END STARTDATE1
    FROM (
    SELECT curepress,PRODUCTIONCODE,YYYYMMDD,schedule1,schedule2,schedule3,curecapacity
    FROM ORGCURESCHEDULEDAY A
    WHERE YYYYMMDD = (SELECT MIN(YYYYMMDD)
    FROM ORGCURESCHEDULEDAY B
    WHERE A.PRODUCTIONCODE=B.PRODUCTIONCODE
    AND A.CUREPRESS =B.CUREPRESS )
    )GROUP BY PRODUCTIONCODE,CUREPRESS,YYYYMMDD,SCHEDULE1,SCHEDULE2,SCHEDULE3,CURECAPACITY
    ORDER BY CUREPRESS,PRODUCTIONCODE
    The above query gives 4 column values like..!!
    curepress productioncode startdate startdate1
    0101      IO72A     20110412     22 -------> case statement gives this value as startdate1
    0101      OQ36A     20110221     6
    I want to display the output like startdate1 as (startdate + statedate1)
    curepress productioncode startdate startdate1
    0101      IO72A     20110412     20110412 22.00
    0101      OQ36A     20110221     20110221 06.00
    please help me ...!!
    regards
    Karanam

    Please don't duplicate your questions.
    select query giving error
    Locking this thread.

  • Error while executing Select Query

    Hi All,
    I am getting following error in Sender JDBC Channel.
    u201CDatabase-level error reported by JDBC driver while
    retrieving the result set metadata for the select Query. Error message returned by the
    JDBC driver: 'java.sql.SQLException: Closed Statement: getMetaDatau201D.
    What might be the actual cause of this problem? please reply.

    Hi Sudeep,
    Please check the SQL query that you are trying to execute on the DB. Also, check if it gives a correct result. The problem seems to be with the SQL query or the result of this SQL query.
    I would suggest you to run the same query on the DB & see the result first and then try executing the same query via the JDBC adapter.
    Regards, Gaurav.

Maybe you are looking for

  • Problems importing my songs to Phase (game)

    I bought the iPod scroll wheel game Phase today. The game uses your own songs in the game, allowing you to rhythmically use your scroll wheel to follow the song (similar to Guitar Hero or Dance Dance Revolution). You are supposed to put your songs on

  • TS1389 itunes store does not give the option to authorise my computer

    i do not the option in my account to authorise my computer. where is the authorise button??

  • Database Error: (Error : WIS 10109)

    Hello, i get following error message when i want to have a look at the preview of a webservice in QaaWS with an user which has only the rights for the query which is used to build the universe on BO side:: getDocumentInformation exception (Error : WI

  • Lost 24 hours of all data after 10.9.2

    Lost everything done in the last 24 hours after update this morning to 10.9.2:  email, files, downloads, everything.  Never had this problem with a system upgrade before.  Anyone else with this issue? 

  • One Catalogue Multiple Computers

    Is it possible to set up one lightroom catalog on a server so that multiple computers can all have access to it?