SQL statement not executing

Please enlighten me. This is driving me crazy.
I don't know if this is a database or java code related problem.
JVM: 1.4.2
Database: Oracle 9i
Objective: trying to add a row into a table
Problem: 1. SQL statement never gets executed.
2. Application freezes. I have to terminate it myself.
Any Ideas?
void addCourse(){
try {
    DriverManager.registerDriver ( new oracle.jdbc.driver.OracleDriver () ) ;
   System.out.println("Driver registered");  //---> ok.
Connection conn = DriverManager.getConnection ( dbPath, username, password ) ;
   System.out.println("Connected");   // -----> it connects fine
   ResultSet rset = stmt.getResultSet();
   System.out.println("getting result set");  //-----> gets the resultSet fine
  Statement stmt = conn.createStatement();
  System.out.println("statement created");  //------> it creates statement
7 = are the credits. Number on table. Length allowed 5.
CS 500 = are the course code. Varchar2 on table. Length allowed 20
Java = Actual course name. Varchar2 on table. Length 30
3 = credits. Number on table. Length 5.
          // Prepare a statement to insert a record
          String sql = "INSERT INTO course VALUES (7 , 'CS 500', 'Java', 3 )"; //-->ok. Tested it manually 
          // Execute the insert statement
        stmt.executeUpdate(sql);  //----> *** java program freezes right here.***
        System.out.println("sql executed");   //--> Checked table. SQL never gets executed.
catch ( SQLException ex ) {   //---> no error messages thrown.
System.err.println(ex.getMessage());
  System.err.println(ex.getErrorCode());
  System.err.println(ex.getSQLState());
}

Nothing looks amiss in the code... How long are you waiting before you manually terminate?
Can you replace the executeUpdate() with execute and change the INSERT to a SELECT? Does that work normally (you should be sure to get at least one row to verify that it is working correctly)? Can you select and update a different table in a different tablespace successfully?
Couple of possibilities (I know this is weak):
1) You have hit a deadlock condition because the table is locked by another or same process.
2) You are running into network problems.
3) Your insert is being queued up in Oracle's transaction manager (if configured).
4) Have you tried both the Oracle thin and Oracle OCI driver? Do they both fail without error?
5) Can you turn off autoupdate and try the insert? Does the executeUpdate() return then?

Similar Messages

  • Need help in resolving the below error - SQL statement to execute cannot be

    Here is my CO as below , which creates a callable statement.
    try {
    OAApplicationModule oaapplicationmodule = pageContext.getApplicationModule(webBean);
    OADBTransactionImpl t = (OADBTransactionImpl)oaapplicationmodule.getOADBTransaction();
    OracleCallableStatement proc = (OracleCallableStatement)t.createCallableStatement(lquery, -1);
    proc.execute();
    t.commit();
    catch(SQLException sqlexception)
    throw OAException.wrapperException(sqlexception);
    After running the page , getting the below error ... ( Please find the below error stack )
    I reffered the developement guide but did not get helpful things.
    Please provide me any clues on the same.
    Regards Raghu
    -- Error Stack ---------------------------------------------------------
    Error Page
    Exception Details.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27123: SQL error during call statement preparation. Statement: null
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
         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.processFormRequest(OAPageBean.java:2637)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         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: SQL statement to execute cannot be empty or null
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
         at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
         at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
         at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
         at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         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: SQL statement to execute cannot be empty or null
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
         at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
         at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
         at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
         at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         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)
    Edited by: Raghu on Sep 14, 2010 2:58 AM

    check the code pasted by me again
    Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
    Connection conn = oaapplicationmodule.getOADBTransaction().getJdbcConnection(); //Right oneThanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SQL Statement not allowed

    I am using the sender jdbc sender adapter.
    I had given the SQL Query:
    EXECUTE xyz;
    i am getting SQL Exception.
    SQL Statement not allowed in adapter monitoring.
    Gaurav

    Hi,
    Which database you are using ?
    Are you executing the Stored Procedure ?
    check out this for the syntax etc-
    http://help.sap.com/saphelp_nw2004s/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
    Regards,
    Moorthy

  • SQL STATEMENT NOT PROPERLY ENDED - HELP NEEDED

    Can anyone tell me the error in this code, I get an error message sql statement not properly ended when I run it.
    update MODT set rootobj=(SELECT REF(A) FROM
    OR_COMP_T A
    WHERE A.ID=O.ID)
    AS OR_COMP_T_REF)
    FROM OLD_MODT O where id = 1;

    Hi, here is the schema and the expected results.
    =======================================================================================
    CREATE TYPE OR_MODT_OBJ;
    CREATE TYPE OR_MODT_OBJ_REF AS TABLE OF REF OR_MODT_OBJ;
    =================================================
    CREATE OR REPLACE TYPE OR_COMP_T_OBJ
    (id number (6),
    typ char (4),
    SUPERID REF OR_COMP_T_OBJ,
    MOD REF OR_MODT_OBJ);
    =================================================
    CREATE OR REPLACE TYPE OR_COMP_T_REF AS TABLE OF REF OR_COMP_T_OBJ;
    =================================================
    CREATE TABLE OR_COMP_T OF OR_COMP_T_OBJ
    =================================================
    CREATE TYPE OR_MODT_OBJ
    (id number (6),
    typ char (4),
    rootobj REF OR_COMP_T_OBJ,
    comp_tb     OR_COMP_T_REF);
    =================================================
    CREATE TABLE MODT OF OR_MODT_OBJ
    NESTED COMP_TB STORE AS COMP_TB_NESTED;
    =================================================
    INSERT INTO OR_MODT (ID,TYP,ROOTOBJ,COMP_TB)
    SELECT ID,TYP,NULL,NULL FROM OLD_MODT;
    INSERT INTO OR_COMP_T(ID,TYP,SUPERID,MOD)
    SELECT ID,TYP,NULL,NULL FROM OLD_OR_COMP_T;
    ==================================================
    There are two rows in OLD_MODT, and these two rows are to be inserted into OR_MODT.
    They are:
    Sample data in OLD_MODT are:
    id,      typ,     rootobj
    1     type1     1
    2     type3     365
    =================================================
    Data from OLD_OR_COMP_T is to be inserted into OR_COMP_T as well, and likewise, it has a ref to OR_MODT, so the ref data was not inserted at the same time.
    Now OLD_OR_COMP_T has a number of rows but attribute MOD for two of these rows os the rootobj for OR_MODT,
    such that:
    id     typ     superID     mod
    1     type4     NULL     1
    2     type2     10101     1
    3     type     20202     1
    365     type2     NULL     2
    366     type2     20202     2
    I want to get the ID of OR_COMP_T where ID is 1 and where ID is 365. These values are to be in rootobj.
    I also want to get the value of ID in OR_MODT to be placed in MOD of OR_COMP_T.
    PLEASE HELP ME.

  • SQL Update statement not executing in Filter

    Hi,
    I am trying to update Documents table using the query resource in a custom component. The document table is requred to upate for vault file(1 row) and for weblayout file(1 row). The java code is executing in PostConversionFilter, the sql is defined in query resource.
    Query Resource is defined in componet like..
    MyQResource=UPDATE Documents SET dOriginalName = ?, dFormat = ?, dFileSize = ?, dExtension = ? WHERE (dID = ? AND dIsPrimary = ? AND dIsWebFormat = ?)
    This SQL executes for vault file means dIsPrimary = 1 AND dIsWebFormat = 0 however the same is not executing when for weblayout file dIsPrimary = 0 AND dIsWebFormat = 1
    I putting here final satement formed, got by systematabase trace as following
    For vault file:
    UPDATE Documents SET dOriginalName = 'XYZ009174~1.spdf', dFormat = 'application/vnd.sealedmedia.softseal.pdf', dFileSize = 0, dExtension = 'spdf' WHERE (dID = '9559' AND dIsPrimary = 1 AND dIsWebFormat = 0)
    For weblayuot file:
    UPDATE Documents SET dOriginalName = 'XYZ009174~1.spdf', dFormat = 'application/vnd.sealedmedia.softseal.pdf', dFileSize = 0, dExtension = 'spdf' WHERE (dID = '9559' AND dIsPrimary = 0 AND dIsWebFormat = 1)
    There is no error in logs, traces. I am using UCM 11g. in Documents table 1 row is updated for vault file only I am expecting for weblyaout updation also.
    Please help what could be the possible cause?
    Thanks,
    Manoj
    Edited by: Manoj Kumar on 15-May-2012 13:03

    If I got your question, you state that you see a SQL statement in systemdatabase tracing, but it is not executed in the database? Btw. you should see further details (such as how much time the query took) if you turn on full verbose tracing.
    I'd just go and try to execute the same queries directly in the database (e.g. in sqlplus console). My guess is that there will be no record according to the second WHERE clause...

  • Parsing a sql statement without executing it

    Hello everybody,
    I'd like to know a way of parsing sql statements in order to validate them, thus I'd get the error messages beforehand without executing them.
    Here we have the hard task of analyzing several sql scripts and then sending corrections to the development team and thirty party companies before applying them in our production databases. I'm willing to create a web/pl sql program that does such hard task, at least a program that identify basic errors such as missing table owner, non-existing tables, sintax errors and so on...
    Any tip will be of great help!
    Thanks in advance.

    Doing an explain plan will parse the statement prior to calculating the plan. Eg:
    SQL> explain plan for select * dual;
    explain plan for select * dual
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expectedEven easier if you use Toad or some other GUI front end where the explain plan is a click of a button (or a keyboard shortcut) away!

  • Newbie (View sql statement before execute immediate)

    Here is a sample:
    <code>
    drop table dummy;
    create table dummy(county varchar2(20)
    ,fiscalyear number(4,0)
    ,wavkeyid number(4,0));
    Insert into dummy(county,fiscalyear,wavkeyid)
    values('Jefferson',2012,59);
    commit;
    </code>
    I am trying to use a bind variable in the SQL statement.
    I would like to see the statement before it is executed.
    Example
    Select county from dummy where wavkeyid=59 and fiscalyear=2012
    Is there a way for me to see the line above?
    <code>
    PROCEDURE test_BindVar
    AS
    v_message_tx varchar2(200);
    v_wavkeyid_nr number:=59;
    v_county_tx varchar2(40);
    BEGIN
    v_message_tx:='Select county from dummy '||
    ' where wavkeyid=:x and fiscalyear=2012 ';
    dbms_output.put_line
    ('v_message_tx '||v_message_tx);
    execute immediate v_message_tx into v_county_tx using v_wavkeyid_nr;
    dbms_output.put_line
    ('v_county_tx '||v_county_tx );
    END;
    </code>
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    "CORE 10.2.0.4.0 Production"
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    TIA
    Steve42

    you missed the forum you are in ;)
    "SQL Developer (Not for general SQL/PLSQL questions)"
    recommend to post your question to the related forum on OTN.

  • Sender JDBC adapter -- Update SQL statement NOT work for the last record

    I'm trying to use SAP XI to send records from Oracle database to As/400 using JDBC adapter.  I've defined the communication channel for sender
    (1)  The "Query SQL statement"  = select  a_bgn_dt,  a_end_dt from  PX_PXXD WHERE NOT CU_ACTION_CD='P' 
    (2)   The "Update SQL statement"  = update PX_PXXD set CU_ACTION_CD='P'  WHERE NOT CU_ACTION_CD='P' 
    Supposed that 3 records were retrieved from (1) and successfully updated to AS/400 but only the first 2 records in Oracle database are updated according to (2)
    Any advise.
    Pansy

    Hi Pansy,
    You select and update query is looking like wrong
    kindly check below query,If you are using oracle
    (1) The "Query SQL statement" = select a_bgn_dt, a_end_dt from PX_PXXD WHERE CU_ACTION_CD !='P'
    (2) The "Update SQL statement" = update PX_PXXD set CU_ACTION_CD='P' WHERE  CU_ACTION_CD !='P'
    Thank you
    Sateesh

  • SQL Statement not works using functions or subqueries-MAXDB

    Hello All,
    I created an ABAP program to select information about country(table: T005) with the country names (Table: T005T). I tried to create a sql query with a sql subquery to select everything but for some reason that I don't know it doesn't work. Please find the query below.
    DATA:
    resu        TYPE REF TO cl_sql_result_set ,
    stmt         TYPE REF TO cl_sql_statement ,
    qury        TYPE string .
               qury  = `SELECT land1, spras, `
               &&       `(SELECT landx `
               &&         `FROM SAPNSP.T005T `
               &&         `WHERE mandt = '` && sy-mandt && `' `
               &&           `AND spras = 'EN' `
               &&           `AND land1 = ? ), `
               &&       `(SELECT natio `
               &&         `FROM SAPNSP.T005T `
               &&         `WHERE mandt = '` && sy-mandt && `' `
               &&           `AND spras = 'EN' `
               &&           `AND land1 = ? ) `
               &&        `FROM SAPNSP.T005 `
               &&        `WHERE mandt = '` && sy-mandt && `' `
               &&          `AND land1 = ? `
               &&        `GROUP BY land1, spras` .
    resu = stmt->execute_query( qury ) .
    Well, the query above works but the fields LANDX and NATIO are in blank in ALL THE CASES, even with information registred in table T005T.
    So, exploring the SDN forum and after read some documents regarding ADBC, I create a function to handle this sql select and get the correctly the missing informations, but, still don't work. Please find the function below:
    CREATE FUNCTION select_landx (land1 CHAR(3)) RETURNS CHAR(15)
    AS
      VAR landx CHAR(15);
      DECLARE functionresult CURSOR FOR
      SELECT spras, land1, landx
         FROM SAPNSP.t005t
         WHERE spras = 'EN'
             AND land1 = :land1;
         IF $count IS NULL THEN <- | $count is always 0, my SELECT
           BEGIN                                 it's not work but I don't know why
             CLOSE functionresult;
             RETURN NULL;
           END
         ELSE
           SET $rc = 0;
           WHILE $rc = 0 DO
           BEGIN
             FETCH functionresult INTO :landx;
           END;
         CLOSE functionresult;
         RETURN landx;
    Calling the function in a SQL statement:
    DATA:
    resu        TYPE REF TO cl_sql_result_set ,
    stmt         TYPE REF TO cl_sql_statement ,
    qury        TYPE string .
               qury  = `SELECT land1, spras, select_landx(?) landx `
               &&        `FROM SAPNSP.T005 `
               &&        `WHERE mandt = '` && sy-mandt && `' `
               &&          `AND land1 = ? `
               &&        `GROUP BY land1, spras` .
    resu = stmt->execute_query( qury ) .
    Any comments ?
    Best regards,
    Arthur Silva

    Hello,
    Thank's a lot, it works. It's funny because the given solution works using only abap codes.
    It may be happens because the abap interpretor send the sql statement to the db interface that handle the code in the another way.
    Thanks again, it was driving me crazy.
    Best regards,
    Arthur Silva

  • Callback pls/sql is not executed

    I set up an aq (single consumer) and registered a pl/sql procedure.
    When i enq a message the pl/sql procedure is not executed.
    Manually i can dequeue the message.
    init.ora settings aq_tm_processes = 1 and job_queue_processes = 10.
    Do i need to do something more here so that the pl/sql procedure will process the enqueued object automatically ?

    Double post: http://forum.java.sun.com/thread.jspa?threadID=5243520&tstart=25

  • Sql statement not working with for update

    Hi, iam facing an error fetch out of sequence
    when iam trying to execute a sql statement
    Statement st=con.createStatement();
    st.executeQuery(select mycolumn from table where jobno=1 for update);
    the statement works well without " for update ".
    any solutions????

    Hi,
    The fetch out of sequence error occurs usually when you are trying to read from a cursor that has no data left(like EOF).
    After executing the sql statement move the pointer to the first row (or the beginning of the resultset)
    This is actually an oracle error bearing number :ORA:01002
    Hope this helps.
    Thanks,
    Creator Team.

  • SQL statement NOT IN

    Hi,
    I have this SQL statement as below:
    Select data from customer where name = 'John' and customer_id NOT IN (SELECT customer_id from customer where customer_id = '111');
    Is it possible to do this or I should modify it?

    Hello,
    It's possible and it will be produces same result as this, by the query it will return row(s) with name='JOHN' but customerid is not equal to 111.
       select * from customer
                                      where name='JOHN'
                                      and customer_id !=111;Regards

  • Changing sql-statement before executing query

    I want to change the sql-statement of a query just before it is executed.
    I have tried it with a query redirector/sessionevent listener, but I could get it to work.
    Do you have any examples.
    I want to change the tablename in a sql-statement like this:
    before
    select id from emp
    after
    select id from emp_v
    Any examples out there to do this?

    ... I am using SAP NetWeaver BI 7.0
    Monique

  • SQL statement not working for an application

    Hello,
    Here is a sql statement which i am using to populate Department ID using another row in the table. Using these I am getting the values called department alias from different table and schema.
    UPDATE tablename_4127 PT
    SET "Deptid" = (select distinct(deptid) from datastore.get_department_alias
    where upper(ltrim(rtrim(deptalias))) = upper(ltrim(rtrim(PT."Dept Descr")))
    AND "Colid" = PT.COLID)
    Please anyone help me with this.
    Thank you

    HBUA wrote:
    Hello,
    Here is a sql statement which i am using to populate Department ID using another row in the table. Using these I am getting the values called department alias from different table and schema.
    UPDATE tablename_4127 PT
    SET "Deptid" = (select distinct(deptid) from datastore.get_department_alias
    where upper(ltrim(rtrim(deptalias))) = upper(ltrim(rtrim(PT."Dept Descr")))
    AND "Colid" = PT.COLID)
    Please anyone help me with this.
    Thank youhelp you how, since we don't have your table, data or requirements?
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Using EXECUTE IMMEDIATE with Create Table SQL Statement not working

    Hi ,
    I am all the privileges given from the SYSTEM user , but still i am not able to create a table under procedure . Please see these and advice.
    create or replace procedure sp_dummy as
    begin
    Execute Immediate 'Create table Dummy99_99 (Dummy_Field number)';
    end;
    even i tried this way also
    create or replace PROCEDURE clearing_Practise(p_file_id in varchar2, p_country in VARCHAR2,p_mapId in VARCHAR2)
    AUTHID CURRENT_USER AS
    strStatusCode VARCHAR2(6);
    BEGIN
    EXECUTE IMMEDIATE 'create table bonus(name varchar2(50))';
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('ERROR Creating Table');
    END ;

    William Robertson wrote:
    Since the syntax is correct, my guess is you do not have CREATE TABLE system privilege granted directly to your account. A common scenario is that you have this privilege granted indirectly via a role, allowing you to create tables on the command line, but stored PL/SQL is stricter and requires a direct grant and therefore the procedure fails with 'insufficient privileges'.A bit like he's already been told on his first thread...
    Using of Execute Immediate in Oracle PLSQL
    Generally you would not create tables from stored PL/SQL. Also as you have found out, it's best not to hide exceptions with 'WHEN OTHERS THEN [some message which gives less detail than the one generated by Oracle]'.Again like he was told on the other thread.
    There's just no telling some people eh! :)

Maybe you are looking for

  • How do I make my laptop Mac communicate with my iMac so that the calendars have the same events

    I am trying to get my Macbook Pro to have the same events on the calendar that are on my imac as well as the contacts be the same.  Is it not iCloud that is suppossed to be doing that automatically?  If so, it is not on mine.  What do I have to do? 

  • Graphical error after elongation of a page

    Hello everybody, I have the problem that after an elongation of a page a bar is appearing. This bar seems to be part of the background. (firebug) Can anybody tell me why ? What is a solution for this problem? Greets, Frank P.S.: I can't add a picture

  • JavaME apps on iPhone?

    Does iPhone support J2ME apps, like other mobile platforms?

  • Graphic Problem gt70 ond after win 8.1

    HI I updated to windows 8.1 now when i play a game IE wow or battlefield 3 my graphic card wont switch from the Intel 1 to the gtx675 orange light comes on for like 2 sec then goes white again . any ideas plx

  • Recover ISCSI Data

    Hi I had created an ISCSI Volume on a NSS326 and had data on it. I then decided to increase security by adding CHAP security. The NSS326 changed the ISCSI Target name and I was unable to see the data. Is the Data that was on the previous recoverable?