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!

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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Retrieve Crystal SQL statements without first submitting parameter values?

    Hi,
    I am retrieving SQL statements for Crystal reports without issue, but a large number of our reports have parameters and for these the following error is thrown when I try to retrieve the SQL statement via RAS using getSQLStatement():
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Missing parameter values.---- Error code:-2147217394 Error code name:missingParameterValueError
    I have a large number of reports I'd like to pull SQL for, so it's not feasible to have my script push parameter values to each and every report.  Is there a way to retrieve SQL statements without first pushing parameter values?
    Thanks

    Hello Jeremy.
    I found a Knowledge Base article that deals with the "Error code:-2147217394 Error code name:missingParameterValueError" error that you mention.  Perhaps you could take a look at the following KBase Article in the Service MarketPlace and see if any of it applies to your situation:
    KBase number: 1420593
    I also found KBase number "1420501 - Report parameters ignored when set by Java post processing code" that seems to deal with the same problem.
    Regards.
    - Robert

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

  • 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

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

  • How to set client within SQL statement without using another pl/sql stmt.

    I have a following select statement
    SELECT SUM (w.prior_forecasted_costs + w.prior_committed_costs)
    FROM xxsuf.job_cost_summary_table w,
    apps.pa_periods p,
    pa.pa_resources bz,
    pa.pa_resource_list_members cz,
    pa.pa_tasks dz
    WHERE w.project_id = z.project_id
    AND w.task_id = dz.task_id
    AND dz.task_number '98000'
    AND w.resource_list_member_id = cz.resource_list_member_id
    AND cz.resource_id = bz.resource_id
    AND NOT EXISTS (SELECT NULL
    FROM pa.pa_tasks zz
    WHERE zz.parent_task_id = dz.task_id)
    AND w.resource_list_member_id != 1000
    AND p.period_name = w.pa_period
    AND p.current_pa_period_flag = 'Y'
    Above select statement uses pa_periods view which only works when I set my client using "exec DBMS_Application_Info.set_client_info(83);" in Toad or SQL*Plus session.
    I was wondering how can I achieve it within select statement. so that I don't have to use another PL/SQL statement to set my client. Is there anyway to set client with my org id within above select statement ?
    Please advise.
    --Rakesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    You can simply create a function which calls dbms_application_info and use that in your sql statement as in
    SQL> create or replace function set_client_info (i_info varchar2)
       return varchar2
    as
    begin
       dbms_application_info.set_client_info (i_info);
       return i_info;
    end set_client_info;
    Function created.
    SQL> create or replace view v_emp
    as
      select * from emp where empno = to_number(sys_context('userenv','client_info'))
    View created.
    SQL> select ename from v_emp where set_client_info(7788) is not null
    ENAME    
    SCOTT    
    1 row selected.
    SQL> select ename from v_emp where set_client_info(7900) is not null
    ENAME    
    JAMES    
    1 row selected.

  • Submit statement without executing AT SELECTION SCREEN event

    hi,
      In my report since the input data is very large iam spliiting the input data batch by batch. Iam executing the report for the first batch input data and retriving the results for it.
       Then to find the result for the enxt batch input data , iam using submit statement to execute the report again. While executing the report now it should directly start from the start-of-selection event only. It should not go for At selection screen or initialization events.
    Can anyone help me how to execute the report for second time from start-of-selection event.
    Regards,
    Phyrose.

    Is code written directly under START-OF-SELECTION or you are calling subroutine in START-OF-SELECTION?
    I would suggest you to call the subroutines written under START-OF-SELECTION.
    PERFORM form IN PROGRAM prog.

  • Getting ORA-01001: invalid cursor when I try to parse my SQL statement with DBMS_SQL

    -- To modify this template, edit file PROC.TXT in TEMPLATE
    -- directory of SQL Navigator
    -- Purpose: Briefly explain the functionality of the procedure
    -- MODIFICATION HISTORY
    -- Person Date Comments
    TYPE column_find IS VARRAY(999) of VARCHAR2(4);
    v_client_column varchar2(4);
    v_errorcode NUMBER;
    v_errortext VARCHAR2(200);
    i number :=0;
    V_COLUMN_NAME varchar2(20);
    V_COLUMN_NAME2 varchar2(20);
    v_SQL_STMT varchar2(2000);
    v_c_hndl integer;
    v_Client_ID varchar2(200);
    column_name varchar2(20);
    execute_feedback integer;
    mal material_attribute_pre_load%
    ROWTYPE;
    local_var varchar2(200);
    clienttab DBMS_SQL.DATE_TABLE;
    client_column column_find := column_find();
    -- Declare program variables as shown above
    BEGIN
    --client_column := column_find();
    v_c_hndl := DBMS_SQL.OPEN_CURSOR;
    while i < 999
    LOOP
    i := i + 1;
    client_column.EXTEND;
    client_column(i) := CONCAT('c',i);
    dbms_output.put_line(client_column(i));
    BEGIN
    dbms_output.put_line('Starting SQL_STMT.');
    v_SQL_STMT := 'SELECT :column_name FROM
    MATERIAL_ATTRIBUTE_PRE_LOAD WHERE :column_name2 = :v_Client_ID';
    dbms_output.put_line('Starting DBMS_SQL.PARSE.');
    DBMS_SQL.PARSE(v_c_hndl,v_SQL_STMT,DBMS_SQL.NATIVE);
    dbms_output.put_line('Starting DBMS_SQL.BIND_VARIABLE.');
    DBMS_SQL.BIND_VARIABLE
    (v_c_hndl,'v_Client_ID','Client ID');
    DBMS_SQL.BIND_VARIABLE
    (v_c_hndl,'column_name',client_column(i));
    DBMS_SQL.BIND_VARIABLE
    (v_c_hndl,'column_name2',client_column(i));
    dbms_output.put_line('Starting DBMS_SQL.DEFINE_ARRAY.');
    DBMS_SQL.DEFINE_ARRAY(v_c_hndl,1,clienttab,999,1);
    execute_feedback := DBMS_SQL.EXECUTE_AND_FETCH
    (v_c_hndl);
    DBMS_SQL.CLOSE_CURSOR(v_c_hndl);
    dbms_output.put_line
    EXCEPTION
    WHEN OTHERS THEN
    v_errorcode := SQLCODE;
    v_errortext := SUBSTR(SQLERRM,1,200);
    dbms_output.put_line('DISPLAY_ERROR'||SUBSTR(TO_CHAR
    (v_errorcode)||v_errortext,1,30));
    END;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    v_errorcode := SQLCODE;
    v_errortext := SUBSTR(SQLERRM,1,200);
    dbms_output.put_line('DISPLAY_ERROR'||SUBSTR(TO_CHAR
    (v_errorcode)||v_errortext,1,30));
    END; -- Procedure COLUMN_FIND

    I'm using Oracle Database Express edition (latest version from the website afaik), logging into the web interface (using unique account I created after setup[not System], gave it All rights), clicking on SQL > SQL Commands > Enter commands.
    I can't run each insert individually, that is only 1 table out of 8 tables, and I probably need to be able to run the entire script (which is actually headed by a sequence of Drop Table commands) sometimes, to refresh the data back to original values in case I stuff things up. The code was originally provided in a text file called bookscript.sql, but I haven't had any success importing or uploading that file into Oracle XE, if I use SQL > SQL Scripts > Upload, the file uploads, I then click on it and click on Run, but nothing seems to happen. (File is shared [read-only] here: https://docs.google.com/leaf?id=0B7IgBXIBNxw3OTY1ZTdmNGQtMjEwYi00YmRmLTkwZjItODZkYmYxODNkMTk4&hl=en_US).
    Would love any guidance as to how to modify my environment or how to input the code differently to get it running, it works fine in the hosted environment at Uni, it's an Oracle class (textbook is Guide to Oracle 10g). Lecturer doesn't seem to know much about setting up Oracle, only working in a functioning environment.

  • Executing SQL statements in container managed transactions

    I have a problem when using TopLink 9.0.3 with WebSphere 4, Oracle 9i and J2EE container managed transactions.
    The data changing SQL statements are executed at the end of the (container managed) transaction, not at the time of the calls to UnitOfWork.registerNewObjekt(),
    UnitOfWork.validate...() or UnitOfWork.commit...().
    UnitOfWork(2035008996)--validate object space.
    UnitOfWork(2035008996)--validate cache.
    UnitOfWork(2035008996)--JTS#beforeCompletion()
    UnitOfWork(2035008996)--Connection(398132708)--INSERT INTO SVM_PERSONEN (FAX, NAME, ID, [...]) VALUES ([...])
    UnitOfWork(2035008996)--JTS#afterCompletion(org.omg.CosTransactions.Status._StatusRolledBack=4)
    UnitOfWork(2035008996)--release unit of work
    But the end of the transaction is out of the application server code. The transaction ends after the invoke of the applixcation server method, as the stack trace of an occurring exception shows:
    remote exception
    javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 0 No; nested exception is:
         org.omg.CORBA.TRANSACTION_ROLLEDBACK:
    org.omg.CORBA.TRANSACTION_ROLLEDBACK: com.ibm.websphere.csi.CSITransactionRolledbackException:
         at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:194)
         at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:67)
         at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:414)
         at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:1818)
         at de.gedas.svm.server.app.ejb.EJSRemoteStatelessNavigationEJB.findPersonenZulieferer(EJSRemoteStatelessNavigationEJB.java:964)
         at de.gedas.svm.server.app.ejb._EJSRemoteStatelessNavigationEJB_Tie._invoke(_EJSRemoteStatelessNavigationEJB_Tie.java:589)
         at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:506)
         at com.ibm.CORBA.iiop.ORB.process(ORB.java:2376)
         at com.ibm.CORBA.iiop.OrbWorker.run(OrbWorker.java:186)
         at com.ibm.ejs.oa.pool.ThreadPool$PooledWorker.run(ThreadPool.java:104)
         at com.ibm.ws.util.CachedThread.run(ThreadPool.java:137)
    So the application server code has no possiblity for special reaction to this error condition.
    How can I use TopLink to execute my SQL statement immidately, not at the the end of the transaction (which is out of the area of my code)? Only the transaction should end at the usual time, managed by the container.

    I don't think there is anyway to currently do this in a JTS managed environment, to handle the exceptions you could,
    - Make use of TopLink session ExceptionHandlers to handle the database errors during the JTS commit.
    i.e.
    uow.setExceptionHandler(yourExceptionHandler);
    or,
    - Let TopLink control the transactions instead of JTS.

  • Trying to find a specific SQL statement to determine its cost

    If an sql statement is executed will it ALWAYS show up in the awrrpt report? (10g)
    I am a developer DBA and was handed an SQL statement by the production DBA as being a problem during a specific timeframe within the past hour.
    That statement does not show up in v$LongOps (although other older ones are) nor does it appear in v$sqltext and is not in the awrrpt even when I run the report for the entire day.
    Any other ideas or can I safely broach the Production DBA without looking like an idiot?!!
    Thanks

    I am not using awrrpt report but for sure if your statement has been executed it must have been in v$sqltext but maybe it did not stay very long because it has been rarely executed and replaced in the shared pool by other SQL statements that have been more executed.
    You could setup a copy of your production database on a similar host and run the statement several time in single user mode to check at least its performance in single user with sql_trace=TRUE and tkprof.
    If your statement is SELECT your could also execute it in your production database and check at the sametime v$sqltext and also v$sqlarea, especially for:
    DISK_READS      NUMBER      Sum of the number of disk reads over all child cursors
    BUFFER_GETS      NUMBER      Sum of buffer gets over all child cursors
    USER_IO_WAIT_TIME      NUMBER      User I/O Wait Time (in microseconds)
    CPU_TIME      NUMBER      CPU time (in microseconds) used by this cursor for parsing, executing, and fetching
    ELAPSED_TIME      NUMBER      Elapsed time (in microseconds) used by this cursor for parsing, executing, and fetching

  • What kind of operations is doing when DML statement is executing

    i want to know what kind of operations are doing where dml sql statement is executeing - undo and redo log, index renewing, transaction log, audit log - is there some operations that i do not know ?

    Intially sql goes to library cache, where it checks for syntax and sematics, once it pass throw, it generates a 16 digit hash code for that sql( for the first time this can be treated as 'HARD PARSING' and and the same sql given for 2nd time it wont do the entire process, just uses the existing #code, this is called as 'SOFT PARSING") and finally this goes to DDC where object existence and privileges are checked, once it passed all these it gets the file#,block# to fetech the blocks form datafile, and those will be fetched to database buffer cache and then to client system in such a format that we can usderstood.
    Hope this makes sense to you!
    tx- Harry

  • Check the validity of a SQL statement before execution

    Hi everyone,
    In an applet I have created, I am allowing the user to create a SQL statement which will be sent to a servlet that in turn issues the JDBC request for the SQL statement. My concern is that since my GUI lets the user create more or less any kind of SQL statement (including an illegal one) I need to verify if the user has created the correct SQL. How can this be achieved?
    To recapitulate and summarize, I need to know how I can check the validity of a SQL statement without actually executing it and handling the SQLException. FYI, I am using the mm-mysql driver.
    Thanks,
    Alan

    jschell is correct. Unless you're writing something like an ISQL tool you want to be very careful doing this.
    Having said that Mimer SQL have SQL validators that may do what you want http://developer.mimer.com/validator/index.htm
    They've also got the SQL Validator running as a web service that you can use. Theres example code here showing how to use it.
    http://sqlvalidator.mimer.com/index.html
    At the risk of being accused of selfpromotion you can check out the SQL Validator plugin for SQuirreL SQL CLient. This is a fully functional example of using the Mimer SQL Validation web service. http://squirrel-sql.sourceforge.net/
    Col

  • Can someone help me correct this sql statement in a jsp page?

    ive been getting the java.sql.SQLException: Incorrect syntax error for one of my sql nested statements. i cant seem to find similar egs online, so reckon if anyone here could help, really appreciate it.
    as im putting the nested sql in jsp page, it has to be with lots of " " n crap. very confusing if there are nested.
    heres the sql statement without those "" that i want to use:
    select top 5 * from(
    select top+"'"+offset+"'"+" * from prod where cat=" +"'" cat "'"+"
    )order by prodID desc
    when i put this in my jsp pg, i had to add "" to become:
    String sql = "select top 5 * from("+"select top"+"'"+offset+"'"+" * from prod where cat=" +"'" +cat+ "'"+")order by prodID desc";cat=" +"'" cat "'"+")order by prodID desc";
    all those "" are confusing me to no end, so i cant figure out what should be the correct syntax. the error says the syntax error is near the offset.

    If offset is, say, 10, and cat is, say, "new", then it looks like you're going to produce the SQL:
    select top 5 * from(
      select top '10' * from prod where cat='new'
    )order by prodID descThat looks exactly like incorrect syntax to me... top almost certainly can't handle a string literal as its operand... you almost certainly would want "top 10" instead of "top '10'"...
    If you use PreparedStatement, you don't have to remember what you quote and what you don't and you can have your SQL in a single static final string to boot...

  • Dynamic SQL statement in a Procedure

    Hi,
    is it possible to use a variable in place of a column name in a sql statement inside a procedure. Or to create the whole statement as a sql statement and execute it (preferrably with parameters - rather than concatinating the values).
    Thanks for any help or direction
    Elliot

    Turns out you can do the following very nicely (dynamic sql with parameterized values)
    Declare
    id number(10,0);
    sql_stmt varchar2(300);
    fieldName varchar2(30);
    fieldValue varchar2(100);
    id := 30;
    fieldName := 'somecolumn';
    fieldValue := 'some value';
    sql_stmt := 'UPDATE myTable SET ' || fieldName || ' = :1 WHERE id = :2';
    EXECUTE IMMEDIATE sql_stmt USING fieldValue, id;

Maybe you are looking for

  • Error while provisioning Solaris11 through AI

    Hi, I am trying to deploy Solaris 11 on solaris sparc server through AI. I have AI server(IP:10.41.4.70) and sparc server(MGMT IP: 10.41.4.100) in same network. Now I have set environment variable as follows, auto-boot?  false network-boot-arguments

  • Script Outbound. How introduce multiple numbers in a "Place call"?

    Hi, i'm trying to implement a script to make multiple outbound calls in a UCCX system but i don't know how can introduce several phones. The idea is simple but this step is critical: 1-take the first phone number and make the call. 2-take the secornd

  • How can I call local numbers using Siri in Azerbaijan?

    I am using Iphone 4S with the latest software version, and am trying to dial Azeri phone number in international format , Siri answers calling "phone number" then immediately answers sorry i cant call "phone number".

  • What notebook cooler do you have/recommend?

    Hi guys, Does any of you use a notebook cooler? I'd like to get the Zalman NC2000 for my T60p, unless someone else know another good one? regards, T42p 2373-Q1G (PM765, 2GB, 250 GB HDD, 15" UXGA(1600x1200), 128MB ATI FireGL T2) T60p 8741-C4G (T7600 2

  • When turning the Ipod on the screen is completely blank with lines

    When I turn my Ipod on the ipod is completely blank with lines up and down the screen and when turning it on it should have the main menu with the songs and other information. How do I fix this? The ipod serial number is YM715WZCX9B. The ipod color i