Using SQL Statements in Error Exceptions

Is there any way to include SQL statements within my catch routines (i.e.
catch (java.io.IOException ex) {
System.out.println("An error occurred whilst writing to the message buffer: " + ex);
#sql { INSERT INTO DEBUG_TBL(CURRENT_DT,PROGRAM_ID,DEBUG__MESG) VALUES (SYSDATE,'TEST',:ex) };
#sql { COMMIT };
As it stands I get the following error upon compile:
Error: Unsupported Java type for host item (at position#1): java.io.IOException
Any help would be greatly appreciated.
Thx,
Boybles
null

You can use SQL statements in your catch blocks, just not SQL statements that use Java types which do not map to SQL.
You cannot pass exceptions from Java to SQL. You can catch a SQL exceptions as a SQLException in Java. However, any exception that is thrown by a Java Stored Procedure (including SQLException) is rendered as an "Uncaught Java exception" in SQL.
When you receive a SQLException there is information about the originator, the error message, etc. in the exception object. See:
http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83723/keyprog5.htm#1004462
While you cannot insert a Java exception per se into a table, you can extract the message string(s)/code and insert that in a table.

Similar Messages

  • Defaulting DFF Segment Value using sql statement in SSHR gives error when using parameter

    Dear All,
    i am having an issue that i am making one segment in DFF (SEGMENT3) being defaulted by using sql statement
    Select MAX(SEGMENT7) FROM PER_ANALYSIS_CRITERIA cri, PER_PERSON_ANALYSES ana where cri.Analysis_Criteria_id = ana.ANALYSIS_CRITERIA_ID and ana.PERSON_ID = :ANALYSES.PERSON_ID
    The Above Select Statement is working fine on the PUI form and getting the Default value correctly but when opening the SSHR page that contain this DFF, it  gives me the below error.
    "No field listener is registered to resolve field ANALYSES.PERSON_ID referenced by the flexfield with application short name PER and name PEA. Please contact your system administrator. "
    Any Help Please???

    Please see the following docs.
    Cannot Add Salary:No Field Listener is Registered to Resolve Field Review.assignment_id (Doc ID 558295.1)
    No Field Listener Is Registered To Resolve Field Assgt.Effective_start_date (Doc ID 889794.1)
    List of Current Enhancement Requests (ER) for Oracle EBS Self Service Human Resource (SSHR) (Doc ID 1381936.1)
    No field listener is registered to resolve field xxx.xxx referenced by the flexfield with application short name ASO... (Doc ID 1359270.1)
    Customer Form, Address Error: No field listener is registered to resolve field GLOB.FLEX_COUNTRY_CODE referenced by the flexfield with application short name AR (Doc ID 1276934.1)
    DFF issue : No Field Listener Is Registered To Resolve Field XXX Referenced By The Flexfield (Doc ID 555589.1)
    Thanks,
    Hussein

  • SQLException: Closed Connection, SQL state [null]; error code [17002]

    Hello All,
    I am supporting a Java 5 project on Tomcat. We've used Spring and Stored Procedure in the project.
    Recently we deployed our application in a GoLive environment and have started seeing Timeout errors in log files. After around two days we also have to restart Tomcat as users are no more able to login to access the application.
    Same application runs fine without any timeout issues on another environment.
    The only difference between two environments is that the Go-Live env has a firewall between Tomcat and Database and the other environment hosts both Tomcat and Database on same machine (i.e. no firewall).
    For GoLive env the only port open on firewall for JDBC connection is 1521 and is used in the connection string url for obtaining the connections.
    When there is a Timeout error, the N/w admin guy observed that the JDBC connection was not attempted on 1521 port, but on some random port which is not open on firewall, due to which the Database server logs also do not show entry for this connection attempt as it gets blocked by the firewall.
    I am not sure why a randam port should be used to connect when a specific port is mentioned in the connection url? Also what can be making this port switching?
    Application uses Apache DBCP with Spring to obtain connections.
    Has anyone experienced similar errors?
    Any suggestions/help on this issue is greatly appreciated!
    Many Thanks,
    CD
    ===============================
    Error Log Extract:
    Error while extracting database product name - falling back to empty error codes
    org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: Closed Connection
    java.sql.SQLException: Closed Connection
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
    at oracle.jdbc.driver.PhysicalConnection.getMetaData(PhysicalConnection.java:1605)
    at org.apache.commons.dbcp.DelegatingConnection.getMetaData(DelegatingConnection.java:247)
    at org.apache.commons.dbcp.DelegatingConnection.getMetaData(DelegatingConnection.java:247)
    at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getMetaData(PoolingDataSource.java:231)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:172)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:207)
    at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes(SQLErrorCodesFactory.java:187)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTranslator.java:126)
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.<init>(SQLErrorCodeSQLExceptionTranslator.java:92)
    at org.springframework.jdbc.support.JdbcAccessor.getExceptionTranslator(JdbcAccessor.java:96)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:294)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:348)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:352)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:356)
    at com.o2.morse.dao.impl.sql.UserDaoImpl.batchLoad(UserDaoImpl.java:371)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
    at $Proxy3.batchLoad(Unknown Source)
    at com.o2.morse.domain.User.doHousekeeping(User.java:667)
    at com.o2.morse.domain.User$$FastClassByCGLIB$$372ff70b.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.domain.User$$EnhancerByCGLIB$$d5ac966a.doHousekeeping(<generated>)
    at com.o2.morse.scheduler.EndOfDay.run(EndOfDay.java:63)
    at com.o2.morse.scheduler.EndOfDay$$FastClassByCGLIB$$3b2d4927.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.scheduler.EndOfDay$$EnhancerByCGLIB$$488a9f86.run(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:248)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:165)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:90)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Could not close JDBC Connection
    java.sql.SQLException: Already closed.
    at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:77)
    at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:180)
    at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:286)
    at org.springframework.jdbc.datasource.DataSourceUtils.releaseConnection(DataSourceUtils.java:247)
    at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCleanupAfterCompletion(DataSourceTransactionManager.java:297)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:754)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:615)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:560)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.doCloseTransactionAfterThrowing(TransactionAspectSupport.java:284)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:100)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
    at $Proxy3.batchLoad(Unknown Source)
    at com.o2.morse.domain.User.doHousekeeping(User.java:667)
    at com.o2.morse.domain.User$$FastClassByCGLIB$$372ff70b.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.domain.User$$EnhancerByCGLIB$$d5ac966a.doHousekeeping(<generated>)
    at com.o2.morse.scheduler.EndOfDay.run(EndOfDay.java:63)
    at com.o2.morse.scheduler.EndOfDay$$FastClassByCGLIB$$3b2d4927.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.scheduler.EndOfDay$$EnhancerByCGLIB$$488a9f86.run(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:248)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:165)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:90)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Application exception overridden by rollback exception
    org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [SELECT ID_USER_DETAILS, USERNAME, CREATED_ON, LAST_LOGIN FROM USER_DETAILS  WHERE STATUS = 157 AND SUPERUSER <> 'Y']; SQL state [null]; error code [17002] ; Io exception: Connection timed out; nested exception is java.sql.SQLException: Io exception: Connection timed out
    java.sql.SQLException: Io exception: Connection timed out
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
    at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:820)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
    at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:845)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)
    at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1313)
    at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
    at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
    at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:333)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:282)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:348)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:352)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:356)
    at com.o2.morse.dao.impl.sql.UserDaoImpl.batchLoad(UserDaoImpl.java:371)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
    at $Proxy3.batchLoad(Unknown Source)
    at com.o2.morse.domain.User.doHousekeeping(User.java:667)
    at com.o2.morse.domain.User$$FastClassByCGLIB$$372ff70b.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.domain.User$$EnhancerByCGLIB$$d5ac966a.doHousekeeping(<generated>)
    at com.o2.morse.scheduler.EndOfDay.run(EndOfDay.java:63)
    at com.o2.morse.scheduler.EndOfDay$$FastClassByCGLIB$$3b2d4927.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:705)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
    at com.o2.morse.scheduler.EndOfDay$$EnhancerByCGLIB$$488a9f86.run(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:248)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:165)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:90)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Batch Job Failed: org.springframework.transaction.TransactionSystemException: Could not roll back JDBC transaction; nested exception is java.sql.SQLException: Closed Connection

    I am using latest Jrockit 16)5, ojdbc6_g.jar,spring.jar Weblogic 10.3 and Oracle 10G 10.2.4 .. whatever but always get "Closed Connection"
    java.lang.Throwable: Closed Connection
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
    at oracle.jdbc.driver.PhysicalConnection.createStatement(PhysicalConnection.java:750)
    at oracle.jdbc.OracleConnectionWrapper.createStatement(OracleConnectionWrapper.java:183)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7053)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

  • Assigning values to 2 fields using sql statement

    db11g , apex 4.0 and firefox 24 ,
    hi all ,
    i am trying to follow this tutorial to assign values to 2 items on a page using sql statement ,
    and i am using the same sql statement the tutorial uses
    select d.loc location, count(e.empno) num_employees from dept d, emp e where d.deptno = e.deptno(+) and d.deptno = :P3_DEPTNO group by d.loc -- btw , what does the "+" sign mean?
    after the e.deptno in the where condition .
    but i am facing this error
    1 error has occurred
    Wrong number of columns selected in the SQL query. See Help of attribute for details.
    and it does not work with two columns in the select statement under any conditions , i tried to remove the group function and the group clause ,
    it does not work unless i use only one column in the select statement ??
    thanks

    Pars
    And how exactly is this rewrite of the sql statement resolving the OP's issue.
    You are still using more than 1 column which will still result in the error message:
    Wrong number of columns selected in the SQL query.
    As mentioned in my earlier post APEX 4.0 (the version the OP is using) does not handle a sql statement with multiple columns for the dynamic action Set Value.
    Which means the fastest  and simplest solution is splitting up the dynamic action in multiple Set Value actions.
    Using this plugin or upgrade to a newer apex version would also be a possibility.
    Nicolette

  • Issue Related to limit the result in prompt by using SQL statement.

    Hello Gurus,
    I am facing one issue rite now with our testing environment in some Dashboard Prompt. it seems like they are working fine in our Development environment.
    basically I am using SQL statement in prompt to limit the values for current + last 2 years in drop down.
    Here is the SQL that I am using SELECT Time."Fiscal Year" FROM "Financials - AP Overview" where Time."Fiscal Year" <= VALUEOF(NQ_SESSION.CURRENT_FSCL_YEAR) AND Time."Fiscal Year" >= (VALUEOF(NQ_SESSION.CURRENT_FSCL_YEAR)-2) ORDER BY TIme."Fiscal Year" desc
    Now it's working fine in our Dev but geeting failed in Test environment.
    it's giving below error.
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred.
    [nQSError: 43113] Message returned from OBIS.
    [nQSError: 43119] Query Failed:
    [nQSError: 22023] An arithmetic operation is being carried out on a non-numeric type. (HY000)
    SQL Issued: SELECT Time."Fiscal Year" FROM "Financials - AP Overview" where Time."Fiscal Year" <= VALUEOF(NQ_SESSION.CURRENT_FSCL_YEAR) AND Time."Fiscal Year" >= (VALUEOF(NQ_SESSION.CURRENT_FSCL_YEAR)-2) ORDER BY TIme."Fiscal Year" desc
    Please let me know your output.
    Thanking You..

    Couple of possibilities..
    1. environments may be at different patch sets, may be causing the issue.
    2. data in working environment is fine but in other environment.
    to further debug use the same logical sql in both environments and compare the results..
    hope this helps..

  • Update record using SQL statement

    I have VB6.0 and Oracle 10G Express Edition in Windows 2000 Server. My procedure in VB 6.0 can't update record in the table using SQL statement, and the Error Message is " Missing SET keyword ".
    The SQL statement in VB6.0 look like this :
    General Declaration
    Dim conn as New ADODB.Connection
    Dim rs as New ADODB.Recordset
    Private Sub Command1_Click()
    dim sql as string
    sql = " UPDATE my_table " & _
    " SET Name = ' " & Text3.Text & " ' " & _
    " AND Unit = ' " & Text2.Text & " ' " & _
    " WHERE ID = ' " & Text1.Text & " ' "
    conn.Execute (sql)
    Private Sub Form Load()
    Set conn = New ADODB.Connection
    conn.Open "Provider=MSDASQL;" & "Data Source=my_table;"& "User ID =marketing;" & "Password=pass123;"
    I'm sorry about my language.
    What's wrong in my SQL statement, I need help ........ asap
    Best Regards,
    /Harso Adjie

    The syntax should be
    UPDATE TABLE XX
    SET FLD_1 = 'xxxx',
    FLD_2 = 'YYYY'
    WHERE ...
    'AND' is improperly placed in the SET.

  • Question about reconciliation, by using SQL statement

    Dear All,
    Does any know how to print out A/R invoice which are internally recon, by using SQL statement. It seems like GL report.
    For example:
    InvoiceNo                     Recon
    INV222000001              Yes
    INV222000002              No
    INV222000003              No
    From Samson

    Dear Samson,
    Please try this one:
    SELECT T0.DocNum AS 'Invoice No.',  CASE WHEN SUM(T1.IntrnMatch)=0 THEN 'NO' ELSE 'YES' END AS Recon
    FROM DBO.OINV T0
    INNER JOIN DBO.JDT1 T1 ON T1.TransId = T0.TransId
    WHERE T0.DocDate BETWEEN [%0\] AND [%1\]
    GROUP BY T0.DocNum
    Thanks,
    Gordon

  • Retrieve int using sql statements

    Hi there,
    Does anyone have any ideas as to how i can update a database table with an integer, returned from a second table as part of an sql statement.
    Here is part of the method to get the value i want out of the database:
    public int retrieveId() throws SQLException
      sta = c.prepareStatement("SELECT MAX(cid) FROM Customer");
      ResultSet rs = sta.executeQuery();
      //this method retrieves the first (and in this case the only)
      //value in the result set as an integer
      rs.getInt(1);
      //?????i am unsure as to what to do here to return this integer
    }To clarify my problem, this value will be used to update a second table in the database, i.e:
    public void updateHasAddress() throws SQLException
      sta = c.prepareStatement("INSERT INTO HasAddress(cid) VALUES(?);");
      sta.setInt(1, retrieveId());
      sta.executeUpdate();
      sta.close();
    }However, i have no idea how to return just the integer in the first method - and without all sorts of strange exceptions being thrown - i have tried all sorts of work arounds, but none have worked so far!
    Thanks for your Time

    One thing though, if the statment execution failed for any reason, then you are not closing your statement/result set which will cause problems down the line.
    public int retrieveId()
    String query = "";
    try { 
    query = "SELECT MAX(cid) FROM Customer";
    Statement stmt = connect.createStatement();
    ResultSet rs = stmt.executeQuery(query);
    rs.next();
    int a = rs.getInt(1);
    rs.close();
    stmt.close();
    return a;
    catch(Exception ex) {
    System.out.println(ex);
    return null;
    }Try this instead:
    public int retrieveId()
       String query = "";
       ResultSet rs = null;
       Statement stmt = null;
       try { 
        query = "SELECT MAX(cid) FROM Customer";
        stmt = connect.createStatement();
        rs = stmt.executeQuery(query); 
        rs.next();
        int a = rs.getInt(1);  
        return a;
       catch(Exception ex) {
        System.out.println(ex);
        return null;
       finally
         try { rs.close(); } catch ( Exception e ) {}
         try { stmt.close(); } catch ( Exception e ) {}
    }Now, you have no chance of leaving cursors open or getting memory leaks.

  • Sql statement  - compilation error

    I have a sql statement in a method that looks something like this:
    for each row in
    SELECT *
    FROM LASC.CMS.VW_CERTIFICATEOFGOODSTANDING1
    WHERE barNum = LASC.CertificationRequest.barNum
    do
    display ...
    end
    when I try to compile it, I get an error saying:
    SQL statements can only be used in functions or procedures that run on the server side.
    I am fairly new to BPM, so I am not sure how to resolve this.
    Any help would be greatly appreciated.
    Lilach

    here is the solution that Ignacio provided.
    You could go to Properties tab on the right (in Studio) for this method and inside the Method Properties section, you have on boolean property called "Server Side Method". Check it on "True".
    Hope this helps.
    Ignacio

  • Data Loading using SQL* Loader giving errors..

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

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

  • How do I use SQL statements to perform calculations with form fields????

    Please help!!! I don't know how to use a SQL statement within my APEX form......
    My form is below. The user will enter the values in the form. Click on Submit. Then we need to run a SQL select statement with those values.
    Our form looks like this:
    Start_Date ____________
    Per_Period ____________
    Period ____________
    [Submit Button]
    The user will enter these 3 values in the form.
    This is an example of an user providing the values:
    Start_Date 03/14/08_______
    Per_Period $200.00________
    Period 4____________
    [Submit Button]
    Then they will click the Submit Button.
    The SQL statement (BELOW) returns output based on the users selections:
    START_DATE PER_PERIOD PERIOD
    14-MAR-2008 00:00 200 Week 1 of 4
    21-MAR-2008 00:00 200 Week 2 of 4
    28-MAR-2008 00:00 200 Week 3 of 4
    04-APR-2008 00:00 200 Week 4 of 4
    Total 800
    This is the full text of the SQL that makes the output above:
    with criteria as (select to_date('03/14/08', 'mm/dd/rr') as start_date,
    4 as periods,
    'Week' as period,
    200 per_period from dual),
    periods as (select 'Week' period, 7 days, 0 months from dual
    union all select 'BiWeek', 14, 0 from dual
    union all select 'Month', 0, 1 from dual
    union all select 'ByMonth', 0, 2 from dual
    union all select 'Quarter', 0, 3 from dual
    union all select 'Year', 0 , 12 from dual
    t1 as (
    select add_months(start_date,months*(level-1))+days*(level-1) start_date,
    per_period,
    c.period||' '||level||' of '||c.periods period
    from criteria c join periods p on c.period = p.period
    connect by level <= periods)
    select case grouping(start_date)
    when 1 then 'Total'
    else to_char(start_date)
    end start_date,
    sum(per_period) per_period,
    period
    from t1
    group by rollup ((start_date, period))
    THANKS VERY MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    You're just doing a parameterized report, where the input fields are your parameters.
    Check out the Advanced Tutorial titled Parameterized Report here:
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/rprt_query.htm#BGBEEBJA
    Good luck,
    Stew

  • Sql loader using sql statement

    Hi All ,
    May i know any way used sql loader refer sql statement e.g "select a from test"
    import data into other table ?
    if you have any sample or link , please let me know , thanks a lot

    If you are using the database steps, the answer is yes. I've done it by creating a data source that uses the Microsoft Text Driver in the ODBC administrator. The Open Database step is then configured like any other ODBC database. In the .csv file, I have the first line define the column names (i.e. column1, column2) and the SQL statement I use is "SELECT * FROM junk.txt". I haven't tried anything with a WHERE clause but that should work as well.

  • Configuring the appbuilder chart using SQL Statements

    Hi all!
    I am able to create a chart using .mameta
    My Chart is able to read in data and display on a chart successfully.
    What i could not achieve was that the chart doesn't read and display the numbers correctly as shown below.
    It read by ID instead of TOTAL COUNT
    Does anyone knows how to display the count correctly?
    Your replies is much appreciated.

    Hi Satish,
    Modularity per se, i.e. using a function implies a new database object, source control et. al. which is an overhead.
    If we can use an sql statement and handle it in the control file itself, then any future enhancements/bug fixing would involve only modification to the control file, i.e. patching would be easier in this case.
    Thanks for the reply!!!
    Have a nice day!!!

  • Pininig frquently used sql statements in SGA

    Hi
    Can you pls let me know the procedure to pin Oracle sql or pl/sql statements into SGA
    Thanks in anticipation.
    Hariharan.T

    William Robertson wrote:
    Perhaps it is used frequently but other code is used even more frequently.Yep, and of course pinning the less frequently used code will cause the more frequently used code to be aged out which will require pinning that code which in turn will age out code that is run even more frequently to be aged out which will require pinning that until everything but the most frequently used code will be pinned and the most frequently used code will be aged out.

  • Avoid duplicate inserts using SQL statement?

    I have primary key on three columns and I want to write a sql statement to insert a row only if the matching three columns doesn't exist in the database.
    This is the condition I wrote but doesn't work. Could someone suggest me a query which meets this criteria.
    INSERT INTO JAVA_SERVICES (SERVICE_PAGE, SERVICE_TYPE, SERVICE_NAME,
      ROOT_PATH)
      VALUES ('AAAA', 'BBBB', 'CCCC', 'njdex') WHERE SERVICE_PAGE != 'AAAA' AND SERVICE_TYPE != 'BBBB' AND SERVICE_NAME != 'CCCC'Edited by: user626618 on Jun 12, 2009 2:39 PM

    you need to provide us more details such as what table name and column names are you using. using an insert into statement an example would be like:
    insert into java_services
    (service_page, service_type, service_name, root_path)
    select [column name], [column name], [column name]
      from [table name]
    where ([column name], [column name], [column name]) not in (select SERVICE_PAGE, SERVICE_TYPE, SERVICE_NAME
                                                                   from JAVA_SERVICES);
    begin
      for i in (select [column name] col1, [column name] col2, [column name] col3
                  from [table name]
                 where ([column name], [column name], [column name]) not in (select SERVICE_PAGE, SERVICE_TYPE, SERVICE_NAME
                                                                    from JAVA_SERVICES)) loop
        insert into java_services
          (service_page, service_type, service_name, root_path)
        values
          (i.col1, i.col2, i.col3);
      end loop;
    end;
    /

Maybe you are looking for

  • Greyed out Face tagging- Still!?!

    I have a library of 15,000 photos.  I would say only 1/16th of them have face tags.  I have done library rebuilding.  I have been on the phone with support to try their "Solutions".  I see no spinning wheel next to faces like it's actually working to

  • Apache2 + mod_perl2 + dbxml issue

    Hello, we are experiencing an annoying issue with the setup mentioned in the subject, and since we haven't been able to find a solution for a while now, we're seeking for help in this forum. We have a web application built as a couple of perl modules

  • Running a Select query against multiple sql servers using SSIS script task.

    Hi Guys, I need to fetch data from multiple sql servers using  SSIS scirpt task inside a foreach container. is there anyway i can build dynamic sql connections using ssis variables inside SSIS script task in each loop Please guide me or refer any blo

  • Mapping Question p3: .. etc.. namespace prefixes

    Does anyone know why xi uses namespace prefixes like p3: p2: etc..?  I am trying to map based on an rfc as the target and a message from a wsdl as the source.  I can not test the map because it expects the test file ( from our partner ) to have all t

  • Monitor an instance's changes

    Hello, all information that I need to monitor with a unit monitor is included in the properties of its target instance. The monitor must react to changes of the properties of its target instances (as they change during discoveries). Such as, if one o