Custom query returns inaccurate number

I'm using the following report for sales analysis. The report works fine except that the resulting numbers in the columns "Units 1st Qtr", "Units Prior Qtr", "Units This Year", and "Units Prior Year" are ten times larger than they should be.
The number returned for "Units This Year" should be 52, but the report returns 520. If the number should be 430 it is returning 4300.
I found that I can compensate for this by dividing the sum by 10 but I would like to know why this is happening.
SELECT
T0.ItemCode, T0.ItemName, T0.U_SES_PageNo, T0.OnHand, T0.IsCommited, T0.OnOrder,
(SELECT Price FROM ITM1 WHERE ItemCode = T1.ItemCode AND PriceList = 1) [UnitPrice],
(SELECT Price FROM ITM1 WHERE ItemCode = T1.ItemCode AND PriceList = 2) [UnitCost],
UTQ = case when datepart(qq,OINV.DocDate) = 04
             and datepart(yyyy,OINV.DocDate)=datepart(yyyy,GetDate())
       then INV1.Quantity else 0 end,
UPQ = case when datepart(qq,OINV.DocDate) = 03
             and datepart(yyyy,OINV.DocDate)=datepart(yyyy,GetDate())
       then INV1.Quantity else 0 end,
UTY = case when datepart(yyyy,OINV.DocDate) = datepart(yyyy,GetDate())
       then INV1.Quantity else 0 end,
UPY = case when datepart(yyyy,OINV.DocDate) = datepart(yyyy,GetDate())-1
       then INV1.Quantity else 0 end
  INTO ##TEMP
  FROM OINV
INNER JOIN INV1
    ON OINV.DocEntry = INV1.DocEntry
RIGHT OUTER JOIN OITM T0
    ON INV1.ItemCode = T0.ItemCode
RIGHT OUTER JOIN ITM1 T1
    ON INV1.ItemCode = T1.ItemCode
WHERE T0.CardCode = '[%0]'
ORDER BY T0.ItemCode
SELECT
ItemCode AS 'Item Code',
ItemName AS 'Description',
U_SES_PageNo AS 'Page Number',
CAST(OnHand AS INT) AS 'On Hand',
CAST(IsCommited AS INT) AS 'Committed',
CAST(OnOrder AS INT) AS 'On Order',
CAST(SUM(UTQ) AS INT) AS 'Units 4th Qtr',
CAST(SUM(UPQ) AS INT) AS 'Units 3rd Qtr',
CAST(SUM(UTY) AS INT) AS 'Units This Year',
CAST(SUM(UPY) AS INT) AS 'Units Prior Year',
UnitCost AS 'Cost',
UnitPrice AS 'Price'
FROM ##TEMP
   GROUP BY ItemCode, ItemName, U_SES_PageNo, OnHand, IsCommited, OnOrder, UnitCost, UnitPrice
   ORDER BY ItemCode
DROP TABLE ##TEMP

Hi Steve ,
I have found the problem .It is your join from  ITM1 that is triggering your issue .  Please put Itemcode instead of XXX .
Try this for test  :
SELECT
T0.ItemCode, T0.ItemName,  T0.OnHand, T0.IsCommited, T0.OnOrder,
-- (SELECT Price FROM ITM1 WHERE ItemCode = T1.ItemCode AND PriceList = 1) [UnitPrice],
-- (SELECT Price FROM ITM1 WHERE ItemCode = T1.ItemCode AND PriceList = 2) [UnitCost],
UTQ = case when datepart(qq,OINV.DocDate) = 04
             and datepart(yyyy,OINV.DocDate)=datepart(yyyy,GetDate())
       then INV1.Quantity else 0 end,
UPQ = case when datepart(qq,OINV.DocDate) = 03
             and datepart(yyyy,OINV.DocDate)=datepart(yyyy,GetDate())
       then INV1.Quantity else 0 end,
UTY = case when datepart(yyyy,OINV.DocDate) = datepart(yyyy,GetDate())
       then INV1.Quantity else 0 end,
UPY = case when datepart(yyyy,OINV.DocDate) = datepart(yyyy,GetDate())-1
       then INV1.Quantity else 0 end
INTO ##TEMP
  FROM OINV
INNER JOIN INV1
    ON OINV.DocEntry = INV1.DocEntry
RIGHT OUTER JOIN OITM T0
    ON INV1.ItemCode = T0.ItemCode
-- INNER JOIN ITM1 T1
--    ON INV1.ItemCode = T1.ItemCode
WHERE T0.ItemCode = 'XXXXX'
ORDER BY T0.ItemCode
SELECT
ItemCode AS 'Item Code',
ItemName AS 'Description',
-- U_SES_PageNo AS 'Page Number',
CAST(OnHand AS INT) AS 'On Hand',
CAST(IsCommited AS INT) AS 'Committed',
CAST(OnOrder AS INT) AS 'On Order',
CAST(SUM(UTQ) AS INT) AS 'Units 4th Qtr',
CAST(SUM(UPQ) AS INT) AS 'Units 3rd Qtr',
CAST(SUM(UTY) AS INT) AS 'Units This Year',
CAST(SUM(UPY) AS INT) AS 'Units Prior Year'
-- UnitCost AS 'Cost',
-- UnitPrice AS 'Price'
FROM ##TEMP
   GROUP BY ItemCode, ItemName,  OnHand, IsCommited, OnOrder
   ORDER BY ItemCode

Similar Messages

  • Query return wrong number of records

    In a function, I use a variable declare as my_var table_name1.column_name%type.
    This variable is used to to a test on a foreign key when I do a query on another table than table_name1 the number of rows return by the query is different than the number of rows return if I do the test directly with the value accorded.
    Ex:
    declare
    my_var table_name1.column_name%type;
    row_num number;
    begin
    my_var := 10;
    select count(1) into row_num
    from table_name2
    where column_name = my_var;
    dbms_output.put_line(row_num);
    select count(1) into row_num
    from table_name2
    where column_name = 10;
    dbms_output.put_line(row_num);
    end;
    the first query will return 2 and the second will return 1.
    Can someone explain me why I have this strange result ?
    Edited by: 897304 on Nov 15, 2011 5:12 AM
    Edited by: 897304 on Nov 15, 2011 5:32 AM

    I cannot put the description of the table :-/
    The type of the field is varchar2(12)
    This is the function the value past to param1 came from oracle 11 and the table tab1 is in oracle10.
    The first query work and return 1 (result expected) and the second return 2.
    FUNCTION getValue(param1 VARCHAR2) RETURN number AS
         var1 VARCHAR2(12 BYTE);
         res1 number;
    BEGIN
    var1 := param1;
    SELECT count(1)
    INTO res1
    FROM tab1
    WHERE col2 = var1;
    SELECT count(1)
    INTO res1
    FROM tab1
    WHERE col2 = param1;     
    RETURN res1;
    END getValue;

  • Mysql query returns different number of records from coldfusion and navicat

    Hi
    I'm hoping that someone can suggest a basic strategy to debug this.
    I have a fairly large and complicated query that is executed by a function in a cfc.
    It returns (for example) 100 rows.
    If I use cfdump and then copy and paste the SQL of the query (with the variables, of course) into Navicat and execute exactly the same query on the same mySQL database, it returns 130 rows.
    Same SQL string, same database, same data - the only difference is that in one instance Navicat submits the query and in the other, Coldfusion does.
    Has anyone ever had anything like this happen before?

    Ok I found my own bug. Of *course* the sql queries were not identical.. they could not possibly have been. My mistake was thinking that they were.
    The problem was part of the WHERE clause:
    AND orderid in (500,503,505)
    In the coldfusion code this was
    AND orderid in (<cfqueryparam cfsqltype="cf_sql_varchar" value="#lstOrderID#">)
    which of course rendered in mySQL as AND orderid in ('500,503,505')
    This was not immediately apparent as the cfdump returns this as AND orderid in (?) with the variable in the array below.

  • Query returning different number of rows standalone vs insert statement

    Hi,
    We are using Oracle 10g. We are facing a issue where a SELECT inserts 26294 rows when used with a insert statement. The same select (cut-and-paste) when executed standalone, returns only 60 rows. Any idea what could be causing this?
    Thanks in advance,
    Hari Narayanan
    TIAA-CREF
    See details below,
    SQL> INSERT INTO cref.position_recon_breaks (
    2 effective_date,
    3 fund_entity_id,
    4 security_alias,
    5 accounting_system,
    6 pace_shares,
    7 accounting_sys_shares,
    8 accounting_sys_unp_trd_shares
    9 )
    10 SELECT pr.effective_date,
    11 pr.ENTITY_ID,
    12 pr.SECURITY_ALIAS,
    13 'MELLON',
    14 CREF_SHARES PACE_SHARES,
    15 CORP_SHARES ACCOUNTING_SYS_SHARES,
    16 CORP_UNP_TRD_SHARES ACCOUNTING_SYS_UNP_TRD_SHARES
    17 FROM cref.MELLON_POSITION_RECON pr
    18 WHERE ABS(SHARES_DIFFERENCE) >= 1;
    25294 rows created.
    SQL> select count(*) from
    2 (SELECT pr.effective_date,
    3 pr.ENTITY_ID,
    4 pr.SECURITY_ALIAS,
    5 'MELLON',
    6 CREF_SHARES PACE_SHARES,
    7 CORP_SHARES ACCOUNTING_SYS_SHARES,
    8 CORP_UNP_TRD_SHARES ACCOUNTING_SYS_UNP_TRD_SHARES
    9 FROM cref.MELLON_POSITION_RECON pr
    10 WHERE ABS(SHARES_DIFFERENCE) >= 1);
    COUNT(*)
    60

    charred/jzhang,
    Thanks for your responses. Just as an additional info, MELLON_POSITION_RECON is one hell of a view - not written by me :) - with unions and inline queries.
    If it would be of any help, here is the script,
    CREATE OR REPLACE FORCE VIEW CREF.MELLON_POSITION_RECON
    (EFFECTIVE_DATE, FUND_CODE, ENTITY_ID, ENTITY_NAME, SECURITY_ALIAS,
    SECURITY_NAME, PRIMARY_ASSET_ID, CREF_SECURITY_COUNT, CORP_SECURITY_COUNT, CREF_CURRENCY_CODE,
    CORP_CURRENCY_CODE, CREF_EXCHANGE_RATE, CORP_EXCHANGE_RATE, CREF_SHARES, CORP_SHARES,
    CREF_PRICE_LOCAL, CORP_PRICE_LOCAL, CREF_MARKET_VALUE_USD, CORP_MARKET_VALUE_USD, CREF_MARKET_VALUE_LOCAL,
    CORP_MARKET_VALUE_LOCAL, CREF_ACCRUED_INCOME_USD, CORP_ACCRUED_INCOME_USD, CORP_UNP_TRD_MARKET_VALUE, CORP_UNP_TRD_SHARES,
    SHARES_DIFFERENCE, SHARES_DIFF_INCL_UNP, LOCAL_PRICE_DIFFERENCE, MKT_VALUE_USD_DIFF, MKT_VALUE_USD_DIFF_INCL_UNP,
    ACCRUED_INCOME_DIFF)
    AS
    SELECT /*+ ORDERED */
    P.EFFECTIVE_DATE
    ,E.CODE FUND_CODE
    ,P.ENTITY_ID
    ,E.LONG_NAME ENTITY_NAME
    ,P.SECURITY_ALIAS
    ,S.ISSUE_NAME SECURITY_NAME
    ,S.PRIMARY_ASSET_ID
    ,P.CREF_SECURITY_COUNT
    ,P.CORP_SECURITY_COUNT CORP_SECURITY_COUNT
    ,P.CREF_CURRENCY_CODE
    ,P.CORP_CURRENCY_CODE CORP_CURRENCY_CODE
    ,P.CREF_EXCHANGE_RATE
    ,P.CORP_EXCHANGE_RATE CORP_EXCHANGE_RATE
    ,P.CREF_SHARES
    ,P.CORP_SHARES CORP_SHARES
    ,P.CREF_PRICE_LOCAL
    ,P.CORP_PRICE_LOCAL CORP_PRICE_LOCAL
    ,ROUND(P.CREF_MARKET_VALUE_USD,2) CREF_MARKET_VALUE_USD
    ,P.CORP_MARKET_VALUE_USD CORP_MARKET_VALUE_USD
    ,ROUND(P.CREF_MARKET_VALUE_LOCAL,2) CREF_MARKET_VALUE_LOCAL
    ,P.CORP_MARKET_VALUE_LOCAL CORP_MARKET_VALUE_LOCAL
    ,ROUND(P.CREF_ACCRUED_INCOME_USD,2) CREF_ACCRUED_INCOME_USD
    ,P.CORP_ACCRUED_INCOME_USD
    ,P.CORP_UNP_TRD_MARKET_VALUE
    ,P.CORP_UNP_TRD_SHARES
    ,NVL(P.CORP_SHARES, 0) - NVL(P.CREF_SHARES, 0) SHARES_DIFFERENCE
    ,NVL(P.CORP_SHARES,0) +
    (NVL(P.CORP_UNP_TRD_SHARES, 0) - NVL(P.CREF_SHARES, 0)) SHARES_DIFF_INCL_UNP
    ,NVL(P.CREF_PRICE_LOCAL, 0) - NVL(P.CORP_PRICE_LOCAL, 0) LOCAL_PRICE_DIFFERENCE
    ,NVL(ROUND(P.CREF_MARKET_VALUE_USD,2),0) - NVL(P.CORP_MARKET_VALUE_USD,0) MKT_VALUE_USD_DIFF
    ,NVL(ROUND(P.CREF_MARKET_VALUE_USD,2),0) -
    (NVL(P.CORP_MARKET_VALUE_USD, 0) + NVL(P.CORP_UNP_TRD_MARKET_VALUE,0)) MKT_VALUE_USD_DIFF_INCL_UNP
    ,NVL(ROUND(P.CREF_ACCRUED_INCOME_USD,2),0) - NVL(P.CORP_ACCRUED_INCOME_USD, 0) ACCRUED_INCOME_DIFF
    FROM
    SELECT ENTITY_ID
    ,EFFECTIVE_DATE
    ,SECURITY_ALIAS
    ,SUM(CREF_SECURITY_COUNT) CREF_SECURITY_COUNT
    ,SUM(CORP_SECURITY_COUNT) CORP_SECURITY_COUNT
    ,MAX(CREF_CURRENCY_CODE) CREF_CURRENCY_CODE
    ,MAX(CORP_CURRENCY_CODE) CORP_CURRENCY_CODE
    ,MAX(CREF_EXCHANGE_RATE) CREF_EXCHANGE_RATE
    ,MAX(CORP_EXCHANGE_RATE) CORP_EXCHANGE_RATE
    ,SUM(CREF_SHARES) CREF_SHARES
    ,SUM(CORP_SHARES) CORP_SHARES
    ,MAX(CREF_PRICE_LOCAL) CREF_PRICE_LOCAL
    ,MAX(CORP_PRICE_LOCAL) CORP_PRICE_LOCAL
    ,SUM(CREF_MARKET_VALUE_USD) CREF_MARKET_VALUE_USD
    ,SUM(CORP_MARKET_VALUE_USD) CORP_MARKET_VALUE_USD
    ,SUM(CREF_MARKET_VALUE_LOCAL) CREF_MARKET_VALUE_LOCAL
    ,SUM(CORP_MARKET_VALUE_LOCAL) CORP_MARKET_VALUE_LOCAL
    ,SUM(CREF_ACCRUED_INCOME_USD) CREF_ACCRUED_INCOME_USD
    ,SUM(CORP_ACCRUED_INCOME_USD) CORP_ACCRUED_INCOME_USD
    ,MIN(QUERY_TIMESTAMP) QUERY_TIMESTAMP
    ,SUM(CORP_UNP_TRD_MARKET_VALUE) CORP_UNP_TRD_MARKET_VALUE
    ,SUM(CORP_UNP_TRD_SHARES) CORP_UNP_TRD_SHARES
    FROM
    SELECT -- WANT ONE ROW PER FUND PER SECURITY
    /*+ index(p I_POS_ENTID_SRCINTFC_CREF) index (pd) */
    E.FUND_ENTITY_ID ENTITY_ID
    ,P.EFFECTIVE_DATE
    ,PD.SECURITY_ALIAS
    ,SYSDATE QUERY_TIMESTAMP
    ,1 CREF_SECURITY_COUNT
    ,MAX(PD.LOCAL_CURRENCY) CREF_CURRENCY_CODE
    ,MAX(PD.MKT_EXCHANGE_RATE) CREF_EXCHANGE_RATE
    ,SUM(PD.SHARE_PAR_VALUE) CREF_SHARES
    ,MAX(PD.PRICE) CREF_PRICE_LOCAL
    ,SUM(PD.MARKET_VALUE) CREF_MARKET_VALUE_USD
    ,SUM(PD.LOCAL_MARKET_VALUE) CREF_MARKET_VALUE_LOCAL
    ,SUM(PD.ACCRUED_INCOME) CREF_ACCRUED_INCOME_USD
    ,0 CORP_SECURITY_COUNT
    ,TO_CHAR(NULL) CORP_CURRENCY_CODE
    ,0 CORP_SHARES
    ,TO_NUMBER(NULL) CORP_PRICE_LOCAL
    ,TO_NUMBER(NULL) CORP_EXCHANGE_RATE
    ,0 CORP_MARKET_VALUE_USD
    ,0 CORP_MARKET_VALUE_LOCAL
    ,0 CORP_ACCRUED_INCOME_USD
    ,0 CORP_UNP_TRD_MARKET_VALUE
    ,0 CORP_UNP_TRD_SHARES
    FROM CREF.ENTITY E,
    CREF.ENTITY EF                fund entity       NF
    ,HOLDINGDBO.POSITION P
    ,(SELECT MAX(EFFECTIVE_DATE) CURRENT_DATE
    FROM HOLDINGDBO.POSITION P,
    PACE_MASTERDBO.INTERFACES I
    WHERE I.SHORT_DESC = 'MELLON'
    AND I.INSTANCE = P.SRC_INTFC_INST) DT
    ,HOLDINGDBO.POSITION_DETAIL PD
    ,PACE_MASTERDBO.INTERFACES I
    WHERE E.PORTFOLIO_ENTITY_TYPE_CODE = 'PORT'
    AND E.ENTITY_ID = P.ENTITY_ID
    AND EF.ENTITY_ID = E.FUND_ENTITY_ID           -- NF
    AND EF.ACCOUNTING_SYSTEM = 'MELLON'      -- NF
    AND E.ENTITY_ID = P.ENTITY_ID
    AND I.SHORT_DESC = 'STARDIRECT'
    AND I.INSTANCE = P.SRC_INTFC_INST
    AND P.EFFECTIVE_DATE = DT.CURRENT_DATE
    AND P.POSITION_ID = PD.POSITION_ID
    -- "GROUP BY" COMBINES THE LONG AND SHORT POSITIONS
    GROUP BY P.EFFECTIVE_DATE, E.FUND_ENTITY_ID, PD.SECURITY_ALIAS
    UNION ALL
    SELECT -- CORPORATE SENDS ONE ROW PER FUND PER SECURITY (NO SHORTS)
    /*+ index(p I_POS_ENTID_SRCINTFC_CREF) index (pd) */
    E.ENTITY_ID
    ,P.EFFECTIVE_DATE
    ,PD.SECURITY_ALIAS
    ,SYSDATE QUERY_TIMESTAMP
    ,0 CREF_SECURITY_COUNT
    ,TO_CHAR(NULL) CREF_CURRENCY_CODE
    ,0 CREF_SHARES
    ,TO_NUMBER(NULL) CREF_PRICE_LOCAL
    ,TO_NUMBER(NULL) CREF_EXCHANGE_RATE
    ,0 CREF_MARKET_VALUE_USD
    ,0 CREF_MARKET_VALUE_LOCAL
    ,0 CREF_ACCRUED_INCOME_USD
    ,1 CORP_SECURITY_COUNT
    ,PD.LOCAL_CURRENCY CORP_CURRENCY_CODE
    ,PD.SHARE_PAR_VALUE CORP_SHARES
    ,PD.PRICE CORP_PRICE_LOCAL
    ,pd.mkt_exchange_rate CORP_EXCHANGE_RATE
    ,PD.MARKET_VALUE CORP_MARKET_VALUE_USD
    ,PD.LOCAL_MARKET_VALUE CORP_MARKET_VALUE_LOCAL
    ,PD.ACCRUED_INCOME CORP_ACCRUED_INCOME_USD
    ,0 CORP_UNP_TRD_MARKET_VALUE
    ,0 CORP_UNP_TRD_SHARES
    FROM CREF.ENTITY E
    ,HOLDINGDBO.POSITION P
    ,(SELECT MAX(EFFECTIVE_DATE) CURRENT_DATE
    FROM HOLDINGDBO.POSITION P,
    PACE_MASTERDBO.INTERFACES I
    WHERE I.SHORT_DESC = 'MELLON'
    AND I.INSTANCE = P.SRC_INTFC_INST) DT
    ,HOLDINGDBO.POSITION_DETAIL PD
    ,PACE_MASTERDBO.INTERFACES I
    WHERE E.FUND_FLAG = 'Y' --
    AND E.ENTITY_ID = P.ENTITY_ID
    AND I.SHORT_DESC = 'MELLON'
    AND I.INSTANCE = P.SRC_INTFC_INST
    AND P.EFFECTIVE_DATE = DT.CURRENT_DATE
    AND P.POSITION_ID = PD.POSITION_ID
    UNION ALL
    SELECT
    UTS.FUND_ENTITY_ID ENTITY_ID
    ,UTS.EFFECTIVE_DATE
    ,UTS.SECURITY_ALIAS
    ,SYSDATE QUERY_TIMESTAMP
    ,0 CREF_SECURITY_COUNT
    ,TO_CHAR(NULL) CREF_CURRENCY_CODE
    ,0 CREF_SHARES
    ,TO_NUMBER(NULL) CREF_PRICE_LOCAL
    ,TO_NUMBER(NULL) CREF_EXCHANGE_RATE
    ,0 CREF_MARKET_VALUE_USD
    ,0 CREF_MARKET_VALUE_LOCAL
    ,0 CREF_ACCRUED_INCOME_USD
    ,0 CORP_SECURITY_COUNT
    ,TO_CHAR(NULL) CORP_CURRENCY_CODE
    ,0 CORP_SHARES
    ,TO_NUMBER(NULL) CORP_PRICE_LOCAL
    ,TO_NUMBER(NULL) CORP_EXCHANGE_RATE
    ,0 CORP_MARKET_VALUE_USD
    ,0 CORP_MARKET_VALUE_LOCAL
    ,0 CORP_ACCRUED_INCOME_USD
    ,UTS.SUM_MARKET_VALUE CORP_UNP_TRD_MARKET_VALUE
    ,UTS.SUM_SHARES CORP_UNP_TRD_SHARES
    FROM
    (SELECT MAX(EFFECTIVE_DATE) CURRENT_DATE
    FROM HOLDINGDBO.POSITION P,
    PACE_MASTERDBO.INTERFACES I
    WHERE I.SHORT_DESC = 'MELLON'
    AND I.INSTANCE = P.SRC_INTFC_INST) DT
    ,cref.UNPROCESSED_TRADES_SUM UTS
    WHERE DT.CURRENT_DATE = UTS.EFFECTIVE_DATE
    AND UTS.UPDATED_BY = 'MELLON'
    GROUP BY EFFECTIVE_DATE, ENTITY_ID, SECURITY_ALIAS
    ) P,
    cref.ENTITY E,
    SECURITYDBO.SECMASTER_HISTORY S
    WHERE P.ENTITY_ID = E.ENTITY_ID
    AND P.SECURITY_ALIAS = S.SECURITY_ALIAS
    AND S.SRC_INTFC_INST = (SELECT INSTANCE FROM PACE_MASTERDBO.INTERFACES
    WHERE SHORT_DESC = 'EAGLE PACE')
    AND S.EFFECTIVE_DATE = (SELECT MAX(S1.EFFECTIVE_DATE)
    FROM SECURITYDBO.SECMASTER_HISTORY S1
    WHERE S1.SRC_INTFC_INST = S.SRC_INTFC_INST
    AND S1.SECURITY_ALIAS = S.SECURITY_ALIAS
    AND S1.EFFECTIVE_DATE <= P.EFFECTIVE_DATE);

  • Creating a directory via a jsp page sql query return

    Is it possible to create a directory based on the results of a sql query?
    i.e.
    My sql query returns application number 1234 for a building application (BC for short).
    Is it possible to create a directory /BC/1234
    It is then proposed to use an iframe to look into the directory so users can place and access scanned documents which are captured during the approval process.
    If so how?
    An example would be great.
    Jason

    Sorry hope your still around I've been away for a while. We've created a samber share to the file server where the documents are stored and mounted it within the web file directory. It works ok if there is an existing directory but if there isn't we want it to be created when the page looks for the folder. I've done this with an asp page it basically did a directory exist test first then create folder if it didn't. The problem is can't find an example of how to do the directory exist test then directory create syntax so an example of both would be great

  • After I run a query can I get it to return the number of files matched and each individual file name?

    After I run a query can I get it to return the number of files matched and each individual file name?  I am trying to do a data mining routine and this would be helpful. 
    BBANACKI

    Hi bbanacki,
    Please have a look at the following code:
    Define your queries and then:
    oAdvancedQuery.ReturnType=eSearchFile
    oMyDataFinder.Results.MaxCount = iMaxNumberOfReturndElements
    Call oMyDataFinder.Search(oAdvancedQuery)
    Set oMyResults  = oMyDataFinder.Results
    If oMyResults.IsIncomplete Then
      msgbox "The first " & str(oMyResults.Count) & " files found"
    Else
      msgbox str(oMyResults.Count) & "  files found"
    End If
    for iLoop = 1 to oMyResults.Count
      Cell.Text = oMyResults(iLoop).Properties("Name").Value
      Cell.Text = oMyResults(iLoop).Properties("fullpath").Value
    next
    Greetings
    Walter

  • SSAS 2012 - Bring in Sold to Customer and measure - query returns in 1 second - add in ship to query stalls

    I have a star schema that has the Customer Dim hooked to the invoice fact 3 times.  Aliased Sold to, Ship to and End user.  I pull Sold to name into excel and any measure and the query returns almost instantaneously.  I pull the ship to name
    in and the query stall and never finishes.  The Customer dim has 80k records, but only 3000 or so with results for invoices. 
    thanks

    I would delete and re-add the relationships on the Dimension Usage tab, the reprocess everything FULL first dimensions then Cube.  What you are seeing is pretty weird, so I'd want to make sure it's nothing nebulous..
    Then I would look at profiler and see what the heck it is doing that is taking so long.  Sorry I don't have an exactly answer, at this point I would need to poke around and get some more information/ideas.
    Just to be clear, you are using SSAS multidimensional?
    -Ken

  • Query with aggregate on custom mapping returning wrong type

    I've got a JDOQL query that returns the sum of a single column, where that
    column is custom-mapped, but the result I get back is losing precision.
    I create the JDOQL query as normal and set the result to the aggregate
    expression:
    KodoQuery query = (KodoQuery) pm.newQuery(candidateClass, filter);
    query.setResult("sum(amount)");
    I can also setUnique for good measure as I am expecting just 1 row back:
    query.setUnique(true);
    The query returns an Integer, but my amount column is a decimal with 5
    digits after the decimal point. If I ask for a Double or BigDecimal as the
    resultClass, it does return an object of that type, but loses all
    precision after the decimal point:
    query.setResultClass(BigDecimal.class);
    The amount field in my candidate class is of the class Money, a class that
    encapsulates a currency and a BigDecimal amount. See
    http://www.martinfowler.com/ap2/quantity.html
    It is mapped as a custom money mapping to an amount and currency column,
    based on the custom mapping in the Kodo examples. I have tried mapping the
    amount as a BigDecimal value, and querying the sum of this works. So the
    problem seems to be the aggregate query on my custom mapping. Do I need to
    write some code for my custom mapping to be able to handle aggregates?
    Thanks,
    Alex

    Can you post your custom mapping?
    Also, does casting the value have any effect?
    q.setResult ("sum((BigDecimal) amount)");

  • The Query returns a JBO Sql Exeptions of Invalid number

    Here is the query which returns the Invalid number exception on a R12 environment -
    SELECT feb.entity_id,
    rel.parent_entity_id,
    fetl.entity_name,
    pfetl.entity_name parent_entity_name,
    ccytl.currency_code,
    ccytl.name AS currency_name,
    fettl.entity_type_name,
    fettl.entity_type_code,
    rel.cons_relationship_id,
    decode( fettl.entity_type_code,
    'E', to_number(''),
    decode( operassoc.parent_entity_id,
    to_number(''), rel.ownership_percent,
    to_number(''))) ownership_percent,
    ttl.treatment_name,
    cttl.curr_treatment_name,
    decode( fettl.entity_type_code,
    'O', 'Y',
    'X', 'Y',
    decode( rel.cons_relationship_id,
    '', 'Y',
    'N')) AS details_icon_displayed,
    decode( fettl.entity_type_code,
    'E', 'N',
    'O', decode(feb.entity_id,
    operassoc.child_entity_id, 'N',
    'Y'),
    'Y') AS add_entity_icon_displayed,
    decode( fettl.entity_type_code,
    'E', 'N',
    'C', decode( rel.cons_relationship_id,
    '', 'N',
    'Y'),
    decode( operassoc.parent_entity_id,
    '', 'Y',
    'N')) AS move_remove_icon_displayed,
    decode( fettl.entity_type_code,
    'E', 'N',
    'C', decode( rel.cons_relationship_id,
    '', decode( childassoc.child_entity_id,
    '', 'N',
    'Y'),
    'Y'),
    decode( operassoc.parent_entity_id,
    '', 'Y',
    'N')) AS create_update_icon_displayed,
    decode( fettl.entity_type_code,
    'E', 'N',
    'C', decode( rel.cons_relationship_id,
    '', 'N',
    'Y'),
    decode( operassoc.parent_entity_id,
    '', 'Y',
    'N')) AS update_update_icon_displayed,
    imageattr.entity_image,
    decode(imageattr.entity_image, '', 'N', 'Y') entity_image_displayed,
    rel.end_date,
    decode(rel.cons_relationship_id, :0, 'Y', 'N') blue_dot_displayed,
    decode(operassoc.parent_entity_id, '', 'Ownership', 'ParentText') ownership_switcher
    FROM FEM_ENTITIES_B feb,
    FEM_ENTITIES_TL fetl,
    FEM_ENTITIES_TL pfetl,
    GCS_ENTITY_CONS_ATTRS eca,
    FND_CURRENCIES_TL ccytl,
    FEM_ENTITIES_ATTR fetea,
    FEM_DIM_ATTRIBUTES_B fetda,
    FEM_DIM_ATTR_VERSIONS_B fet_dav,
    FEM_ENTITY_TYPES_TL fettl,
    GCS_CONS_RELATIONSHIPS rel,
    GCS_TREATMENTS_TL ttl,
    GCS_CURR_TREATMENTS_TL cttl,
    (SELECT operea.entity_id AS parent_entity_id,
    operea.dim_attribute_numeric_member AS child_entity_id
    FROM FEM_ENTITIES_ATTR operea,
    FEM_DIM_ATTRIBUTES_B operda,
    FEM_DIM_ATTR_VERSIONS_B oper_dav
    WHERE operda.attribute_varchar_label = 'OPERATING_ENTITY'
    AND operda.attribute_id = operea.attribute_id
    AND oper_dav.attribute_id = operda.attribute_id
    AND oper_dav.default_version_flag = 'Y'
    AND oper_dav.version_id = operea.version_id) operassoc,
    (SELECT operea.entity_id AS parent_entity_id,
    operea.dim_attribute_numeric_member AS child_entity_id
    FROM FEM_ENTITIES_ATTR operea,
    FEM_DIM_ATTRIBUTES_B operda,
    FEM_DIM_ATTR_VERSIONS_B oper_dav
    WHERE operda.attribute_varchar_label = 'OPERATING_ENTITY'
    AND operda.attribute_id = operea.attribute_id
    AND oper_dav.attribute_id = operda.attribute_id
    AND oper_dav.default_version_flag = 'Y'
    AND oper_dav.version_id = operea.version_id) childassoc,
    (SELECT imageea.entity_id,
    imageea.varchar_assign_value AS entity_image
    FROM FEM_ENTITIES_ATTR imageea,
    FEM_DIM_ATTRIBUTES_B imageda,
    FEM_DIM_ATTR_VERSIONS_B image_dav
    WHERE imageda.attribute_varchar_label = 'IMAGE_NAME'
    AND imageda.attribute_id = imageea.attribute_id
    AND image_dav.attribute_id = imageda.attribute_id
    AND image_dav.default_version_flag = 'Y'
    AND image_dav.version_id = imageea.version_id) imageattr
    WHERE feb.entity_id = fetl.entity_id
    AND fetl.language = userenv('LANG')
    AND eca.entity_id (+)= feb.entity_id
    AND eca.hierarchy_id (+)= :1
    AND ccytl.currency_code (+)= eca.currency_code
    AND ccytl.language (+)= userenv('LANG')
    AND fetea.entity_id = feb.entity_id
    AND fetea.attribute_id = fetda.attribute_id
    AND fetda.attribute_varchar_label = 'ENTITY_TYPE_CODE'
    AND fet_dav.attribute_id = fetda.attribute_id
    AND fet_dav.default_version_flag = 'Y'
    AND fet_dav.version_id = fetea.version_id
    AND fettl.entity_type_code = fetea.dim_attribute_varchar_member
    AND fettl.language = userenv('LANG')
    AND rel.child_entity_id (+)= feb.entity_id
    AND rel.hierarchy_id (+)= :2
    AND rel.actual_ownership_flag (+)= 'Y'
    AND pfetl.entity_id (+)= rel.parent_entity_id
    AND pfetl.language (+)= userenv('LANG')
    AND ttl.treatment_id (+)= rel.treatment_id
    AND ttl.language (+)= userenv('LANG')
    AND cttl.curr_treatment_id (+)= rel.curr_treatment_id
    AND cttl.language (+)= userenv('LANG')
    AND operassoc.child_entity_id (+)= rel.child_entity_id
    AND operassoc.parent_entity_id (+)= rel.parent_entity_id
    AND childassoc.parent_entity_id (+)= feb.entity_id
    AND imageattr.entity_id (+)= feb.entity_id
    AND (rel.start_date IS NULL OR rel.start_date <= nvl(:3, rel.start_date))
    AND (rel.end_date IS NULL OR rel.end_date >= nvl(:4, rel.end_date))
    ORDER BY decode( operassoc.parent_entity_id,
    '', decode( entity_type_code,
    'O', 2,
    'C', 3,
    'E', 4,
    999),
    1),
    entity_name
    Same query returns correct results in 11i environment.
    This query fails at the executeQueryForCollection method.
    Any ideas why?
    Thanks - Alpi
    Edited by: user581082 on Sep 17, 2009 1:16 AM

    Here is the full Error Stack -
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT     feb.entity_id,
         rel.parent_entity_id,
         fetl.entity_name,
         pfetl.entity_name parent_entity_name,
         ccytl.currency_code,
         ccytl.name AS currency_name,
         fettl.entity_type_name,
         fettl.entity_type_code,
         rel.cons_relationship_id,
         decode(     fettl.entity_type_code,
              'E', to_number(''),
              decode(     operassoc.parent_entity_id,
                   to_number(''), rel.ownership_percent,
                   to_number(''))) ownership_percent,
         ttl.treatment_name,
         cttl.curr_treatment_name,
         decode(     fettl.entity_type_code,
              'O', 'Y',
              'X', 'Y',
              decode(     rel.cons_relationship_id,
                   '', 'Y',
                   'N')) AS details_icon_displayed,
         decode(     fettl.entity_type_code,
              'E', 'N',
              'O', decode(feb.entity_id,
    operassoc.child_entity_id, 'N',
    'Y'),
              'Y') AS add_entity_icon_displayed,
         decode(     fettl.entity_type_code,
              'E', 'N',
              'C', decode(     rel.cons_relationship_id,
                        '', 'N',
                        'Y'),
              decode(     operassoc.parent_entity_id,
                   '', 'Y',
                   'N')) AS move_remove_icon_displayed,
         decode(     fettl.entity_type_code,
              'E', 'N',
              'C', decode(     rel.cons_relationship_id,
                        '', decode(     childassoc.child_entity_id,
                                  '', 'N',
                                  'Y'),
                        'Y'),
              decode(     operassoc.parent_entity_id,
                   '', 'Y',
                   'N')) AS create_update_icon_displayed,
         decode(     fettl.entity_type_code,
              'E', 'N',
              'C', decode(     rel.cons_relationship_id,
                        '', 'N',
                        'Y'),
              decode(     operassoc.parent_entity_id,
                   '', 'Y',
                   'N')) AS update_update_icon_displayed,
         imageattr.entity_image,
         decode(imageattr.entity_image, '', 'N', 'Y') entity_image_displayed,
         rel.end_date,
         decode(rel.cons_relationship_id, :0, 'Y', 'N') blue_dot_displayed,
         decode(operassoc.parent_entity_id, '', 'Ownership', 'ParentText') ownership_switcher
    FROM     FEM_ENTITIES_B feb,
         FEM_ENTITIES_TL fetl,
         FEM_ENTITIES_TL pfetl,
         GCS_ENTITY_CONS_ATTRS eca,
         FND_CURRENCIES_TL ccytl,
         FEM_ENTITIES_ATTR fetea,
         FEM_DIM_ATTRIBUTES_B fetda,
         FEM_DIM_ATTR_VERSIONS_B fet_dav,
         FEM_ENTITY_TYPES_TL fettl,
         GCS_CONS_RELATIONSHIPS rel,
         GCS_TREATMENTS_TL ttl,
         GCS_CURR_TREATMENTS_TL cttl,
         (SELECT     operea.entity_id AS parent_entity_id,
              operea.dim_attribute_numeric_member AS child_entity_id
         FROM     FEM_ENTITIES_ATTR operea,
              FEM_DIM_ATTRIBUTES_B operda,
              FEM_DIM_ATTR_VERSIONS_B oper_dav
         WHERE     operda.attribute_varchar_label = 'OPERATING_ENTITY'
         AND     operda.attribute_id = operea.attribute_id
         AND     oper_dav.attribute_id = operda.attribute_id
         AND     oper_dav.default_version_flag = 'Y'
         AND     oper_dav.version_id = operea.version_id) operassoc,
         (SELECT     operea.entity_id AS parent_entity_id,
              operea.dim_attribute_numeric_member AS child_entity_id
         FROM     FEM_ENTITIES_ATTR operea,
              FEM_DIM_ATTRIBUTES_B operda,
              FEM_DIM_ATTR_VERSIONS_B oper_dav
         WHERE     operda.attribute_varchar_label = 'OPERATING_ENTITY'
         AND     operda.attribute_id = operea.attribute_id
         AND     oper_dav.attribute_id = operda.attribute_id
         AND     oper_dav.default_version_flag = 'Y'
         AND     oper_dav.version_id = operea.version_id) childassoc,
         (SELECT     imageea.entity_id,
              imageea.varchar_assign_value AS entity_image
         FROM     FEM_ENTITIES_ATTR imageea,
              FEM_DIM_ATTRIBUTES_B imageda,
              FEM_DIM_ATTR_VERSIONS_B image_dav
         WHERE     imageda.attribute_varchar_label = 'IMAGE_NAME'
         AND     imageda.attribute_id = imageea.attribute_id
         AND     image_dav.attribute_id = imageda.attribute_id
         AND     image_dav.default_version_flag = 'Y'
         AND     image_dav.version_id = imageea.version_id) imageattr
    WHERE     feb.entity_id = fetl.entity_id
    AND     fetl.language = userenv('LANG')
    AND     eca.entity_id (+)= feb.entity_id
    AND     eca.hierarchy_id (+)= :1
    AND     ccytl.currency_code (+)= eca.currency_code
    AND     ccytl.language (+)= userenv('LANG')
    AND     fetea.entity_id = feb.entity_id
    AND     fetea.attribute_id = fetda.attribute_id
    AND     fetda.attribute_varchar_label = 'ENTITY_TYPE_CODE'
    AND     fet_dav.attribute_id = fetda.attribute_id
    AND     fet_dav.default_version_flag = 'Y'
    AND     fet_dav.version_id = fetea.version_id
    AND     fettl.entity_type_code = fetea.dim_attribute_varchar_member
    AND     fettl.language = userenv('LANG')
    AND     rel.child_entity_id (+)= feb.entity_id
    AND     rel.hierarchy_id (+)= :2
    AND rel.actual_ownership_flag (+)= 'Y'
    AND     pfetl.entity_id (+)= rel.parent_entity_id
    AND     pfetl.language (+)= userenv('LANG')
    AND     ttl.treatment_id (+)= rel.treatment_id
    AND     ttl.language (+)= userenv('LANG')
    AND     cttl.curr_treatment_id (+)= rel.curr_treatment_id
    AND     cttl.language (+)= userenv('LANG')
    AND     operassoc.child_entity_id (+)= rel.child_entity_id
    AND     operassoc.parent_entity_id (+)= rel.parent_entity_id
    AND     childassoc.parent_entity_id (+)= feb.entity_id
    AND     imageattr.entity_id (+)= feb.entity_id
    AND     (rel.start_date IS NULL OR rel.start_date <= nvl(:3, rel.start_date))
    AND     (rel.end_date IS NULL OR rel.end_date >= nvl(:4, rel.end_date))
    ORDER BY     decode(     operassoc.parent_entity_id,
                   '', decode(     entity_type_code,
                             'O', 2,
                             'C', 3,
                             'E', 4,
                             999),
                   1),
              entity_name) QRSLT WHERE PARENT_ENTITY_ID = :6
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:896)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1169)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1435)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2845)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1835)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:533)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:421)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:335)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:610)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:359)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:797)
    ## Detail 0 ##
    java.sql.SQLException: ORA-01722: invalid number
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:966)
         at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1062)
         at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:850)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3384)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:857)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4511)
         at oracle.apps.gcs.setup.hierarchy.server.EntitiesVOImpl.executeQueryForCollection(EntitiesVOImpl.java:106)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.activateRowSetState(ViewRowSetImpl.java:4925)
         at oracle.jbo.server.ViewRowSetIteratorImpl.activateIteratorState(ViewRowSetIteratorImpl.java:3792)
         at oracle.jbo.server.ViewRowSetImpl.activateIteratorState(ViewRowSetImpl.java:4960)
         at oracle.jbo.server.OAJboViewObjectImpl.activateInternalRowSets(Unknown Source)
         at oracle.jbo.server.OAJboApplicationModuleImpl.activateState(Unknown Source)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.activateState(OAApplicationModuleImpl.java:3066)
         at oracle.jbo.server.ApplicationModuleImpl.doActivateState(ApplicationModuleImpl.java:7053)
         at oracle.jbo.server.ApplicationModuleImpl.doActivateAMState(ApplicationModuleImpl.java:6961)
         at oracle.jbo.server.Serializer.activate(Serializer.java:274)
         at oracle.jbo.server.DBSerializer.activateRootAM(DBSerializer.java:330)
         at oracle.jbo.server.ApplicationModuleImpl.activateFromStack(ApplicationModuleImpl.java:5768)
         at oracle.jbo.server.ApplicationModuleImpl.activateState(ApplicationModuleImpl.java:5628)
         at oracle.jbo.server.ApplicationModuleImpl.activateStateForUndo(ApplicationModuleImpl.java:7697)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.activateStateForUndo(OAApplicationModuleImpl.java:2159)
         at oracle.apps.gcs.setup.hierarchy.server.HierarchyAMImpl.activateStateForUndo(HierarchyAMImpl.java:10364)
         at oracle.apps.gcs.setup.hierarchy.webui.HierUploadCO.processFormRequest(HierUploadCO.java:89)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:815)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1189)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1027)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:993)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:848)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1027)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:993)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:848)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2841)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1835)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:533)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:421)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:335)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:610)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:359)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:797)
    java.sql.SQLException: ORA-01722: invalid number
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:966)
         at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1062)
         at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:850)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3384)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:857)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:666)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3655)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(Unknown Source)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4511)
         at oracle.apps.gcs.setup.hierarchy.server.EntitiesVOImpl.executeQueryForCollection(EntitiesVOImpl.java:106)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:742)
         at oracle.jbo.server.ViewRowSetImpl.activateRowSetState(ViewRowSetImpl.java:4925)
         at oracle.jbo.server.ViewRowSetIteratorImpl.activateIteratorState(ViewRowSetIteratorImpl.java:3792)
         at oracle.jbo.server.ViewRowSetImpl.activateIteratorState(ViewRowSetImpl.java:4960)
         at oracle.jbo.server.OAJboViewObjectImpl.activateInternalRowSets(Unknown Source)
         at oracle.jbo.server.OAJboApplicationModuleImpl.activateState(Unknown Source)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.activateState(OAApplicationModuleImpl.java:3066)
         at oracle.jbo.server.ApplicationModuleImpl.doActivateState(ApplicationModuleImpl.java:7053)
         at oracle.jbo.server.ApplicationModuleImpl.doActivateAMState(ApplicationModuleImpl.java:6961)
         at oracle.jbo.server.Serializer.activate(Serializer.java:274)
         at oracle.jbo.server.DBSerializer.activateRootAM(DBSerializer.java:330)
         at oracle.jbo.server.ApplicationModuleImpl.activateFromStack(ApplicationModuleImpl.java:5768)
         at oracle.jbo.server.ApplicationModuleImpl.activateState(ApplicationModuleImpl.java:5628)
         at oracle.jbo.server.ApplicationModuleImpl.activateStateForUndo(ApplicationModuleImpl.java:7697)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.activateStateForUndo(OAApplicationModuleImpl.java:2159)
         at oracle.apps.gcs.setup.hierarchy.server.HierarchyAMImpl.activateStateForUndo(HierarchyAMImpl.java:10364)
         at oracle.apps.gcs.setup.hierarchy.webui.HierUploadCO.processFormRequest(HierUploadCO.java:89)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:815)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1189)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1027)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:993)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:848)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1027)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:993)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:848)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:382)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2841)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1835)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:533)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:421)
         at OA.jspService(_OA.java:212)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:335)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:610)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:359)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:797)

  • DB Update - How to Return the Number of Affected Rows?

    I created a DB Adapter that updates a record. I'd like to know if there is a way to return the affected number of rows. Currently, the DB Adapter Wizard seems not to create a return for the generated XSD.
    Thanks,
    Mark

    > Is it by somehow possible to use some custom query
    for this and use the 'returning'-clause to get the
    results back from the DB-adapter. On these results
    you can do some counts.
    Thanks for your reply.
    I have given a thought to that option too, however the issue is that, in order to use returning clause you have to use a temporary SQL variable which I believe can not be used unless we use a PL/SQL block (Please correct me, if I am wrong).
    I wanted to get away with the option of re-querying the 'SELECT' or a PL/SQL Block. Any suggestions?
    Thanks & regards

  • Error in running custom query from jspx(site) for Content Tracker Report

    Hi All,
    I want to generate a custom Content Tracker Report. I am able to do so from Content Tracker console, but when i try to invoke the service 'SCT_GET_DOCUMENT_INFO_ADMIN' or 'SCT_GET_DOCUMENT_INFO' with my custom query(which simply counts the number of rows in a table) from my jspx page, it gives the following error.
    oracle.stellent.wcm.server.request.RequestException: Error
    occurred in Content Server executing service
    'SCT_GET_DOCUMENT_INFO_ADMIN'
    Caused By: oracle.stellent.ridc.protocol.ServiceException: Unable to get
    document info. Unable to execute service method 'sctExecuteQuery'. The
    error was caused by an internally generated issue. The error has been
    logged.
    What could be the reason and the resolution?
    Also, I know that i am invoking the service in the right way as custom report from query as 'select * from users' works fine from site.
    P.S. I am using UCM 11g + SSXA

    Things are turning weird. The below two queries work from jspx.
    1. SELECT * FROM Users
    2. SELECT dname FROM Users
    But, the following query gives error (SQL is correct).
    select dname, count(dname) from users group by dname
    Unable to execute service method 'sctExecuteQuery'. Null pointer is dereferenced.
    $Unable to get document info.!csUnableToExecMethod,sctExecuteQuery!syNullPointerException
    intradoc.common.ServiceException: !$Unable to get document info.!csUnableToExecMethod,sctExecuteQuery
    *ScriptStack SCT_GET_DOCUMENT_INFO_ADMIN
    3:sctExecuteQuery,**no captured values**
    at intradoc.server.ServiceRequestImplementor.buildServiceException(ServiceRequestImplementor.java:2115)
    at intradoc.server.Service.buildServiceException(Service.java:2260)
    at intradoc.server.Service.createServiceExceptionEx(Service.java:2254)
    at intradoc.server.Service.createServiceException(Service.java:2249)
    at intradoc.server.Service.doCodeEx(Service.java:584)
    at intradoc.server.Service.doCode(Service.java:505)
    at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1643)
    at intradoc.server.Service.doAction(Service.java:477)
    at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1458)
    at intradoc.server.Service.doActions(Service.java:472)
    at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1391)
    at intradoc.server.Service.executeActions(Service.java:458)
    at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:737)
    at intradoc.server.Service.doRequest(Service.java:1890)
    at intradoc.server.ServiceManager.processCommand(ServiceManager.java:435)
    at intradoc.server.IdcServerThread.processRequest(IdcServerThread.java:265)
    at intradoc.server.IdcServerThread.run(IdcServerThread.java:160)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
    Caused by: java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
    at intradoc.util.IdcConcurrentHashMap.get(IdcConcurrentHashMap.java:60)
    This works fine from Content Tracker UI.
    Anyone has any idea, what could be the issue here?

  • Unable to return a number from CASE statement in plsql

    Hello all!
    Back in November of last year, I received some assistance from user "jarola" regarding changing the color of a column item in a query based on the resulting value. This discussion yielded;
    declare
       l_query varchar2(4000) := '';
    begin
       l_query := '
         select i.INVENTORY_ID,
                io.ORDER_QUANTITY,
                CASE
                   WHEN i.QUANTITY_AVAILABLE=0
                   THEN ''<span style="color:red;"> ''|| i.QUANTITY_AVAILABLE ||''</span>''
                   ELSE to_char(i.QUANTITY_AVAILABLE)
                END,
                i.QUANTITY_AVAILABLE qty_avail_hold,
                i.STRAIN_CODE,
                i.STRAIN_NAME,
                i.GENOTYPE,
                i.AGE,
                i.***,
                (lower(substr(i.ROOM_NUMBER,1,instr(i.ROOM_NUMBER,''-'',1,1)-1))) ROOM_NUMBER
         from   SM_INVENTORY i,
                SM_INVENTORY_ORDER io
         where  io.ORDER_ID (+)= :F111_MODIFYING_ORDER
         and    io.INVENTORY_ID (+)= i.INVENTORY_ID';
    return l_query;
    end;Problem is, sorting (report attributes for column set to "sort") on column i.QUANTITY_AVAILABLE is broken as even though the data in the table is number(12,0), the CASE statement returns it as alpha. I'm having difficulty getting this CASE statement to return a number as these modifications cause generic compilation errors.
    ELSE i.QUANTITY_AVAILABLE
    ELSE to_number(i.QUANTITY_AVAILABLE)
    Google/sqlplus docs have yielded little. Might anyone offer advice?
    Thanks!!!
    Paul

    Hello Varad! Thanks for the reply.
    Sorry, but I copied some old information in my code example. the CASE statement I'm actually using is;
    CASE
       WHEN i.QUANTITY_AVAILABLE=0
       THEN ''<span style="color:red;"> ''|| i.QUANTITY_AVAILABLE ||''</span>''
       ELSE to_char(i.QUANTITY_AVAILABLE)
       END AS QUANTITY_AVAILABLESo I'm already returning the result as labeled "QUANTITY_AVAILABLE".
    What I did was click on the pencil/paper icon to the left of the alias of my column in the "Column Attributes" pane in "Report Attributes" to get to the "Column Attributes" page and plugged #QUANTITY_AVAILABLE# into the HTML Expression field of the "Column Formatting" pane of the "Column Attributes" page for the "QUANTITY_AVAILABLE" column.
    No joy, sort still broken...
    Isn't the problem that fundamentally, the CASE statement returns an alpha? I wouldn't expect the sort to ever work until it can return a number (which it appears SQL, used this way, it cannot do).
    So, I considered that END AS QUANTITY_AVAILABLE might be the problem as it's named the same as the column, so I changed it (and the HTML Expression entry) to END AS QUANTITY_AVAIL (changed the name).
    Sort as alpha still happening.
    Any other thoughts?

  • How do you return the number of Rows in a ResultSet??

    How do you return the number of Rows in a ResultSet? It's easy enough to do in the SQL query using COUNT(*) but surely JDBC provides a method to return the number of rows.
    The ResultSetMetaData interface provides a method for counting the number of columns but nothing for the rows.
    Thanks

    No good way before JDBC2.0. u can use JDBC2.0 CachedRowSet.size() to retrieve the number of rows got by a ResultSet.

  • Return specific number of rows depending on the data in a column in table

    Hi,
    I have a table named orders which has column orderid and noofbookstoorder in addition to other columns.
    I want to query the orders table and depending on the value of the 'noofbookstoorder' value return that number of rows.
    Eg
    Orderid noofbookstoorder
    1 1
    2 3
    3 2
    when I query the above data saying
    select * from orders where orderid=2;
    since it has noofbookstoorders value as 3 the query should return 3 rows and when I query
    select * from orders where orderid=3;
    it should return 2 rows and
    select * from orders where orderid=1;
    should return 1 row.
    Is it possible to achieve this. If yes, then how do I write my query.
    Thanks in advance.

    with t as (
               select 1 Orderid,1 noofbookstoorder from dual union all
               select 2,3 from dual union all
               select 3,2 from dual
    select  t.*
      from  t,
            table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.OdciNumberList))
      where Orderid = <order-id>
    /For example:
    SQL> with t as (
      2             select 1 Orderid,1 noofbookstoorder from dual union all
      3             select 2,3 from dual union all
      4             select 3,2 from dual
      5            )
      6  select  t.*
      7    from  t,
      8          table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.OdciNumberList))
      9    where Orderid = 2
    10  /
       ORDERID NOOFBOOKSTOORDER
             2                3
             2                3
             2                3
    SQL> with t as (
      2             select 1 Orderid,1 noofbookstoorder from dual union all
      3             select 2,3 from dual union all
      4             select 3,2 from dual
      5            )
      6  select  t.*
      7    from  t,
      8          table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.OdciNumberList))
      9    where Orderid = 3
    10  /
       ORDERID NOOFBOOKSTOORDER
             3                2
             3                2
    SQL> with t as (
      2             select 1 Orderid,1 noofbookstoorder from dual union all
      3             select 2,3 from dual union all
      4             select 3,2 from dual
      5            )
      6  select  t.*
      7    from  t,
      8          table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.Odc
    iNumberList))
      9    where Orderid = 1
    10  /
       ORDERID NOOFBOOKSTOORDER
             1                1
    SQL>  -- And if you want to select multiple orders
    SQL> with t as (
      2             select 1 Orderid,1 noofbookstoorder from dual union all
      3             select 2,3 from dual union all
      4             select 3,2 from dual
      5            )
      6  select  t.*
      7    from  t,
      8          table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.Odc
    iNumberList))
      9    where Orderid in (2,3)
    10  /
       ORDERID NOOFBOOKSTOORDER
             2                3
             2                3
             2                3
             3                2
             3                2
    SQL> SY.
    Edited by: Solomon Yakobson on Oct 26, 2009 7:36 AM

  • Oracle Procedure returning more number of records

    Hi,
    I have created an Oracle Procedure which is supposed to fetch a record as per the input parameter passed.
    The core query in the procedure is as below -
    SELECT DISTINCT col1 FROM my_tab WHERE col2 = 'Input parameter'
    Few of the input parms (col2) has more number of records (col1) and so the procedure gives an error like -
    'ORA-01422: exact fetch returns more than requested number of rows'
    Could you please let me know how can I modify the procedure so that it would return more number of records as the case may be?
    Thank you!

    It still gives me the same error when it encounters more than one output.Yes, I'm sure it does.
    But we can't tell you how to fix it because we don't know what you want.
    What's the purpose of the procedure?
    Is it to "spell check" the name of an intermediary? If so, you'll need to figure out what to do when you have more then one person with the same name.
    You can add AND ROWNUM = 1. Or perhaps you can trap the too_many_rows exception.
    Your procedure doesn't return anything (no out variables). Is that correct?
    Or is the purpose of the procedure to return the ID of the matching name?

Maybe you are looking for

  • ESS/MSS Installation to R/3 4.7 Enterprise

    Goodday Guru's, I've just received a requirement to install and configure ESS/MSS. Backend system is on R/3 4.7 and Portal is on EP 6.0. I have downloaded ESS 50.4 and MSS 60.1_19 for this requirement. There would not be any development work, only ou

  • 34,000 page excel file needs to be converted to pdf

    I have a 34,000 page excel file that I need to convert to pdf. The excel file is 13mb. I'm using excel 2013 on Win 7. Within excel, I have tried Save As pdf.  It has never finished.  I've let it run all day and night, but it gets to about 90% and han

  • Hard Drive copying

    Hi everyone, i've not had to copy my entire hard drive before, this is the drive with  my OS on it etc so i don't particularly want to simply reinstall onto a new HD, as i want everything on it still intact... how do i go about this? can i do it with

  • JOptionPane with multiple inputs

    Well, I want to know , if someone can help me with JOptionPane, I need a windows of JOptionPane.showInputDialog (), that reads 3 inputs in the same window, I mean if I can have three Input Spaces in the same window.

  • How to set focus on the last row of JTextPane

    how to set focus on the last row of JTextPane? import javax.swing.*; import javax.swing.text.html.*; import java.awt.*; import java.awt.event.*; public class MyGUITest extends JPanel implements ActionListener {   public static void main(String[] args