JDBC Sender Adapter : java.sql.SQLException: Cursor state not valid.

Hello all,
We have configured JDBC Sender Adapter which fetches around 10K records with poll interval 1hr  from DB2 System .
It was working fine,suddenly it started throwing an exception in Adapter Monitoring :
Error during conversion of query result to XML: java.sql.SQLException: Cursor state not valid.
It is not fetching any records.
Without changing any configurations when we tried to fetch to around 1000 records it's working fine.
For 10K records same exception persists
What could be the reason ?How to resolve this issue?
regards
GangaPrasad

Hello Christophe ,
Trace in VA :::
Date : 05/09/2008
Time : 11:45:57:750
Message : Unexpected error converting database resultset to XML, reason: java.sql.SQLException: Cursor state not valid.
     at java.lang.Throwable.<init>(Throwable.java:194)
     at java.lang.Exception.<init>(Exception.java:41)
     at java.sql.SQLException.<init>(SQLException.java:40)
     at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
     at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
     at com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3580)
     at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3223)
     at sun.reflect.GeneratedMethodAccessor459222074.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:309)
     at com.sap.aii.adapter.jdbc.sql.jdbctrace.TraceInvocationHandler.invoke(TraceInvocationHandler.java:45)
     at com.sap.aii.adapter.jdbc.sql.jdbctrace.$Proxy254.getString(Unknown Source)
     at com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(JDBC2XI.java:954)
     at com.sap.aii.adapter.jdbc.JDBC2XI.invoke(JDBC2XI.java:492)
     at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:475)
     at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
     at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:99)
     at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:119)
Severity : Error
Category : /Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC
Location : com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(ResultSet, ResultSetMetaData)
Application :
Thread : XI JDBC2XI[JDBC_SND_DB2_VehicleReceiving/DB2PRD00/]_170
Datasource : 12428950:/usr/sap/PXI/DVEBMGS01/j2ee/cluster/server0/log/applications/com.sap.xi/xi.log
Message ID : 00145E742794005E0014980B000000BE00044CC763766C4F
Source Name : /Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC
Argument Objs : java.sql.SQLException: Cursor state not valid.
     at java.lang.Throwable.<init>(Throwable.java:194)
     at java.lang.Exception.<init>(Exception.java:41)
     at java.sql.SQLException.<init>(SQLException.java:40)
     at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
     at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
     at com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3580)
     at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3223)
     at sun.reflect.GeneratedMethodAccessor459222074.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:309)
     at com.sap.aii.adapter.jdbc.sql.jdbctrace.TraceInvocationHandler.invoke(TraceInvocationHandler.java:45)
     at com.sap.aii.adapter.jdbc.sql.jdbctrace.$Proxy254.getString(Unknown Source)
     at com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(JDBC2XI.java:954)
     at com.sap.aii.adapter.jdbc.JDBC2XI.invoke(JDBC2XI.java:492)
     at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:475)
     at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
     at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:99)
     at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:119)
Arguments : java.sql.SQLException: Cursor state not valid.
     at java.lang.Throwable.<init>(Throwable.java:194)
     at java.lang.Exception.<init>(Exception.java:41)
     at java.sql.SQLException.<init>(SQLException.java:40)
     at com.ibm.as400.access.JDError.throwSQLException(JDError.java:389)
     at com.ibm.as400.access.JDError.throwSQLException(JDError.java:366)
     at com.ibm.as400.access.AS400JDBCResultSet.getValue(AS400JDBCResultSet.java:3580)
     at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3223)
     at sun.reflect.GeneratedMethodAccessor459222074.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:309)
     at com.sap.aii.adapter.jdbc.sql.jdbctrace.TraceInvocationHandler.invoke(TraceInvocationHandler.java:45)
     at com.sap.aii.adapter.jdbc.sql.jdbctrace.$Proxy254.getString(Unknown Source)
     at com.sap.aii.adapter.jdbc.JDBC2XI.convert2XML(JDBC2XI.java:954)
     at com.sap.aii.adapter.jdbc.JDBC2XI.invoke(JDBC2XI.java:492)
     at com.sap.aii.af.service.scheduler.JobBroker$Worker.run(JobBroker.java:475)
     at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
     at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:99)
     at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:119)
Dsr Component :
Dsr Transaction : d1f629d01d9b11dd984200145e742794
Dsr User :
Indent : 0
Level : 0
Message Code :
Message Type : 1
Relatives : com.sap.aii.adapter.jdbc.JDBC2XI
Resource Bundlename :
Session : 0
Source : /Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC
ThreadObject : XI JDBC2XI[JDBC_SND_DB2_VehicleReceiving/DB2PRD00/]_170
Transaction : SAP J2EE Engine JTA Transaction : [0ffffffbdffffffa6ffffff960086]
User : J2EE_GUEST
Regards
Ganga Prasad

Similar Messages

  • JDBC Receiver adapter-java.sql.SQLException: ORA-00904: "BATCH_ID": invalid

    Hi
    I am trying insert rows in Oracle database using JDBC receiver adapter setup in PI 7.1. However this receiver adapter is throwing following exception.
    Delivering the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'PRADEEP_OTC_ORDERS' (structure 'statement'): java.sql.SQLException: ORA-00904: "BATCH_ID": invalid identifier .
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:mt_sql_writer xmlns:ns0="http://rdbms_poc">
    <statement>
         <dbtablename action="INSERT">
                <table>PRADEEP_OTC_ORDERS</table>
              <access>
                     <order_id>19126</order_id>
                     <version>1</version>
                     <batch_id>132</batch_id>
                </access>
           </dbtablename>
    </statement>
    </ns0:mt_sql_writer>
    PRADEEP_OTC_ORDERS table has just 3 columns as specified the access segment. However I stil get this ORA-00904 error message.
    Any idea on what could be wrong.?
    Thanks
    -Pradeep

    Hi All,
    Thanks a lot for responding...
    I verified the table structure, table just contains those 3 coulms all varchar type.
    I modified the column name as well, But was still getting ORA-00904. Then I went directly to the the database and executed below insert statement,
    insert into PRADEEP_OTC_ORDERS (mps_order_id, mps_version,mps_batch_id) Values(1,2,3)
    I got exact SQL Error: ORA-00904: "MPS_BATCH_ID": invalid identifier.
    So ISAP JDBC adapter is not enclosing the string values in quotes.
    SAP documentation says it puts quotes for values and treats everything as string(text).
    Anybody has any idea, why JDBC receiver adapter not enclosing the values in quotes?
    Thanks
    -Pradeep

  • "Cursor state not valid.", AS400 JDBC, IBM JTOpen 3.0

    I am using JT400.JAR from IBM's JTOpen 3.0 release.
    I am running JTOpen inside of Websphere 3.5.x
    JDBC auto-commit is enabled.
    When running JDBC queries, I am observing intermittent SQL
    exceptions.
    The message that I see is "Cursor state not valid."
    What is the cause of "Cursor state not valid."?
    Is there a workaround?
    Here is the stack trace:
    java.sql.SQLException: Cursor state not valid.
    at com.ibm.as400.access.JDError.throwSQLException(JDError.java:360)
    at
    com.ibm.as400.access.AS400JDBCResultSet.checkOpen(AS400JDBCResultSet.java:35
    6)
    at
    com.ibm.as400.access.AS400JDBCResultSet.beforePositioning(AS400JDBCResultSet
    .java:1157)
    at
    com.ibm.as400.access.AS400JDBCResultSet.next(AS400JDBCResultSet.java:1680)
    at foobar.SomeData_Peer.createObjects(SomeData_Peer.java:54)

    In your sequel statement, are you assigning the results in order to how they appear in your sequel statement.
    For example:
    SELECT name, address, email FROM tblUser
    If you, in code, write something like this:
    newaddress = rs.getString("address").toString()
    You can not then say
    newname = rs.getString("name").toString() - because it does not appear in the order you wrote in the select statement.
    I hope that helps you

  • JBO-27122: SQL error during statement preparation IN OAF(java.sql.SQLException: ORA-01008: not all variables bound)

    Hi Friends,
    I have have extended CO where i have added dynamic where condition to VO,it's throwing error.
    Code added in controller :
    public class Custom_HomePageCO extends HomePageCO
      public Custom_HomePageCO()
    public void processRequest(OAPageContext pageContext,OAWebBean webBean)
      super.processRequest(pageContext,webBean);
      System.out.println("NewClase");
      OAApplicationModule am=pageContext.getApplicationModule(webBean);
      System.out.println(am);
      OAApplicationModule am1=(OAApplicationModule)am.findApplicationModule("TrackExpenseReportsAM");
    System.out.println(am1);
      OAViewObject vo=(OAViewObject)am1.findViewObject("TrackExpenseReportsVO");
      System.out.println(vo);
      vo.setWhereClause("REPORT_SUBMITTED_DATE is not null");
        vo.executeQuery();
    public void processFormRequest(OAPageContext pageContext,OAWebBean webBean)
      super.processFormRequest(pageContext,webBean);
    Error message:
    Exception Details.
    Error Details
           Logout
          Error Page
          Exception Details.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation.  Statement: SELECT * FROM (SELECT
    AI.DESCRIPTION PURPOSE,
    AI.INVOICE_CURRENCY_CODE CURRENCY_CODE,
    AI.INVOICE_DATE REPORT_DATE,
    AERH.REPORT_SUBMITTED_DATE REPORT_SUBMITTED_DATE,
    AI.INVOICE_NUM REPORT_NUMBER,
    TO_CHAR(decode(nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),
                     0, decode(AI.CANCELLED_DATE,
                                 null, APS.GROSS_AMOUNT,
                                 AERH.TOTAL),
                   nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0)) ,  
            FND_CURRENCY_CACHE.GET_FORMAT_MASK
            (AI.INVOICE_CURRENCY_CODE, 30)) ||' '|| AI.INVOICE_CURRENCY_CODE REPORT_TOTAL_CURRENCY,
    TO_CHAR(decode(nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),
                     0, decode(AI.CANCELLED_DATE,
                                 null, APS.GROSS_AMOUNT,
                                 AERH.TOTAL),
                   nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0)) ,  
            FND_CURRENCY_CACHE.GET_FORMAT_MASK
            (AI.INVOICE_CURRENCY_CODE, 30))
    REPORT_TOTAL,
    P.PERSON_ID EMPLOYEE_ID,
    AERH.REPORT_HEADER_ID REPORT_HEADER_ID,
    P.FULL_NAME FULL_NAME ,
    DECODE(AI.CANCELLED_DATE,null,
                              nvl(aerh.expense_status_code, DECODE(APS.GROSS_AMOUNT ,0,'PAID',
                                    decode(AI.Payment_status_flag,'Y','PAID',
                                                            'N','INVOICED',
                                                            'P','PARPAID',NULL))),
                                            'CANCELLED') STATUS_CODE,
    AERH.source SOURCE,
    NULL CURRENT_APPROVER,
    ROUND(sysdate - AI.LAST_UPDATE_DATE) DAYS_SINCE_ACTIVITY,
    AERH.RECEIPTS_STATUS RECEIPTS_STATUS_CODE,
    AERH.HOLDING_REPORT_HEADER_ID,
    AI.VENDOR_ID VENDOR_ID,
    AERH.AMT_DUE_CCARD_COMPANY AMT_DUE_CCARD_COMPANY,
    AERH.AMT_DUE_EMPLOYEE AMT_DUE_EMPLOYEE,         
    'CurrentApproverName' CURRENT_APPROVER_SWITCHER,
    to_char(AERH.LAST_UPDATE_DATE, 'DD-MON-RRRR HH:MI:SS'),
    AI.INVOICE_ID INVOICE_ID
    FROM
           AK_WEB_USER_SEC_ATTR_VALUES A,
           PO_VENDORS PV,
           AP_INVOICES AI,
           AP_EXPENSE_REPORT_HEADERS AERH,
           PER_PEOPLE_X P,
           AP_PAYMENT_SCHEDULES APS
    WHERE  AI.INVOICE_ID= APS.INVOICE_ID
    AND    AI.INVOICE_ID = AERH.VOUCHNO(+)
    AND AI.INVOICE_TYPE_LOOKUP_CODE||'' = 'EXPENSE REPORT'
    AND A.ATTRIBUTE_CODE = 'ICX_HR_PERSON_ID'
    AND PV.EMPLOYEE_ID = A.NUMBER_VALUE
    AND A.WEB_USER_ID = :1
    AND P.PERSON_ID = PV.EMPLOYEE_ID
    AND PV.VENDOR_ID = AI.VENDOR_ID
    AND DECODE (AI.PAYMENT_STATUS_FLAG,
             'Y', sysdate - AI.LAST_UPDATE_DATE,
            decode(APS.GROSS_AMOUNT , 0 ,sysdate - AI.LAST_UPDATE_DATE,0)
              )  <= 30
    AND (AERH.SOURCE <> 'Both Pay' OR AERH.REPORT_HEADER_ID IS NULL)       
    UNION
    SELECT
    AI.DESCRIPTION PURPOSE,
    AI.INVOICE_CURRENCY_CODE CURRENCY_CODE,
    AI.INVOICE_DATE REPORT_DATE,
    AERH.REPORT_SUBMITTED_DATE REPORT_SUBMITTED_DATE,
    AI.INVOICE_NUM REPORT_NUMBER,
    TO_CHAR(decode(nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),
                     0, decode(AI.CANCELLED_DATE,
                                 null, APS.GROSS_AMOUNT,
                                 AERH.TOTAL),
                   nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0)) ,  
            FND_CURRENCY_CACHE.GET_FORMAT_MASK
            (AI.INVOICE_CURRENCY_CODE, 30)) ||' '|| AI.INVOICE_CURRENCY_CODE REPORT_TOTAL_CURRENCY,
    TO_CHAR(decode(nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),
                     0, decode(AI.CANCELLED_DATE,
                                 null, APS.GROSS_AMOUNT,
                                 AERH.TOTAL),
                   nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0)),  
            FND_CURRENCY_CACHE.GET_FORMAT_MASK
            (AI.INVOICE_CURRENCY_CODE, 30))
    REPORT_TOTAL,
    P.PERSON_ID EMPLOYEE_ID,
    AERH.REPORT_HEADER_ID REPORT_HEADER_ID,
    P.FULL_NAME FULL_NAME ,
    DECODE(AI.CANCELLED_DATE,null,
                              nvl(aerh.expense_status_code, DECODE(APS.GROSS_AMOUNT ,0,'PAID',
                                    decode(AI.Payment_status_flag,'Y','PAID',
                                                            'N','INVOICED',
                                                            'P','PARPAID',NULL))),
                                            'CANCELLED') STATUS_CODE,
    AERH.source SOURCE,
    NULL CURRENT_APPROVER,
    ROUND(sysdate - AI.LAST_UPDATE_DATE) DAYS_SINCE_ACTIVITY,
    AERH.RECEIPTS_STATUS RECEIPTS_STATUS_CODE,
    AERH.HOLDING_REPORT_HEADER_ID,
    AI.VENDOR_ID VENDOR_ID,
    AERH.AMT_DUE_CCARD_COMPANY AMT_DUE_CCARD_COMPANY,
    AERH.AMT_DUE_EMPLOYEE AMT_DUE_EMPLOYEE,         
    'CurrentApproverName' CURRENT_APPROVER_SWITCHER,
    to_char(AERH.LAST_UPDATE_DATE, 'DD-MON-RRRR HH:MI:SS'),
    AI.INVOICE_ID INVOICE_ID
    FROM
           AK_WEB_USER_SEC_ATTR_VALUES A,
           PO_VENDORS PV,
           AP_INVOICES AI,
           AP_EXPENSE_REPORT_HEADERS AERH,
           PER_PEOPLE_X P,
           AP_PAYMENT_SCHEDULES APS
    WHERE  AI.INVOICE_ID= APS.INVOICE_ID
    AND    AI.INVOICE_ID = AERH.VOUCHNO(+)
    AND AI.INVOICE_TYPE_LOOKUP_CODE||'' in ('STANDARD','MIXED')
    AND A.ATTRIBUTE_CODE = 'ICX_HR_PERSON_ID'
    AND AI.PAID_ON_BEHALF_EMPLOYEE_ID = A.NUMBER_VALUE
    AND A.WEB_USER_ID = :2
    AND P.PERSON_ID = AI.PAID_ON_BEHALF_EMPLOYEE_ID
    AND PV.VENDOR_ID = AI.VENDOR_ID
    AND DECODE (AI.PAYMENT_STATUS_FLAG,
             'Y', sysdate - AI.LAST_UPDATE_DATE,
            decode(APS.GROSS_AMOUNT , 0 ,sysdate - AI.LAST_UPDATE_DATE,0)
            ) <= 30
    AND (AERH.SOURCE <> 'Both Pay' OR AERH.REPORT_HEADER_ID IS NULL)            
    UNION ALL
    SELECT
    AERH.DESCRIPTION PURPOSE,
    AERH.DEFAULT_CURRENCY_CODE CURRENCY_CODE,
    AERH.WEEK_END_DATE REPORT_DATE,
    AERH.REPORT_SUBMITTED_DATE REPORT_SUBMITTED_DATE,
    AERH.INVOICE_NUM REPORT_NUMBER,
    TO_CHAR(nvl(AERH.AMT_DUE_CCARD_COMPANY+AERH.AMT_DUE_EMPLOYEE+nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),AERH.TOTAL),FND_CURRENCY_CACHE.GET_FORMAT_MASK
      (AERH.DEFAULT_CURRENCY_CODE,30)) ||' '|| AERH.DEFAULT_CURRENCY_CODE REPORT_TOTAL_CURRENCY,
    TO_CHAR(nvl(AERH.AMT_DUE_CCARD_COMPANY+AERH.AMT_DUE_EMPLOYEE+nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),AERH.TOTAL),FND_CURRENCY_CACHE.GET_FORMAT_MASK
      (AERH.DEFAULT_CURRENCY_CODE,30)) REPORT_TOTAL,
    PER_EMPLOYEE.PERSON_ID EMPLOYEE_ID,
    AERH.REPORT_HEADER_ID REPORT_HEADER_ID,
    PER_EMPLOYEE.FULL_NAME FULL_NAME,
    NVL(AERH.expense_status_code,
      AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(AERH.Source, AERH.Workflow_approved_flag,
      AERH.report_header_id, 'Y', 'N')) STATUS_CODE,
    AERH.source SOURCE,
    NVL (PER_APPROVER.full_name, AP_WEB_OA_ACTIVE_PKG.GetCurrentApprover(AERH.Source,
            AERH.Workflow_approved_flag, AERH.report_header_id, AERH.expense_status_code)) CURRENT_APPROVER,
    ROUND(NVL(sysdate - AERH.EXPENSE_LAST_STATUS_DATE,
              sysdate - AERH.LAST_UPDATE_DATE)) DAYS_SINCE_ACTIVITY,
    AERH.RECEIPTS_STATUS RECEIPTS_STATUS_CODE,
    AERH.HOLDING_REPORT_HEADER_ID,
    0 VENDOR_ID,
    AERH.AMT_DUE_CCARD_COMPANY AMT_DUE_CCARD_COMPANY,
    AERH.AMT_DUE_EMPLOYEE AMT_DUE_EMPLOYEE,  
    DECODE(AERH.expense_current_approver_id,
    -99999, 'AMEMultipleApprovers',
    decode(PER_APPROVER.full_name,
      null,'CurrentApproverName','AMESingleApprover')) CURRENT_APPROVER_SWITCHER,
    to_char(AERH.LAST_UPDATE_DATE, 'DD-MON-RRRR HH:MI:SS'),
    -1 INVOICE_ID
    FROM
           AK_WEB_USER_SEC_ATTR_VALUES A,
           AP_EXPENSE_REPORT_HEADERS AERH,
           PER_PEOPLE_X PER_EMPLOYEE,
           PER_PEOPLE_X PER_APPROVER
    WHERE  AERH.VOUCHNO +0 =0
    AND A.ATTRIBUTE_CODE = 'ICX_HR_PERSON_ID'
    AND AERH.EMPLOYEE_ID = A.NUMBER_VALUE
    AND A.WEB_USER_ID = :3
    AND PER_EMPLOYEE.PERSON_ID = AERH.EMPLOYEE_ID
    AND (AERH.Source <> 'NonValidatedWebExpense'
         OR AERH.Workflow_approved_flag IS NULL)
    AND AERH.expense_current_approver_id = PER_APPROVER.person_id
    AND decode(AERH.total,0,ROUND(NVL(sysdate - AERH.EXPENSE_LAST_STATUS_DATE,sysdate - AERH.LAST_UPDATE_DATE)),30) <= 30
    AND AERH.SOURCE <> 'Both Pay'
    UNION
    SELECT
    AERH.DESCRIPTION PURPOSE,
    AERH.DEFAULT_CURRENCY_CODE CURRENCY_CODE,
    AERH.WEEK_END_DATE REPORT_DATE,
    AERH.REPORT_SUBMITTED_DATE REPORT_SUBMITTED_DATE,
    AERH.INVOICE_NUM REPORT_NUMBER,
    TO_CHAR(nvl(AERH.AMT_DUE_CCARD_COMPANY+AERH.AMT_DUE_EMPLOYEE+nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),AERH.TOTAL),FND_CURRENCY_CACHE.GET_FORMAT_MASK
      (AERH.DEFAULT_CURRENCY_CODE,30)) ||' '|| AERH.DEFAULT_CURRENCY_CODE REPORT_TOTAL_CURRENCY,
    TO_CHAR(nvl(AERH.AMT_DUE_CCARD_COMPANY+AERH.AMT_DUE_EMPLOYEE+nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),AERH.TOTAL),FND_CURRENCY_CACHE.GET_FORMAT_MASK
      (AERH.DEFAULT_CURRENCY_CODE,30)) REPORT_TOTAL,
    PER_EMPLOYEE.PERSON_ID EMPLOYEE_ID,
    AERH.REPORT_HEADER_ID REPORT_HEADER_ID,
    PER_EMPLOYEE.FULL_NAME FULL_NAME,
    NVL(AERH.expense_status_code,
      AP_WEB_OA_ACTIVE_PKG.GetReportStatusCode(AERH.Source, AERH.Workflow_approved_flag,
      AERH.report_header_id,'Y','N')) STATUS_CODE,
    AERH.source SOURCE,
    NVL (PER_APPROVER.full_name, AP_WEB_OA_ACTIVE_PKG.GetCurrentApprover(AERH.Source,
            AERH.Workflow_approved_flag, AERH.report_header_id, AERH.expense_status_code)) CURRENT_APPROVER,
    ROUND(NVL(sysdate - AERH.EXPENSE_LAST_STATUS_DATE,
              sysdate - AERH.LAST_UPDATE_DATE)) DAYS_SINCE_ACTIVITY,
    AERH.RECEIPTS_STATUS RECEIPTS_STATUS_CODE,
    AERH.HOLDING_REPORT_HEADER_ID,
    0 VENDOR_ID,
    AERH.AMT_DUE_CCARD_COMPANY AMT_DUE_CCARD_COMPANY,
    AERH.AMT_DUE_EMPLOYEE AMT_DUE_EMPLOYEE,  
    DECODE(AERH.expense_current_approver_id,
    -99999, 'AMEMultipleApprovers',
    decode(PER_APPROVER.full_name,
      null,'CurrentApproverName','AMESingleApprover')) CURRENT_APPROVER_SWITCHER,
    to_char(AERH.LAST_UPDATE_DATE, 'DD-MON-RRRR HH:MI:SS'),
    -1 INVOICE_ID
    FROM
           AK_WEB_USER_SEC_ATTR_VALUES A,
           AP_EXPENSE_REPORT_HEADERS AERH,
           PER_PEOPLE_X PER_EMPLOYEE,
           PER_PEOPLE_X PER_APPROVER
    WHERE  AERH.VOUCHNO +0=0
    AND A.ATTRIBUTE_CODE = 'ICX_HR_PERSON_ID'
    AND AERH.PAID_ON_BEHALF_EMPLOYEE_ID = A.NUMBER_VALUE
    AND A.WEB_USER_ID = :4
    AND PER_EMPLOYEE.PERSON_ID = PAID_ON_BEHALF_EMPLOYEE_ID
    AND AERH.EMPLOYEE_ID IS NULL
    AND (AERH.Source <> 'NonValidatedWebExpense'
         OR AERH.Workflow_approved_flag IS NULL)
    AND AERH.expense_current_approver_id = PER_APPROVER.person_id
    AND decode(AERH.total,0,ROUND(NVL(sysdate - AERH.EXPENSE_LAST_STATUS_DATE,sysdate - AERH.LAST_UPDATE_DATE)),30) <= 30
    AND AERH.SOURCE <> 'Both Pay'
    UNION ALL
    /* This select is for invoice imported reports by contingent workers */
    SELECT
    AI.DESCRIPTION PURPOSE,
    AI.INVOICE_CURRENCY_CODE CURRENCY_CODE,
    AI.INVOICE_DATE REPORT_DATE,
    AERH.REPORT_SUBMITTED_DATE REPORT_SUBMITTED_DATE,
    AI.INVOICE_NUM REPORT_NUMBER,
    TO_CHAR(decode(nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),
                     0, decode(AI.CANCELLED_DATE,
                                 null, APS.GROSS_AMOUNT,
                                 AERH.TOTAL),
                   nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0)) ,  
            FND_CURRENCY_CACHE.GET_FORMAT_MASK
            (AI.INVOICE_CURRENCY_CODE, 30)) ||' '|| AI.INVOICE_CURRENCY_CODE REPORT_TOTAL_CURRENCY,
    TO_CHAR(decode(nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0),
                     0, decode(AI.CANCELLED_DATE,
                                 null, APS.GROSS_AMOUNT,
                                 AERH.TOTAL),
                   nvl(AI.AMT_DUE_CCARD_COMPANY, AERH.AMT_DUE_CCARD_COMPANY) + nvl(AI.AMT_DUE_EMPLOYEE, AERH.AMT_DUE_EMPLOYEE) + nvl(AERH.MAXIMUM_AMOUNT_TO_APPLY,0)) ,  
            FND_CURRENCY_CACHE.GET_FORMAT_MASK
            (AI.INVOICE_CURRENCY_CODE, 30))
    REPORT_TOTAL,
    P.PERSON_ID EMPLOYEE_ID,
    AERH.REPORT_HEADER_ID REPORT_HEADER_ID,
    P.FULL_NAME FULL_NAME ,
    DECODE(AI.CANCELLED_DATE,null,
                              nvl(aerh.expense_status_code, DECODE(APS.GROSS_AMOUNT ,0,'PAID',
                                    decode(AI.Payment_status_flag,'Y','PAID',
                                                            'N','INVOICED',
                                                            'P','PARPAID',NULL))),
                                            'CANCELLED') STATUS_CODE,
    AERH.source SOURCE,
    NULL CURRENT_APPROVER,
    ROUND(sysdate - AI.LAST_UPDATE_DATE) DAYS_SINCE_ACTIVITY,
    AERH.RECEIPTS_STATUS RECEIPTS_STATUS_CODE,
    AERH.HOLDING_REPORT_HEADER_ID,
    AI.VENDOR_ID VENDOR_ID,
    AERH.AMT_DUE_CCARD_COMPANY AMT_DUE_CCARD_COMPANY,
    AERH.AMT_DUE_EMPLOYEE AMT_DUE_EMPLOYEE,          
    'CurrentApproverName' CURRENT_APPROVER_SWITCHER,
    to_char(AERH.LAST_UPDATE_DATE, 'DD-MON-RRRR HH:MI:SS'),
    AI.INVOICE_ID INVOICE_ID
    FROM
           AK_WEB_USER_SEC_ATTR_VALUES A,
           AP_INVOICES AI,
           AP_EXPENSE_REPORT_HEADERS AERH,
           PER_PEOPLE_X P,
           AP_PAYMENT_SCHEDULES APS
    WHERE  AI.INVOICE_ID= APS.INVOICE_ID
    AND    AI.INVOICE_ID = AERH.VOUCHNO(+)
    AND AI.INVOICE_TYPE_LOOKUP_CODE||'' = 'EXPENSE REPORT'
    AND A.ATTRIBUTE_CODE = 'ICX_HR_PERSON_ID'
    AND AI.PAID_ON_BEHALF_EMPLOYEE_ID = A.NUMBER_VALUE
    AND A.WEB_USER_ID = :5
    AND P.PERSON_ID = AI.PAID_ON_BEHALF_EMPLOYEE_ID
    AND AP_WEB_DB_HR_INT_PKG.IsPersonCwk(AI.PAID_ON_BEHALF_EMPLOYEE_ID)='Y'
    AND DECODE (AI.PAYMENT_STATUS_FLAG,
             'Y', sysdate - AI.LAST_UPDATE_DATE,
            decode(APS.GROSS_AMOUNT , 0 ,sysdate - AI.LAST_UPDATE_DATE,0)
              )  <= 30
    AND (AERH.SOURCE <> 'Both Pay' OR AERH.REPORT_HEADER_ID IS NULL)) QRSLT  WHERE (REPORT_SUBMITTED_DATE is not null)
    at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:603)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1136)
    at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
    at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2360)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1759)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:511)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:432)
    at _OA._jspService(OA.jsp:33)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.sql.SQLException: ORA-01008: not all variables bound
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:583)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
    at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2548)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2933)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:650)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:578)
    at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:631)
    at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:518)
    at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3375)
    at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(OAJboViewObjectImpl.java:828)
    at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4525)
    at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:574)
    at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:544)
    at oracle.jbo.server.ViewRowSetImpl.executeDetailQuery(ViewRowSetImpl.java:619)
    at oracle.jbo.server.ViewObjectImpl.executeDetailQuery(ViewObjectImpl.java:3339)
    at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3326)
    at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:441)
    at oracle.apps.ap.oie.webui.Custom_HomePageCO.processRequest(Custom_HomePageCO.java:26)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:587)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1136)
    at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
    at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2360)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1759)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:511)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:432)
    at _OA._jspService(OA.jsp:33)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)
    java.sql.SQLException: ORA-01008: not all variables bound
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:583)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
    at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2548)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2933)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:650)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:578)
    at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:631)
    at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:518)
    at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3375)
    at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(OAJboViewObjectImpl.java:828)
    at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4525)
    at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:574)
    at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:544)
    at oracle.jbo.server.ViewRowSetImpl.executeDetailQuery(ViewRowSetImpl.java:619)
    at oracle.jbo.server.ViewObjectImpl.executeDetailQuery(ViewObjectImpl.java:3339)
    at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:3326)
    at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQuery(OAViewObjectImpl.java:441)
    at oracle.apps.ap.oie.webui.Custom_HomePageCO.processRequest(Custom_HomePageCO.java:26)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:587)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1136)
    at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
    at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2360)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1759)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:511)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:432)
    at _OA._jspService(OA.jsp:33)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)
    I have took the sql from error message and i tried executing the same in toad... i was able execute it smoothly... i dot know why its working while running the page
    Please help me guys...
    Thanks,
    Pavan

    Hi Shobhi,
    Actually this relates to the Iexpenese Module. The VO is "oracle.apps.ap.oie.server.TrackExpenseReportsVO"(Seeded)
    The user Expense home screen is based on the above VO and this view returning multiple line for the same expense number which should be eliminated.
    so for this i need to filter data by adding where clause dynamically on top of the existing where conditions so that i can eliminate the duplicate row.
    Please suggest me !! how to move on
    Thanks,
    Pavan V
    91-9640871542

  • Java.sql.SQLException: Closed Statement

    I'm having a problem with my Java code trying to access an Oracle 10g database through the JDBC driver using the Oracle XML Publisher.
    We generate a number of different reports, but one report consistently fails with the error: java.sql.SQLException: Closed Statement
    It only happens in the production environment, which has significantly more data than the test and development environments.
    One interesting (!) observation is that the error occurs after 10 minutes to the second (almost). Which leads me to think it is a timeout related problem, but am aware that this could be a red herring.
    And finally, the code is being run within a job sheduled using the Quartz Scheduler v1.6.5.
    Any help would be appreciated.
    Many Thanks
    Lawrence
    Here is the stack trace:
    java.sql.SQLException: Closed Statement: getMetaData
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.OracleResultSetImpl.getMetaData(OracleResultSetImpl.java:128)
    at com.mchange.v2.c3p0.impl.NewProxyResultSet.getMetaData(NewProxyResultSet.java:47)
    at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeData(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeGroup(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeGroup(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeData(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.processData(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.processXML(Unknown Source)
    at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(Unknown Source)
    at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(Unknown Source)
    at oracle.apps.xdo.dataengine.DataProcessor.processData(Unknown Source)
    at com.tmobile.sett.file.invoice.InvoiceFileFactory.generateXML(InvoiceFileFactory.java:157)
    at com.tmobile.sett.file.invoice.InvoiceFileFactory.generateStatements(InvoiceFileFactory.java:365)
    at com.tmobile.sett.file.invoice.InvoiceFileFactory.generateInvoices(InvoiceFileFactory.java:457)
    at com.tmobile.sett.file.invoice.StatementGeneratorJob.execute(StatementGeneratorJob.java:34)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Here is the code:
    private void generateXML(String xmlTemplate, String xmlFilename, Hashtable parameters) {
    DataProcessor dataProcessor = new DataProcessor();
    log.debug("generateXML: xmlTemplate {}, xmlFilename {}", xmlTemplate, xmlFilename);
    try {
    // Set Data Template to be executed
    dataProcessor.setDataTemplate(xmlTemplate);
    // Obtain a new Connection from the Pool
    Connection conn = HibernateUtil.getConnection();
    if (conn == null)
    log.debug("conn is null after getCall");
    if (conn.isClosed())
    log.debug("conn is closed after getCall");
    // Set the Connection for the dataProcessor
    dataProcessor.setConnection(conn);
    if (conn.isClosed())
    log.debug("conn is closed after setConnection");
    dataProcessor.setParameters(parameters);
    if (conn.isClosed())
    log.debug("conn is closed after setParameters");
    // Specify the output directory and file for the data file
    dataProcessor.setOutput(xmlFilename);
    if (conn.isClosed())
    log.debug("conn is closed after setOutput");
    // Process the data template
    dataProcessor.processData();
    if (conn.isClosed())
    log.debug("conn is closed after processData");
    // Return the connection to the pool
    conn.close();
    } catch (Exception e) {
    System.err.println("Error generating XML with the following parameters:");
    System.err.println("xmlTemplate=" + xmlTemplate);
    System.err.println("xmlFilename=" + xmlFilename);
    System.err.println("Here's the stack trace");
    e.printStackTrace();
    System.exit(1);
    }

    I have made some progress in understanding the problem...
    Basically, your comment about threads made me look at the code from a threads perspective. There are only three objects used, log4j, oracleXML Publisher and hibernate. Discounting log4j, the Oracle object is created, opened and closed within the procedure, so I concluded that hibernate was the most likely cause of the problem (i know, theres an element of educated guesswork in this).
    Anyway, I found the hibernate timeouts (all around 300 seconds) and increased them to 3000 seconds... and lo and behold the reports are generated successfully, although some of them take over 20 minutes each.
    So, this is a performance problem with the SQL itself:
    SELECT service
    , reply
    , ROUND(SUM(DECODE(op, 3, 0, count))* :uplift,0) x_events
    , ROUND(SUM(DECODE(op, 3, count, 0))* :uplift,0) y_events
    FROM aggregate
    WHERE ref_time >= :period_start
    AND ref_time < :period_end
    AND feed = 13
    AND agreement = :agreement
    AND line = 1
    GROUP BY service, reply
    ORDER BY 1,2
    The SQL in question is querying data for a specific month from a monthly partitioned table that contains about 11 million records a month. We currently have 99 partitions.
    Executing the sql in Toad / Sql developer / sqlplus takes around 20 seconds...so why 20 minutes?
    Looking in the session browser, I can see that the 20 minute query is looking through all 99 partitions where the 20 second query is only looking at 1 partition for the month in question.
    I'm not sure if this is heading off topic for the forum thread, but the question now is...
    Why is Oracle using a clearly innefficient execution plan when we are using a query with bound variables and how do we get it to use a more efficient execution plan?

  • ERROR java.sql.SQLException: ORA-01843: not a valid month

    This page is working fine for English Language. Once we change preference Lanuage to "French Candian" We are getting this issue.
    This is little urgent on this.
    ERROR
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: select
    ppf.person_id,
    ppf.employee_number,
    god.organization_id,
    ppf.full_name employee_name,
    (select full_name from per_people_x where person_id = paf.supervisor_ID ) manager_name,
    (select full_name from per_people_x where person_id = haou.attribute4 ) hr_name,
    --hr_general.decode_person_name(haou.attribute4 ) hr_name,
    haou.name organization_name,
    GEM.termination_date actual_termination_date,
    (select meaning from hr_lookups where lookup_type = 'LEAV_REAS' and lookup_code = GEM.Leaving_reason and enabled_flag = 'Y') leaving_reason,
    god.sub_business sub_business,
    god.business_segment business_segment,
    god.industry_focus_group industry_focus_group,
    pgd.segment2 corporate_Band,
    tl.territory_short_name country
    from per_people_f ppf,
    per_assignments_f paf,
    hr_all_organization_units haou,
    per_grades pg,
    per_grade_definitions pgd,
    per_addresses pa,
    fnd_territories_tl tl,
    XXsm_org_dtl god,
    XX_EXIT_TRANSACTION GET,
    XX_EXIT_MANAGER GEM
    where 1=1
    and paf.person_id=:1
    and paf.primary_flag='Y'
    and ppf.person_id = paf.person_id
    and paf.organization_id=haou.organization_id
    and paf.organization_id = god.organization_id
    and trunc(sysdate) between trunc(paf.effective_start_date) and trunc(paf.effective_end_date)
    and trunc(sysdate) between trunc(ppf.effective_start_date) and trunc(ppf.effective_end_date)
    and ppf.person_id=GET.employee_id(+)
    and GET.Transaction_id = GEM.transaction_id
    and paf.grade_id=pg.grade_id(+)
    and pg.grade_definition_id=pgd.grade_definition_id(+)
    and ppf.person_id=pa.person_id(+)
    and pa.primary_flag(+)='Y'
    and pa.country=tl.territory_code(+)
    AND tl.language = USERENV('LANG')
    AND trunc(sysdate) between trunc(pa.Date_from) and trunc(nvl(pa.Date_to, TO_DATE ('31-DEC-4712', 'DD-MON-YYYY')))
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:865)
         at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:988)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:211)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:750)
         at ge.oracle.apps.per.selfservice.eexit.employee.webui.GEExitEmployeeCO.processRequest(GEExitEmployeeCO.java:112)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:587)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1136)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2348)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1747)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:511)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:432)
         at oa_html._OA._jspService(_OA.java:84)
         at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
         at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
         at oracle.jsp.JspServlet.service(JspServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
         at org.apache.jserv.JServConnection.run(JServConnection.java:294)
         at java.lang.Thread.run(Thread.java:619)
    ## Detail 0 ##
    java.sql.SQLException: ORA-01843: not a valid month
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:590)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1973)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1119)
         at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2566)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2963)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:584)
         at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:631)
         at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:518)
         at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:3375)
         at oracle.jbo.server.OAJboViewObjectImpl.executeQueryForCollection(OAJboViewObjectImpl.java:828)
         at oracle.apps.fnd.framework.server.OAViewObjectImpl.executeQueryForCollection(OAViewObjectImpl.java:4507)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:574)
         at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:544)
         at oracle.jbo.server.ViewRowSetImpl.executeDetailQuery(ViewRowSetImpl.java:619)
         at oracle.jbo.server.ViewObjectImpl.executeDetailQuery(ViewObjectImpl.java:3339)
         at oracle.jbo.server.ViewObjectImpl

    Are you hard coding anything in code or VO ?
    AND trunc(sysdate) between trunc(pa.Date_from) and trunc(nvl(pa.Date_to, TO_DATE ('31-DEC-4712', 'DD-MON-YYYY')))Try some modification in the above nvl code and test.
    And refer:
    http://apps2fusion.com/apps/apps/430-string-to-date
    -Anand

  • JBO-27122: SQL error & java.sql.SQLException: ORA-01843: not a valid month

    Hi,
    We developed OA page for Employee's Payslip and it is working fine for all the employees but it is not working for only one employee...Getting the error as
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement
    preparation
    ## Detail 0 ##
    java.sql.SQLException: ORA-01843: not a valid month
    Real Scenario is:
    The user "DANISH.LOTFY" is login into application and when he click on Payslip to the month then he is always getting the above error.
    For testing purpose we have removed his employee assignment from user screen(fnd_user) and assigned some other employee name (say MOHAMED.ELBAHY)... After this when DANISH.LOTFY logins into the application and payslip page is working fine...(He can able to see MOHAMED.ELBAHY payslip.....
    Realy we don't know this strange behaviour of OA ...
    ------ Code with Error details------------------
    Statement:
    SELECT * FROM (SELECT DISTINCT ppa.DATE_EARNED, TO_CHAR(ppa.DATE_EARNED,'MON-YYYY') DISPLAY
    , TO_CHAR(ppa.DATE_EARNED,'MM YYYY') PARAM
    FROM
    pay_payroll_actions ppa
    ,pay_assignment_actions pac
    ,PER_ALL_ASSIGNMENTS_F PASS
    ,FND_USER FU
    ,per_time_periods PTP
    WHERE ppa.payroll_id = 61
    AND ppa.payroll_action_id = pac.payroll_action_id
    AND PAC.ASSIGNMENT_ID = PASS.ASSIGNMENT_ID
    AND PASS.PERSON_ID = FU.EMPLOYEE_ID
    AND FU.USER_ID =Fnd_Profile.VALUE('USER_ID')
    AND TRIM(TO_CHAR(ppa.DATE_EARNED,'MON-YYYY')) IS NOT NULL
    ---Added by Sudipta C on 28th Janaury 2008
    AND TRIM(TO_CHAR(ppa.DATE_EARNED,'MON-YYYY')) <> TRIM(TO_CHAR(SYSDATE,'MON-YYYY'))
    AND ppa.DATE_EARNED=(SELECT MAX(DATE_EARNED) FROM pay_payroll_actions WHERE time_period_id=ppa.time_period_id)
    AND ppa.DATE_EARNED >='30-NOV-2007'
    UNION ALL
    --Query to Display only the Current Month if the Concurrent Request Ran
    SELECT DISTINCT ppa.DATE_EARNED, TO_CHAR(ppa.DATE_EARNED,'MON-YYYY') DISPLAY
    , TO_CHAR(ppa.DATE_EARNED,'MM YYYY') PARAM
    FROM
    pay_payroll_actions ppa
    ,pay_assignment_actions pac
    ,PER_ALL_ASSIGNMENTS_F PASS
    ,FND_USER FU
    ,per_time_periods PTP
    WHERE ppa.payroll_id = 61
    AND ppa.payroll_action_id = pac.payroll_action_id
    AND PAC.ASSIGNMENT_ID = PASS.ASSIGNMENT_ID
    AND PASS.PERSON_ID = FU.EMPLOYEE_ID
    AND FU.USER_ID = Fnd_Profile.VALUE('USER_ID')
    AND TRIM(TO_CHAR(ppa.DATE_EARNED,'MON-YYYY')) IS NOT NULL
    AND TRIM(TO_CHAR(ppa.DATE_EARNED,'MON-YYYY')) = TRIM(TO_CHAR(SYSDATE,'MON-YYYY'))
    AND ppa.DATE_EARNED=(SELECT MAX(DATE_EARNED) FROM pay_payroll_actions WHERE time_period_id=ppa.time_period_id)
    AND ppa.DATE_EARNED >='30-NOV-2007'
    --Check the Concurrent Program Ran or not to Display the SYS Month Payroll Period ID
    AND EXISTS
    (SELECT TRIM(TO_CHAR(REQUEST_DATE,'MON-YYYY')) FROM fnd_conc_req_summary_v fcrs
    WHERE program_short_name = 'PROC_EXP1_TESTING'
    AND PHASE_CODE='C' AND STATUS_CODE='C'
    AND TO_CHAR(REQUEST_DATE,'MON-YYYY')=TO_CHAR(SYSDATE,'MON-YYYY')
    AND REQUEST_DATE=(SELECT MAX(REQUEST_DATE) FROM fnd_conc_req_summary_v
    WHERE CONCURRENT_PROGRAM_ID=fcrs.CONCURRENT_PROGRAM_ID))
    ORDER BY 1 DESC) QRSLT WHERE (( UPPER(DISPLAY) like :1 AND (DISPLAY like :2 OR DISPLAY like :3 OR DISPLAY like :4 OR DISPLAY like :5)))
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormData(OAPageBean.java:2555)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1677)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
         at oa_html._OA._jspService(_OA.java:84)
         at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
         at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
         at oracle.jsp.JspServlet.service(JspServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
         at org.apache.jserv.JServConnection.run(JServConnection.java:294)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.sql.SQLException: ORA-01843: not a valid month
    Could any please suggest/provide your valuable inputs to resolve this issue(It is in production , so please treat it as very urgent).
    Thanks & Regards,
    J.Prakash

    Hi,
    This is really a strange behaviour as you are saying that it is happening only for one user so please check his user preferences.
    Regards,
    Reetesh Sharma

  • Java.sql.SQLException: ORA-00979: not a GROUP BY expression in a query

    I am getting java.sql.SQLException: ORA-00979: not a GROUP BY expression
    when I run
    select count(*) from ( select count(rec_no) AS REC_NO_NUM,created_by AS
    CREATED_BY,to_char(created_dt,'Mon YYYY') AS CREATED_DT,to_date(to_char(created_dt,'Mon
    YYYY'),'Mon YYYY') AS CREATED_DATE from tbl_ndr_renal_reg where reg_no is not null and delete_ind
    = 'N' group by to_char(created_dt,'Mon YYYY'),created_by )
    But when I run the subquery below it doesn't give any error and returns rows.
    select count(rec_no) AS REC_NO_NUM,created_by AS CREATED_BY,to_char(created_dt,'Mon YYYY') AS
    CREATED_DT, to_date(to_char(created_dt,'Mon YYYY'),'Mon YYYY') AS CREATED_DATE from
    tbl_ndr_renal_reg where reg_no is not null and delete_ind = 'N' group by to_char(created_dt,'Mon
    YYYY'),created_by
    Thanks

    I tried that too still getting the same error
    SQL> select count(*) from (
    2 select count(rec_no) AS REC_NO_NUM,
    3 created_by AS CREATED_BY,
    4 to_char(created_dt,'Mon YYYY') AS CREATED_DT,
    5 to_date(to_char(created_dt,'Mon YYYY'),'Mon YYYY') AS CREATED_DATE
    6 from tbl_ndr_renal_reg
    7 where reg_no is not null
    8 and delete_ind = 'N'
    9 group by to_char(created_dt,'Mon YYYY'),created_by)
    10 ;
    to_date(to_char(created_dt,'Mon YYYY'),'Mon YYYY') AS CREATED_DATE
    ERROR at line 5:
    ORA-00979: not a GROUP BY expression

  • Java.sql.SQLException: Byte array not long enough

    using thin jdbc returned this exception seems to be connected to the length of the statment:
    ////////create a prepared statement////////
    preUpdateStatement = dbConnection.prepareStatement(updateStatement.toString());
    // build data output stream on byte array output stream
    ByteArrayOutputStream byte_os = new ByteArrayOutputStream();
    DataOutputStream data_os = new DataOutputStream(byte_os);
    // write chars to data output stream
    data_os.writeChars(((Element)m_values_vector.elementAt(i)).m_value);
    // create input stream and pass it to prepared statement
    ByteArrayInputStream byte_is = new ByteArrayInputStream(byte_os.toByteArray());
    preStatement.setUnicodeStream(i+1, byte_is, byte_os.toByteArray().length);
    // execute
    preUpdateStatement.executeUpdate();
    preUpdateStatement.close();
    null

    stack is:
    java.sql.SQLException: Io exception: Char array not long enough: javaCharsToUtf8Bytes
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at java.sql.SQLException.<init>(Compiled Code)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(Compiled Code)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(Compiled Code)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecute(Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Compiled Code)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(Compiled Code)

  • Java.sql.SQLException: ORA-01008: not all variables bound

    Hi
    I have a custom search results page, in the search region user would select a supplier and then searches for the invoices of that supplier by entering the partial value for invoice field, but when i click on invoice LOV i am getting below error.
    i am not sure why the system is adding bind variables :3 to :7, please let me know any pointers to resolve the error.
    Note: dynamically i am setting the bind variables :1 and :2 but its failing because of the other system added bind variables.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (select invoice_number,supplier_number,supplier_site,invoice_amount,null invoice_date,null Source,'Invoices' record_location
    from audit_invoices
    where invoice_number like :1
    and supplier_number = :2
    union all
    select invoice_num,vendor_num,vendor_site_code,invoice_amount,invoice_date,null Source,'InvoiceIT' record_location
    from xxit3_invoices
    where invoice_num like :1
    and vendor_num = :2
    union all
    select ai.invoice_num,pv.segment1 sup_number,pvs.vendor_site_code,ai.invoice_amount,ai.invoice_date,ai.source,'Payables' record_location
    from ap_invoices_all ai,po_vendor_sites_all pvs,po_vendors pv
    where invoice_num like :1
    and ai.vendor_id = pv.vendor_id
    and ai.vendor_site_id = pvs.vendor_site_id
    and pv.segment1 = :2) QRSLT WHERE (( UPPER(INVOICE_NUMBER) like :3 AND (INVOICE_NUMBER like :4 OR INVOICE_NUMBER like :5 OR INVOICE_NUMBER like :6 OR INVOICE_NUMBER like :7)))
    at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormData(OAPageBean.java:2555)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1677)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
         at OA.jspService(OA.jsp:33)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    Rgds,
    -kamal

    // Repeated Due to Network Issue.
    Kamal,
    Replace your VO with the following
    * select invoice_number,supplier_number,supplier_site,invoice_amount,null invoice_date,null Source,'Invoices' record_location
    from audit_invoices
    where invoice_number like :1
    and supplier_number = :2
    union all
    select invoice_num,vendor_num,vendor_site_code,invoice_amount,invoice_date,null Source,'InvoiceIT' record_location
    from xxit3_invoices
    where invoice_num like :3
    and vendor_num = :4
    union all
    select ai.invoice_num,pv.segment1 sup_number,pvs.vendor_site_code,ai.invoice_amount,ai.invoice_date,ai.source,'Payables' record_location
    from ap_invoices_all ai,po_vendor_sites_all pvs,po_vendors pv
    where invoice_num like :5
    and ai.vendor_id = pv.vendor_id
    and ai.vendor_site_id = pvs.vendor_site_id
    and pv.segment1 = :6 *
    Even though your Bind variable are same but in VO you have to pass the parameter for all the above like above.
    And set the whereclause based on the value required in parameter and the others as null.
    Hope you got it.
    Regards,
    Gyan

  • Java.sql.SQLException: ORA-00979: not a GROUP BY expression

    Hi all,
    I have the following sql query;
    SELECT
    act.BAM_NAME AS ACTIVITY_NAME,
    svc.BAM_SERVICE_NAME AS SERVICE_NAME,
    opt.BAM_OP_NAME AS OPERATION_NAME,
    COUNT(msg.BAM_OP_ID) AS MESSAGE_COUNT
    FROM
    BAM_ACTIVITY act, BAM_MESSAGE msg, BAM_OPERATION opt, BAM_SERVICE svc
    WHERE
    act.BAM_ID = msg.BAM_ACTIVITY_ID
    AND
    msg.BAM_OP_ID = opt.BAM_ID
    AND
    opt.BAM_SERVICE_ID = svc.BAM_ID
    AND
    act.BAM_ID = ?
    GROUP BY msg.BAM_OP_ID ORDER BY svc.BAM_SERVICE_NAME
    When i execute following expression @ sql/plus i face above error...
    Does any body correct my sql query?
    Thanks.
    -viji
    Edited by: user8977935 on Jan 22, 2010 4:38 AM

    Hi,
    Should not it be
    SELECT
    act.BAM_NAME AS ACTIVITY_NAME,
    svc.BAM_SERVICE_NAME AS SERVICE_NAME,
    opt.BAM_OP_NAME AS OPERATION_NAME,
    COUNT(msg.BAM_OP_ID) AS MESSAGE_COUNT
    FROM
    BAM_ACTIVITY act, BAM_MESSAGE msg, BAM_OPERATION opt, BAM_SERVICE svc
    WHERE
    act.BAM_ID = msg.BAM_ACTIVITY_ID
    AND
    msg.BAM_OP_ID = opt.BAM_ID
    AND
    opt.BAM_SERVICE_ID = svc.BAM_ID
    AND
    act.BAM_ID = ?
    GROUP BY act.BAM_NAME ,
    svc.BAM_SERVICE_NAME,
    opt.BAM_OP_NAME
    ORDER BY svc.BAM_SERVICE_NAMERegards
    Anurag

  • Java.sql.SQLException: statement handle not executed

    hello,
    i am calling a stored procedure and its returns a REF CURSOR and i am getting intermittent exceptions below,
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
    xxxx_pkg(?,?)}]; SQL state [99999]; error code [17144]; statement handle not executed; nested exception is java.sql.SQLException: statement handle not executed
    and
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
    xxxx_pkg(?,?,?)}]; SQL state [99999]; error code [17009]; Closed Statement; nested exception is java.sql.SQLException: Closed Statement
    any clue what could be the issue,
    Regards
    GG

    its pretty simple have a java class calling hibernateTemplate's findByNamedQueryAndNamedParam method by passing the procedure name and binding parameters/values, and here is the stack
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
    xxx_pkg(?,?)}]; SQL state [99999]; error code [17144]; statement handle not executed; nested exception is java.sql.SQLException: statement handle not executed
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
    at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
    at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
    at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1006)
    Caused by: java.sql.SQLException: statement handle not executed
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
    at oracle.jdbc.driver.T4CStatement.doDescribe(T4CStatement.java:701)
    at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3355)
    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:2009)
    at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:494)
    at org.hibernate.type.StringType.get(StringType.java:18)
    at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
    at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
    at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
    at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2091)
    at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
    at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
    at org.hibernate.loader.Loader.getRow(Loader.java:1206)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
    at org.hibernate.loader.Loader.doQuery(Loader.java:701)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
    at org.hibernate.loader.Loader.doList(Loader.java:2217)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2108)
    at org.hibernate.loader.Loader.list(Loader.java:2103)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
    at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1696)
    at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
    at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1015)
    at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1)
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)

  • JDBC sender adapter, ...Processing parameters, Update SQL statement

    in JDBC sender adapter, ...Processing parameters, there is an Update SQL statement field, can u tell me ...why this is required,,,,,and in one of the example scenario...it was given as <TEST>..

    Sudheep,
    In the sender JDBC adapter you have the select query to select data from the database.
    Let us summer 2 cases,
    1. You have <test> in  the UPDATE . In this case, during every polling interval the JDBC adapter will end up selecting the same data from the Database. This would not be needed in most f the cases. Why would you want to select the same data over an over again?
    2. If you have an update Statement in the Update field you can make sure that the data selected in the selected statement is updated so that the same rows are not selected again.
    Take a look at this blog,
    /people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
    Regards
    Bhavesh

  • JDBC Sender Adapter - SQL-Statement

    Hi,
    I'm using the JDBC-Sender-Adapter and need to use a SQL-Statement like this:
    SELECT * FROM myTable WHERE myDate = <current_date>
    Is such a dynamic-sql possible, or can I only use static sql-statements. And if yes how can I solve this problem.
    many thx

    Hi Werner,
    inside the <b>Query SQL Statement</b> you can use <b>SQL EXECUTE</b>
    which can execute a stored procedure
    in which you can do
    SELECT * FROM myTable WHERE myDate = <current_date>
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

  • Caused by java.sql.SQLException: No JDBC connection can be made

    Hi,
    I am using OSB11g (with soa db adapter ) to select data from DB2 Database. I am trying to just fetch like 100 records(very less).
    I get this Exception once in 4-5 tests I do . I am not sure if I have to modify any configurations, in case its timing out .
    I see something like *"To classify it as non-retriable instead add property nonRetriableErrorCodes with value "0" to your deployment descriptor (i.e. weblogic-ra.xml)."*
    I don't see the tables when I try to perform SELECT operation in db adapter. In JDev worksheet I can see the tables and records when queried.
    BEA-380002: Invoke JCA outbound service failed with connection error, exception: com.bea.wli.sb.transports.jca.JCATransportException: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/SampleOSBEMEA/WSDL/DBOut [ DBOut_ptt::DBOut(DBOutInput_msg,DBOutOutputCollection) ] - WSIF JCA Execute of operation 'DBOut' failed due to: Pure SQL Exception.
    Pure SQL Execute of SELECT Column1, Column2 ..........Column216 from Table.
    Caused by java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Rolledback.
    ; nested exception is:
    BINDING.JCA-11633
    Pure SQL Exception.
    Caused by java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Rolledback.
    The Pure SQL option is for border use cases only and provides simple yet minimal functionality. Possibly try the "Perform an operation on a table" option instead. This exception is considered retriable, likely due to a communication failure. Because the global transaction is rolling back the invoke must be retried in a new transaction, restarting from the place of the last transaction commit. To classify it as non-retriable instead add property nonRetriableErrorCodes with value "0" to your deployment descriptor (i.e. weblogic-ra.xml).
    The Pure SQL option is for border use cases only and provides simple yet minimal functionality. Possibly try the "Perform an operation on a table" option instead. This exception is considered retriable, likely due to a communication failure. Because the global transaction is rolling back the invoke must be retried in a new transaction, restarting from the place of the last transaction commit. To classify it as non-retriable instead add property nonRetriableErrorCodes with value "0" to your deployment descriptor (i.e. weblogic-ra.xml).
    at oracle.tip.adapter.db.exceptions.DBResourceException.createXARetriableException(DBResourceException.java:670)
    at oracle.tip.adapter.db.exceptions.DBResourceException.createEISException(DBResourceException.java:642)
    at oracle.tip.adapter.db.exceptions.DBResourceException.pureSQLException(DBResourceException.java:711)
    at oracle.tip.adapter.db.puresql.PureSQLInteraction.executePureSQL(PureSQLInteraction.java:625)
    at oracle.tip.adapter.db.DBInteraction.executePureSQL(DBInteraction.java:1146)
    at oracle.tip.adapter.db.DBInteraction.execute(DBInteraction.java:254)
    at oracle.tip.adapter.sa.impl.fw.wsif.jca.WSIFOperation_JCA.performOperation(WSIFOperation_JCA.java:529)
    ... 63 more
    Caused by: java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Rolledback
    at weblogic.jdbc.jts.Driver.newConnection(Driver.java:949)
    at weblogic.jdbc.jts.Driver.createLocalConnection(Driver.java:327)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:173)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:364)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:126)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:327)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:291)
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.reconnect(DatasourceAccessor.java:558)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.reconnect(DatabaseAccessor.java:1433)
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.incrementCallCount(DatasourceAccessor.java:302)
    at oracle.tip.adapter.db.DBConnection.getTopLinkSQLConnection(DBConnection.java:333)
    at oracle.tip.adapter.db.transaction.DBTransaction.beginInternal(DBTransaction.java:126)
    at oracle.tip.adapter.db.puresql.PureSQLInteraction.executePureSQL(PureSQLInteraction.java:171)
    ... 66 more
    Should I increase the time interval in weblogicra.xml (DEV/wls1034/middleware/Oracle_OSB1/lib/external/adapters/META-INF)
    for <wls:connection-reserve-timeout-seconds>5</wls:connection-reserve-timeout-seconds>
    Thanks
    Edited by: soauser on Jul 6, 2011 10:02 AM

    Looks like either database is too slow or data-source is not functioning properly. Make sure to test data source and see if it is in running state and it has sufficient number of connections (you may increase max connections value). Actually transaction is getting rolled back because it could not get connection in specified time period (may be JTA/statement timeout).
    Cross post in Weblogic JDBC forum as well for expert's advice -
    WebLogic Server - JDBC
    You may consider raising a case with support as well.
    Regards,
    Anuj

Maybe you are looking for