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.

Similar Messages

  • Query running ok in SQL but giving error in form trigger

    Hi guys
    here is the query
    SELECT NVL(BGM_PERAMT,0) INTO PERAMT FROM BROKERAGE_MASTER
    WHERE     BGM_BROKERAGETYPE = 'BR01' AND BGM_PERAMT <> 0
    The above query working fine in SQL but giving following error in when_button_pressed trigger
    [In a host language program, all records have been fetched. The return code from the fetch was +4 indicating that all records have been returned from the SQL query. ]
    please give me the solution for this problem.
    It is very urgent
    regards
    asha

    ok below is the code
    CURSOR RESALE_BROKERAGE IS SELECT am_brokerCd resalebrcd,'' resalesbrcd,NVL(SUM(AM_AMT),0) RESALE_AMT,COUNT(AM_RESALENO) TOTCNT,NVL(SUM(AM_UNITSAPPLD),0) RESALE_UNITS
    FROMRNT_RESALE_MASTER
    WHERE am_brokercd is not null AND AM_PROCTAG='Y' AND
    (to_date(to_char(AM_PROCDT,'DD/MON/YYYY')) BETWEEN
    to_date(to_char(:rnt_broker_date.fromdt,'DD/MON/YYYY')) AND
    to_date(to_char(:rnt_broker_date.todate,'DD/MON/YYYY')))
    GROUP BY am_brokerCd
    UNION
    SELECT AM_BROKERCD resalebrcd,     
    am_subbrokercd resalesbrcd,
    NVL(SUM(AM_AMT),0) RESALE_AMT,COUNT(AM_RESALENO) TOTCNT,
    NVL(SUM(AM_UNITSAPPLD),0) RESALE_UNITS
    FROM RNT_RESALE_MASTER
    WHERE     am_brokercd is not null AND AM_PROCTAG='Y' AND AM_BROKERCD = 'ARN-9760' AND (to_date(to_charAM_PROCDT,'DD/MON/YYYY')) BETWEEN
    to_date(to_char(:rnt_broker_date.fromdt,'DD/MON/YYYY')) AND
    to_date(to_char(:rnt_broker_date.todate,'DD/MON/YYYY')))
    GROUP BY AM_BROKERCD,am_subbrokercd;
    Asha

  • 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

  • Display SQL query in error text

    Using CFMX 6.1.
    Is it possible to get our error handler page to display the
    SQL query that fails and causes an error?
    If tried #error.sql# but it doesn't exist after a db
    exception. If I put a cftry around a particular query and then use
    cfcatch.sql within a cfcatch tag pair, it works fine. But given our
    error handler page is for the entire site, I can't use cfcatch, at
    least not the way the site is currently architected. I was hoping
    error.sql would work since my quick ref quide states that "Any
    cfcatch variable that applies to exception type can be accessed
    within the Error scope. But then it doesn't list Error.SQL or
    CFCATCH.SQL for that matter in any documentation I've seen, yet the
    later works in cfcatch tags.
    Any help would be appreciated.

    You don't have to place a CFTRY/CFCATCH around each query. I
    don't know how many pages you have in your application, but you
    could do something like the following:
    1. Replace <body> with <body><CFTRY>
    2. Replace </body> with the following
    <CFCATCH TYPE="database">
    <CFMODULE TEMPLATE="customErrorPage.cfm"
    sqlStatement="#CFCATCH.Sql# " message="#CFCATCH.message#">
    </CFCATCH>
    </CFTRY>
    </body>
    You can use a global search-and-replace utility, such as
    SR32, to make this task painless. Click
    here to go to the SR32
    site.

  • When connecting to database in SQL* plus giving Error

    hi,
    I am using Oracle 10g. My problem is when i connecting to database in Server through SQL * Plus giving the Error:
    ORA-12514: TNS:listerner does not currently know of service requested in connect descriptor.
    Why this is happening i don't know. I created listener also. But no use. How to solve this can any tell me pls... ! .
    Thank u...!

    hi,
    Thank u bang for u r reply. It is not working sir. I added the listener as follows:
    # listener.ora Network Configuration File: D:\oracle10g\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = HA14)(PORT = 1521))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = D:\oracle10g)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = OVSL06)
    (ORACLE_HOME = D:\oracle10g)
    (SID_NAME = OVSL06)
    (SID_DESC =
    (GLOBAL_DBNAME = OVSL06)
    (ORACLE_HOME = D:\oracle10g)
    (SID_NAME = OVSL06)
    I typed the following commands in command prompts
    C:\>lsnrctl
    LSNRCTL for 32-bit Windows: Version 10.1.0.2.0 - Production on 30-MAY-2007 16:29
    :14
    Copyright (c) 1991, 2004, Oracle. All rights reserved.
    Welcome to LSNRCTL, type "help" for information.
    LSNRCTL> stop
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HA14)(PORT=1521)))
    The command completed successfully
    LSNRCTL> start
    Starting tnslsnr: please wait...
    TNSLSNR for 32-bit Windows: Version 10.1.0.2.0 - Production
    System parameter file is D:\oracle10g\network\admin\listener.ora
    Log messages written to D:\oracle10g\network\log\listener.log
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HA14)(PORT=1521)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROCipc)
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HA14)(PORT=1521)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for 32-bit Windows: Version 10.1.0.2.0 - Produ
    ction
    Start Date 30-MAY-2007 16:29:28
    Uptime 0 days 0 hr. 0 min. 2 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File D:\oracle10g\network\admin\listener.ora
    Listener Log File D:\oracle10g\network\log\listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HA14)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROCipc)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    same error is getting as i am getting previously. Tell me solution pls....!
    Thank u...!

  • Data Loading using SQL* Loader giving errors..

    While loading the data using SQL* Loader, I came across the following errors:
    - SQL*Loader-00604 Error occurred on an attempt to commit
    - ORA-01041 internal error. hostdef extension doesn't exist
    My Control and Data files have proper Carriage Returns i.e. the last line of both the files is blank.
    So, if somebody know about this, plz help me.
    Thanx

    ORA-00604 error occurred at recursive SQL level string
    Cause: An error occurred while processing a recursive SQL statement (a statement applying to internal dictionary tables).
    Action: If the situation described in the next error on the stack can be corrected, do so; otherwise contact Oracle Support Services
    This kind of error occurs when data dictionary is
    query a lot.
    Joel P�rez

  • Inline transform for Sql Query not working in SAP MII 12.1 Version 12.1.8 B

    Hi All,
    I applied an xslt for an sql query which returns an xml file.
    I used inline transform icon in sql query to load an xsl file which has to return me a string
    Any idea why is not working for me..?
    My Sample XML file:
                                     <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="/XMII/CM/BatchDisposition/BatchQueueManagement/StyleSheets/ProductXsl.xsl"?>
    <Rowsets DateCreated="2011-05-05T07:27:45" EndDate="2011-05-05T07:27:45" StartDate="2011-05-05T06:27:45" Version="12.1.8 Build(20)">
         <Rowset>
              <Columns>
                   <Column Description="ProductName" MaxRange="1" MinRange="0" Name="ProductName" SQLDataType="12" SourceColumn="ProductName"/>
              </Columns>
              <Row>
                   <ProductName>Asprin 100mg Tablets 12 x10 strip</ProductName>
              </Row>
              <Row>
                   <ProductName>Asprin 300mg Tablets 12 x10 strip</ProductName>
              </Row>
              <Row><ProductName>Ibprooven 200mg Tablets 12 x 10 strip</ProductName></Row>
              <Row><ProductName>RipTide 50mg Tablets 40 x10 strip</ProductName></Row>
              <Row><ProductName>Seroquel 200mg Tablets 6 x10 strip</ProductName></Row>
              <Row><ProductName>Seroquel 400mg Tablets 12 x10 strip</ProductName></Row>
         </Rowset>
    </Rowsets>
    My Sample XSl File:
                                    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
         <xsl:text>["</xsl:text>
         <xsl:for-each select="Rowsets/Rowset/Row">
              <xsl:value-of select="ProductName"/>
              <xsl:if test="position() &lt; last()">
                   <xsl:text>","</xsl:text>
                    </xsl:if>
              <xsl:if test="position()=last()">
                           <xsl:text>"]</xsl:text>
                    </xsl:if>
         </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Any Suggestions  are Welcome:
    Thanks

    Something like this should work...
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="/">
              <Rowsets DateCreated="{Rowsets/@DateCreated}" Version="{Rowsets/@Version}" StartDate="{Rowsets/@StartDate}" EndDate="{Rowsets/@EndDate}">
                   <xsl:copy-of select="/Rowsets/FatalError"/>
                   <xsl:copy-of select="/Rowsets/Messages"/>
                   <Rowset>
                   <Columns>
                        <Column Description="Mycol1" MaxRange="1" MinRange="0" Name="Mycol1" SQLDataType="12" SourceColumn="Mycol1" />
                   </Columns>
                   <Row>
                   <Mycol1>
                   <xsl:text>["</xsl:text>
                        <xsl:for-each select="/Rowsets/Rowset/Row">
                             <xsl:value-of select="." />
                             <xsl:choose>
                                  <xsl:when test="position() &lt; last()"><xsl:text>","</xsl:text></xsl:when>
                                  <xsl:otherwise><xsl:text>"]</xsl:text></xsl:otherwise>
                             </xsl:choose>
                        </xsl:for-each>
                   </Mycol1>
                   </Row>
                   </Rowset>
              </Rowsets>
         </xsl:template>
    </xsl:stylesheet>

  • 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;
    /

  • 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

  • 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.

  • SQL Query Builder Error

    Hi,
    I'm trying to build a data model based on data on our server. I've created a Data Set in SQL using the Query Builder, but when I go to save, I receive this error message:      
    [Hyperion][SQLServer JDBC Driver][SQLServer]Invalid object name 'CMPROJ.DBO.ISDT'.
    Does this have anything to do with accessing my server? Any suggestions?
    Many Thanks.

    Sorry but this has nothing to do with this thread - aimed for questions around Oracle Communications Data Model, the Enterprise Data Warehouse for Telcos available as DB option.
    You might want to ask your question to the BIapps folks/Hyperion Thread. If still interested by "building" a data model for comms, you'd better save time and get something pre-built like OCDM...
    Regards
    Axel.

  • Highlight SQL query at error

    A feature I've come to rely on in Toad is that when I run a query and there is an error, the part of the code that caused the error will be highlighted. It's simple, and it's a big productivity boost. This feature is what's stopping me from using SQL Developer at this point. Are there plans to implement this?

    I second this comment!
    I do a lot of OWB development and I often validate results of the mapping directly in SQL (which are usually going on for 200-400 lines.
    In toad, executing the statement wit an error (usually a constant defined in OWB but represented in the intermediaet result by a "FULLPACKAGE.BlaBlaBla will bring the cursor directly at the line that errored. SQL Developer will only give an error message. Kinda counter productive...

  • SQL query returning error in 1 db and not in other db

    database1
    Select AMT_OFF,
    COMMENT_TXT,
    COOP_AMT_OFF,
    DEAL_NO,
    DETAIL_ID,
    DETAIL_TYPE,
    MAX_QTY,
    MIN_QTY,
    PACK_QTY,
    PACK_TYPE,
    PCT_OFF,
    SEQ_NO,
    SITE_NO,
    VENDOR_ITEM
    From dealdtl
    WHERE (deal_no, site_no, seq_no) IN
    (select deal_no, site_no, seq_no
    from deal_sku
    where sku_no = 29747
    and apply_site_no = 1201
    and deal_no = dealdtl.deal_no
    and site_no = dealdtl.site_no
    and seq_no = dealdtl.seq_no)
    and min_qty <= decode(pack_type, 'P',1,'U',10)
    and (site_no, deal_no) IN
    (select site_no, deal_no
    from dealhdr
    where vendor_id = 'VNMIKE'
    --and site_no = dealdtl.site_no
    --and deal_no = dealdtl.deal_no 
    and start_dt <= to_date('12-SEP-08', tmxgbl.date_format)
    and stop_dt >= to_date('12-SEP-08', tmxgbl.date_format)
    query produces an error on to_date function ORA-01858 non numeric character found where numeric expected
    all the tables have no data in them
    i.e. if i do a
    select site_no, deal_no
    from dealhdr --0 rows
    select deal_no, site_no, seq_no
    from deal_sku--0 rows
    Select AMT_OFF,
    COMMENT_TXT,
    COOP_AMT_OFF,
    DEAL_NO,
    DETAIL_ID,
    DETAIL_TYPE,
    MAX_QTY,
    MIN_QTY,
    PACK_QTY,
    PACK_TYPE,
    PCT_OFF,
    SEQ_NO,
    SITE_NO,
    VENDOR_ITEM
    From dealdtl--o rows
    However, when the same query is executed in a different database, it does not bring up an error, same data condition 0 rows on all three tables.
    On both databases tmxgbl.date_format returns the same 'mm/dd/rr' formaty mask
    can somebody explain the reason for this please?
    Thanks
    Vijay

    still no error on the database that doesn not throw an error
    Select AMT_OFF,
    COMMENT_TXT,
    COOP_AMT_OFF,
    DEAL_NO,
    DETAIL_ID,
    DETAIL_TYPE,
    MAX_QTY,
    MIN_QTY,
    PACK_QTY,
    PACK_TYPE,
    PCT_OFF,
    SEQ_NO,
    SITE_NO,
    VENDOR_ITEM
    From dealdtl
    WHERE (deal_no, site_no, seq_no) IN
    (select deal_no, site_no, seq_no
    from deal_sku
    where sku_no = 29747
    and apply_site_no = 1201
    and deal_no = dealdtl.deal_no
    and site_no = dealdtl.site_no
    and seq_no = dealdtl.seq_no)
    and min_qty <= decode(pack_type, 'P',1,'U',10)
    and (site_no, deal_no) IN
    (select site_no, deal_no
    from dealhdr
    where vendor_id = 'VNMIKE'
    --and site_no = dealdtl.site_no
    --and deal_no = dealdtl.deal_no 
    and start_dt <= to_date('09/12/08', chr(39)||tmxgbl.date_format||chr(39))
    and stop_dt >= to_date('09/12/08', chr(39)||tmxgbl.date_format||chr(39))
    --and start_dt <= to_date('12-SEP-08', 'CRAP')
    --no error                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQL query syntax error .......

    I am using following query
    SELECT PERNR VORNA NACHN GBDAT FROM PA0002
        INTO CORRESPONDING FIELDS OF TABLE ITAB
        WHERE UPPER( VORNA )  = UPPER( STRU_USERIP-VORNA )
        AND   ENDDA >= SY-DATUM
        AND   BEGDA <= SY-DATUM .
    and I am geting syntax error as --
    vorna is   not valid comparison operator .
    can anyone plz suggest me solution over this problem .

    Logic must be written,
    The below logic is incomplete
    Break your head and modify it
    TABLES:pa0002.
    DATA:itab TYPE TABLE OF pa0002.
    DATA:wa TYPE pa0002.
    DATA:lv_vorna TYPE pa0002-vorna.
    DATA:ra_vorna TYPE RANGE OF pa0002-vorna.
    DATA:wa_vorna LIKE LINE OF ra_vorna .
    DATA:lv_index TYPE i.
    DATA:offset TYPE i.
    DATA:pa_vorna TYPE pa0002-vorna VALUE 'Frank'.
    DATA:len TYPE i.
    len = STRLEN( pa_vorna ).
    MOVE pa_vorna TO lv_vorna.
    TRANSLATE lv_vorna TO LOWER CASE.
    wa_vorna-low = lv_vorna.
    APPEND wa_vorna TO ra_vorna.
    MOVE pa_vorna TO lv_vorna.
    TRANSLATE lv_vorna TO UPPER CASE.
    wa_vorna-low = lv_vorna.
    APPEND wa_vorna TO ra_vorna.
    wa_vorna-low = PA_VORNA.
    APPEND wa_vorna TO ra_vorna.
    TRANSLATE PA_VORNA TO LOWER CASE.
    DO len TIMES.
      lv_index = sy-index - 1.
      offset = lv_index + 1.
      DO len TIMES.
        MOVE pa_vorna TO lv_vorna.
        TRANSLATE lv_vorna+lv_index(offset) TO UPPER CASE.
        wa_vorna-low = lv_vorna.
        APPEND wa_vorna TO ra_vorna.
        ADD 1 TO lv_index.
      ENDDO.
    ENDDO.

  • HQL/SQL query translator error on SJSAS 8.1 EE

    I encountered an error while executing hibernate query in my app and the log message is shown below.
    [#|2006-09-20T13:27:02.956-0400|WARNING|sun-appserver-ee8.1_02|javax.enterprise.system.stream.err|_ThreadID=12;|
    CharScanner; panic: ClassNotFoundException: org.hibernate.hql.ast.HqlToken|#] I am using HIberante 3 and I do have antlr-2.7.2.jar in my classpath. And I am using org.hibernate.hql.classic.ClassicQueryTranslatorFactory class instead of
    org.hibernate.hql.ast.ASTQueryTranslatorFactory. I have also added the antlr-2.7.2.jar in classpath-prefix in domain.xml. Did anybody encounter the same problem? Please advice.
    Thanks.

    I fixed this problem by adding/changing two files: sun-web.xml and srever.policy.
    In sun-web.xml
    <sun-web-app>
    <class-loader delegate="false"/>
    </sun-web-app>  In server.policy
    grant {
       permission java.security.AllPermission;
    }; I am not if this is a good solution but it works.
    Thanks.

Maybe you are looking for

  • Downloading album starter 3.2

    I had adobe album starter 3.2, which had all of my photos. When my computer crashed the IT guy saved my documents and photos, but How do I download Album Starter 3.2 again, so I can access my photos?

  • Photoshop trial won't dosnload

    I am trying to download the trial. I click "download" and I get a page telling me photoshop is downloading, but no download is launched.@

  • Convertin FTPT to remove decimals

    hi i am doing as below  num_in is FLTP 16 in database DATA: NUM_OUT(12) TYPE N. MOVE NUM_IN TO NUM_OUT. first value of num_in is   1.0000000000000000E+01 is it becoming 000000000010 it should become 000000000001 as leading zeros but not displaying pr

  • Re: Parse of wsdl failed due to weblogic.testclient.WsdlParseFailedException

    I am facing a issue when I click ?WSDL, it generates a MAC address kind of http://[2001:0:9d38:6ab8:c1a:1cb2:3f57:73d7]:7001/cps-ws/CpsParticipantHistoryService?WSDL. If I click on request I get response. If I click on the same request the following

  • Does anyone know about FCP Multiclipping problems???

    I posted this about two weeks ago, to find a few views but no responses. I know that there is a FCP guru out there who HAS to know something about this problem: The new FCP 6.0.1 doesn't let you collapse multiclips properly when preparing the project