The analysis of a sql statement without executing it

Hello everyone,

I would like to know a way of parsing sql statements to validate them, so I would get the error messages in advance without executing them.

Here we have the difficult task to analyze several sql scripts and send corrections to the development team and thirty third companies before applying them in our production databases. I am ready to create a program web/pl sql, making this difficult task, at least one program to identify errors such as lack of owner of the table, nonexistent tables, syntax errors and so on...

Any information will be a great help!

Thanks in advance.

Hi and welcome to the forum.

Tip1:
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:3648254441315

Tip2:
to bookmark this forum (SQL and PL/SQL)
Bookmark http://tahiti.oracle.com (The Oracle Documentation)
Bookmark http://asktom.oracle.com

Tip3:
On all the sites mentioned, you can do a quick search on key words of your interest and you will get the examples and explanations returned.

Tags: Database

Similar Questions

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

    Below is my CO as, which creates a callable statement.

    try {}
    OAApplicationModule oaapplicationmodule = (webBean) pageContext.getApplicationModule;
    OADBTransactionImpl t = (OADBTransactionImpl) oaapplicationmodule.getOADBTransaction ();
    OracleCallableStatement proc = (OracleCallableStatement) t.createCallableStatement (lquery,-1);
    proc. Execute();
    t.Commit ();


    }
    catch (SQLException sqlexception)
    {
    throw OAException.wrapperException (sqlexception);
    }




    After the execution of the page, get the below error... (Please find below stack error)

    I have referred the development guide but did not get something useful.

    Please give me clues about the same.

    Raghu cordially

    -- Error Stack ---------------------------------------------------------

    Error page


    Details of the exception.

    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: Houston-27123: SQL error in the preparation of the call statement. 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)
    in 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)
    to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)
    # # 0 in detail
    java.sql.SQLException: the 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)
    in 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)
    to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)
    java.sql.SQLException: the 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)
    in 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)
    to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
    at java.lang.Thread.run(Thread.java:534)

    Published by: Rambeau on Oct 14, 2010 02:58

    check the code stuck by me again

    Connection Conn = pageContext.getApplicationModule (webBean) .getOADBTransaction () .getJdbcConnection ();

    Connection conn = oaapplicationmodule.getOADBTransaction().getJdbcConnection(); //Right one
    

    Thank you
    -Anil

  • Cannot display the results to the database during "Update": SQL statement

    Hello

    I get this error trying to update a VO via the UI or BCBrowser.

    Cannot display the results to the database during "Update": SQL statement

    This is a default single front & right THAT VO creates on the object of the entity (Database Table)

    On the same table and with the same credentials of DB, I could update the record.

    Any guess on what went wrong?

    Thanks in advance for any help.

    p.s Jdev 11.1.1.6

    Journal:

    oracle.jbo.DMLException: Houston-26041: could not publish data from database in "Update": SQL statement "START the CAR UPDATED CarEO SET SEL_ITEM =: 1 WHERE TXN_NO =: 2 AND LOGID =: AND SEQNO = 3: 4 POLL DELIVERY_MODE, CERTIFICATION_REQ, SOFT_COPY_IND, SELITEM IN: 5,: 6,: 7,: 8; END; ».

    at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:583)

    at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:8575)

    at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:6816)

    at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:3290)

    at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:3093)

    at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2097)

    at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2378)

    at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1615)

    at oracle.adf.model.binding.DCDataControl.callCommitTransaction(DCDataControl.java:1417)

    at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1437)

    at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2150)

    at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:740)

    at oracle.jbo.uicli.jui.JUActionBinding.actionPerformed(JUActionBinding.java:193)

    at oracle.jbo.uicli.controls.JUNavigationBar.doAction(JUNavigationBar.java:412)

    at oracle.jbo.jbotester.NavigationBar.doAction(NavigationBar.java:111)

    to oracle.jbo.uicli.controls.JUNavigationBar$ NavButton.actionPerformed (JUNavigationBar.java:118)

    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)

    in javax.swing.AbstractButton$ Handler.actionPerformed (AbstractButton.java:2318)

    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)

    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)

    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)

    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)

    at java.awt.Component.processMouseEvent(Component.java:6289)

    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)

    at java.awt.Component.processEvent(Component.java:6054)

    at java.awt.Container.processEvent(Container.java:2041)

    at java.awt.Component.dispatchEventImpl(Component.java:4652)

    at java.awt.Container.dispatchEventImpl(Container.java:2099)

    at java.awt.Component.dispatchEvent(Component.java:4482)

    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)

    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)

    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)

    at java.awt.Container.dispatchEventImpl(Container.java:2085)

    at java.awt.Window.dispatchEventImpl(Window.java:2478)

    at java.awt.Component.dispatchEvent(Component.java:4482)

    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)

    to java.awt.EventQueue.access$ 000 (EventQueue.java:85)

    in java.awt.EventQueue$ 1.run(EventQueue.java:603)

    in java.awt.EventQueue$ 1.run(EventQueue.java:601)

    at java.security.AccessController.doPrivileged (Native Method)

    in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)

    in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:98)

    in java.awt.EventQueue$ 2.run(EventQueue.java:617)

    in java.awt.EventQueue$ 2.run(EventQueue.java:615)

    at java.security.AccessController.doPrivileged (Native Method)

    in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)

    at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)

    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)

    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)

    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)

    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)

    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

    Caused by: java.sql.SQLException: invalid column type

    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterInternal(OracleCallableStatement.java:150)

    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:399)

    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:581)

    at oracle.jdbc.driver.OracleCallableStatementWrapper.registerOutParameter(OracleCallableStatementWrapper.java:1765)

    at oracle.jbo.server.OracleSQLBuilderImpl.bindUpdateStatement(OracleSQLBuilderImpl.java:2243)

    at oracle.jbo.server.EntityImpl.bindDMLStatement(EntityImpl.java:10524)

    at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:412)

    ... 52 more

    The problem is solved now.

    new columns added to the database table, after the creation of the entity object. Those changes were not picked up in the entity object.

    I found this difference after object entity with the DB Table comparison.

    And when I added these new columns to EO & VO, I don't get this error more.

    Thanks to all who tried to help

  • Trace is still get generated even after disabling the option of initializing SQL statement - Custom profile

    Hi all

    We have a problem with the profile option "initialize SQL statement - Custom." We put this at the user level. After awhile, we have erased the value of the this user profile option.

    But you can still see the trace files generated are getting updated. We checked this files trc pathname returned at the bottom of the query.

    Select name, value

    the parameter $ v

    WHERE name like 'user_dump_dest;

    Please help us on how to solve this problem. We use Oracle Apps R 12.1.2 version.

    Thanks in advance

    Rambaud

    Find the trace file creation session and kill this session

    HTH
    Srini

  • In SQL Developer, is it possible to send the results of a sql statement?

    In SQL Developer, is it possible to send the results of a sql statement?

    Right-click on the query results pane, select "Export data" in the context menu, then select "xls".

  • Using a Bind Variable in the FROM of a SQL statement part?

    Hi all

    I have a problem, I am trying to execute a SQL statement. However, I need the FROM part of the SQL statement in a variable binding. This is because the end user will have to choose between 2 views of database.

    I tried this:
    Select CON_ID from: P23_DB_NAME where CON_LEGACY_ID =: P23_CONLEG_NO

    I had no chance. The error I got was,
    '+ The query cannot be parsed in the generator. If you believe that your request is
    syntactically correct, choose the generic "columns" box below the
    the source of the region without analysis.
    "ORA-00903: invalid table name +".
    What makes sence, but now I'm a little stuck.

    Does anyone have ideas for a workaround?

    Thanks in advance.
    -N.S.N.O.

    The example I gave you is quite simple. You must take some time to study it to see where you need to be very careful what put you where. Now, of course your example does not work becaues you have several errors. It will work for you:

    DECLARE
       x   VARCHAR2 (4000);
    BEGIN
       x := x || 'SELECT CON_ID FROM ';
       x := x || :p23_db_name;
       x := x || ' WHERE CON_LEGACY_ID = ' || :p23_conleg_no;
       RETURN (x);
    END;
    

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • Zero error of iteration - the treatment of dynamic sql statements in dbms_xmlgen

    Hello

    I have a procedure that creates a dynamic sql v_sql

    cursor v_curr is
    Select *.
    of btctl_msg_log;

    BEGIN
    Select count (*) in the v_cnt of btctl_msg_log;

    IF v_cnt > 0 THEN
    C1 in v_curr
    LOOP
    v_sql: = "' | ' SELECT * from '. C1.msg_rcrd_src_tbl_nm | |' where rowid = ' | " ' ||'' ' || C1.msg_rcrd_src_tbl_id | " ' ||'' ' ||'' ' ;
    Select DBMS_XMLGEN.getXMLtype (v_sql) in the double v_xml;

    gives me an error

    ORA-19202: an error has occurred in the processing of XML
    ORA-24333: zero number of iterations
    ORA-06512: at "SYS." DBMS_XMLGEN", line 288
    ORA-06512: at line 1

    I don't know why is this error happening.
    Any help much appreciated.

    881575 wrote:
    Hello

    I have a procedure that creates a dynamic sql v_sql

    cursor v_curr is
    Select *.
    of btctl_msg_log;

    BEGIN
    Select count (*) in the v_cnt of btctl_msg_log;

    IF v_cnt > 0 THEN
    C1 in v_curr
    LOOP
    v_sql: = "' | ' SELECT * from '. C1.msg_rcrd_src_tbl_nm | |' where rowid = ' | " ' ||'' ' || C1.msg_rcrd_src_tbl_id | " ' ||'' ' ||'' ' ;
    Select DBMS_XMLGEN.getXMLtype (v_sql) in the double v_xml;

    gives me an error

    ORA-19202: an error has occurred in the processing of XML
    ORA-24333: zero number of iterations
    ORA-06512: at "SYS." DBMS_XMLGEN", line 288
    ORA-06512: at line 1

    I don't know why is this error happening.
    Any help much appreciated.

    Standard when boards (ab) use of EXECUTE IMMEDIATE is to compose the SQL statement in a single VARCHAR2 variable
    Then print the variable before passing to EXECUTE IMMEDIATE.
    COPY the statement & PASTE in sqlplus to validate its correctness.

  • SQL STATEMENT IS EXECUTED

    Hi all


    How oracle SQL statements executes? Someone can explain to me the works of instructions SELECT, INSERT, UPDATE, and COMMIT?


    Concerning

    Krishna

    Krishna,

    Search for Execution of the SQL statement and see the flowchart.
    http://download-West.Oracle.com/docs/CD/B19306_01/server.102/b14220/sqlplsql.htm

    -André

  • catch the collection returned by the function in a SQL statement

    I have a select like query: (I need all the values returned by the function in the select list)

    Select t1.col1, t2.col2, (by selecting t.a, t.b., t.c in fn (t2.col3) t)
    Of
    T1, t2
    where t1.col1 = t2.col2;



    My function is like:

    FN (T2.col3) returns an array in format of the object



    Here, I was able to select only one value from the table returned by the funcation both. If I select all of the values as above, she gave too much error vales.
    Please someone help me in this

    user13044793 wrote:
    I have a select like query: (I need all the values returned by the function in the select list)

    Select t1.col1, t2.col2, (by selecting t.a, t.b., t.c in fn (t2.col3) t)
    Of
    T1, t2
    where t1.col1 = t2.col2;

    No specific reason for this? It adds additional complexity to the projection of SQL, and there are additional costs of failover for the motor of PL/SQL (per line) of context. Overall - not your typical approach and one that should have sound justification.

    With regard to the basic method - the SQL multiset() function should be used to create a collection. Here is an example of the approach:

    SQL> create or replace type TFoo as object(
      2          id      number,
      3          bar     varchar2(5)
      4  );
      5  /
    
    Type created.
    
    SQL>
    SQL> create or replace type TFooSet as table of TFoo;
      2  /
    
    Type created.
    
    SQL>
    SQL> create or replace function GetSomeFoo( n number ) return TFooSet is
      2          foo     TFooSet;
      3  begin
      4          foo := new TFooSet();
      5          foo.Extend( 5 );
      6
      7          for i in 1..5
      8          loop
      9                  foo(i) := new TFoo( n+i-1, to_char(i-1,'0000') );
     10          end loop;
     11
     12          return( foo );
     13  end;
     14  /
    
    Function created.
    
    SQL>
    SQL> select
      2          object_id,
      3          object_name,
      4          cast(
      5                  multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
      6          )       as FOO
      7  from       all_objects
      8  where      owner = 'SYS'
      9  and        rownum <= 5;
    
     OBJECT_ID OBJECT_NAME                    FOO(ID, BAR)
    ---------- ------------------------------ --------------------------------------------------
         27538 /1000e8d1_LinkedHashMapValueIt TFOOSET(TFOO(27538, ' 0000'), TFOO(27539, ' 0001')
                                              , TFOO(27540, ' 0002'), TFOO(27541, ' 0003'), TFOO
                                              (27542, ' 0004'))
    
         28544 /1005bd30_LnkdConstant         TFOOSET(TFOO(28544, ' 0000'), TFOO(28545, ' 0001')
                                              , TFOO(28546, ' 0002'), TFOO(28547, ' 0003'), TFOO
                                              (28548, ' 0004'))
    
         11718 /10076b23_OraCustomDatumClosur TFOOSET(TFOO(11718, ' 0000'), TFOO(11719, ' 0001')
                                              , TFOO(11720, ' 0002'), TFOO(11721, ' 0003'), TFOO
                                              (11722, ' 0004'))
    
         30094 /100c1606_StandardMidiFileRead TFOOSET(TFOO(30094, ' 0000'), TFOO(30095, ' 0001')
                                              , TFOO(30096, ' 0002'), TFOO(30097, ' 0003'), TFOO
                                              (30098, ' 0004'))
    
        684122 /1023e902_OraCharsetUTFE       TFOOSET(TFOO(684122, ' 0000'), TFOO(684123, ' 0001
                                              '), TFOO(684124, ' 0002'), TFOO(684125, ' 0003'),
                                              TFOO(684126, ' 0004'))
    
    SQL>
    SQL> with dataset as(
      2          select
      3                  object_id,
      4                  object_name,
      5                  cast(
      6                          multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
      7                  )                as FOO
      8          from    all_objects
      9          where   owner = 'SYS'
     10          and     rownum <= 5
     11  )
     12  select
     13          d.object_id,
     14          d.object_name,
     15          f.id,
     16          f.bar
     17  from   dataset d,
     18          table(d.foo) f
     19  /
    
     OBJECT_ID OBJECT_NAME                            ID BAR
    ---------- ------------------------------ ---------- ---------------
           217 DUAL                                  217  0000
           217 DUAL                                  218  0001
           217 DUAL                                  219  0002
           217 DUAL                                  220  0003
           217 DUAL                                  221  0004
           268 SYSTEM_PRIVILEGE_MAP                  268  0000
           268 SYSTEM_PRIVILEGE_MAP                  269  0001
           268 SYSTEM_PRIVILEGE_MAP                  270  0002
           268 SYSTEM_PRIVILEGE_MAP                  271  0003
           268 SYSTEM_PRIVILEGE_MAP                  272  0004
           271 TABLE_PRIVILEGE_MAP                   271  0000
           271 TABLE_PRIVILEGE_MAP                   272  0001
           271 TABLE_PRIVILEGE_MAP                   273  0002
           271 TABLE_PRIVILEGE_MAP                   274  0003
           271 TABLE_PRIVILEGE_MAP                   275  0004
           274 STMT_AUDIT_OPTION_MAP                 274  0000
           274 STMT_AUDIT_OPTION_MAP                 275  0001
           274 STMT_AUDIT_OPTION_MAP                 276  0002
           274 STMT_AUDIT_OPTION_MAP                 277  0003
           274 STMT_AUDIT_OPTION_MAP                 278  0004
           815 RE$NV_LIST                            815  0000
           815 RE$NV_LIST                            816  0001
           815 RE$NV_LIST                            817  0002
           815 RE$NV_LIST                            818  0003
           815 RE$NV_LIST                            819  0004
    
    25 rows selected.
    
    SQL>
    
  • the analysis of this sql help

    Hello

    I need help in the analysis of this query effectively

    Field1, Field2
    1, a
    2, a
    b 3,
    b 3,
    4, c.


    I want my query to return 1, a and 2 a because Field2 appeared several times with different values of field1. Please advice. It is a discrepancy report.
    WITH tab AS
      ( SELECT 1 field1,'a' field2 FROM dual
    UNION ALL
       SELECT 2 field1, 'a' field2 FROM dual
    UNION ALL
       SELECT 3 field1, 'b' field2 FROM dual
    UNION ALL
       SELECT 3 field1, 'b' field2 FROM dual
    UNION ALL
       SELECT 4 field1, 'c' field2 FROM dual
      )
     SELECT field1,
      field2
       FROM
      (SELECT field1                                ,
        field2                                      ,
        COUNT(field1) over (partition BY field2) cn1,
        COUNT(DISTINCT field1) over (partition BY field2) cn2
         FROM tab
      )
      WHERE cn1=cn2 and cn1!=1
    

    Ravi Kumar

  • Error in the SQL statement when executing ETL of DAC

    Hi all

    I have installed and configured the 7.9.6.3 biapps, then I run the full load of the CRM - loyalty in DAC topic. And I got the error task failed, I check the Session to the Informatica server log files.

    view of $ SEBL_VERT_811.DATAWAREHOUSE. SDE_SBL_Vert_811_Adaptor.SDE_GeographyDimension_Business.log

    DIRECTOR > use VAR_27028 replace value [0] for the variable defined by the workflow/worklet user: [$passInStatus].
    DIRECTOR > VAR_27028 use override the value [DataWarehouse] session parameter: [$DBConnection_OLAP].
    DIRECTOR > VAR_27028 use override the value [SEBL_VERT_811] for the session parameter: [$DBConnection_OLTP].
    DIRECTOR > VAR_27028 use override the value [SEBL_VERT_811.DATAWAREHOUSE. SDE_SBL_Vert_811_Adaptor.SDE_GeographyDimension_Business.log] for the session parameter: [$PMSessionLogFile].
    DIRECTOR > VAR_27028 use override value [1] to parameter mapping: [MPLT_LOAD_W_GEO_DS. [DATASOURCE_NUM_ID$ $].
    DIRECTOR > VAR_27028 use override value for the parameter mapping]: [$$ Hint1].
    DIRECTOR > VAR_27028 use override value for the parameter mapping]: [$$ council2].
    DIRECTOR > session initialization of TM_6014 [SDE_GeographyDimension_Business] to [my Jul 25 17:29:47 2011].
    DIRECTOR > name of the repository TM_6683: [Oracle_BI_DW_Base]
    DIRECTOR > TM_6684 server name: [Oracle_BI_DW_Server]
    DIRECTOR > TM_6686 folder: [SDE_SBL_Vert_811_Adaptor]
    DIRECTOR > Workflow TM_6685: [SDE_GeographyDimension_Business] run the Instance name: Id series []: [260]
    DIRECTOR > mapping TM_6101 name: SDE_GeographyDimension_Business [version 1].
    DIRECTOR > TM_6963 pre 85 Timestamp compatibility is enabled
    DIRECTOR > the TM_6964 Date of the Session format is [HH24:MI:SS DD/MM/YYYY]
    DIRECTOR > TM_6827 [u01/app/oracle/biapps/dev/Informatica/9.0.1/server/infa_shared/Storage] will be used as the storage of session directory [SDE_GeographyDimension_Business].
    DIRECTOR > CMN_1802 Session recovery cache initialization is complete.
    DIRECTOR > configuration using [DisableDB2BulkMode, Yes] TM_6708 property
    DIRECTOR > configuration using TM_6708 [ServerPort, 6325] property
    DIRECTOR > configuration using [overrideMpltVarWithMapVar Yes] TM_6708 property
    DIRECTOR > configuration using TM_6708 [SiebelUnicodeDB,SIEBEL@ANSDEV dwhadmin@ANBDEV] property

    DIRECTOR > TM_6703 Session [SDE_GeographyDimension_Business] is headed by 64-bit integration Service [node01_hkhgc01dvapp01], [version9.0.1 HotFix2], build [1111].
    MANAGER > PETL_24058 Running score of the Group [1].
    MANAGER > initialization of engine PETL_24000 of parallel Pipeline.
    MANAGER > PETL_24001 parallel Pipeline engine running.
    MANAGER > session initialization PETL_24003 running.
    MAPPING > CMN_1569 Server Mode: [UNICODE]
    MAPPING > code page of the server CMN_1570: [Unicode UTF-8 encoding]
    MAPPING > TM_6151 the session to the sort order is [binary].
    MAPPING > TM_6185 warning. Code page validation is disabled in this session.
    MAPPING > treatment of low accuracy using TM_6156.
    MAPPING > retry TM_6180 blocking logic will not apply.
    MAPPING > TM_6187 Session focused on the target validation interval is [10000].
    MAPPING > TM_6307 DTM error log disabled.
    MAPPING > TE_7022 TShmWriter: initialized
    MAPPING > DBG_21075 connection to the database [ANBDEV], [dwhadmin] users
    MAPPING > Search CMN_1716 [MPLT_LOAD_W_GEO_DS. LKP_W_LST_OF_VAL_G] uses the connection to database [relational: DataWarehouse] in [UTF-8 encoding Unicode] code page
    MAPPING > Search CMN_1716 [MPLT_LOAD_W_GEO_DS. LKP_W_GEO_DS] uses the connection to database [relational: DataWarehouse] in [UTF-8 encoding Unicode] code page
    MAPPING > DBG_21694 AGG_COUNTRY_CITY_ZIPCODE [0] Partition: size = [1048576] Index cache, data cache size = [2097152]
    MAPPING > TE_7212 increasing [Cache of Index] size of transformation [AGG_COUNTRY_CITY_ZIPCODE] of [1048576] to [2402304].
    MAPPING > TE_7212 increasing [Cache data] size of transformation [AGG_COUNTRY_CITY_ZIPCODE] of [2097152] to [2097528].
    MAPPING > TE_7029 aggregate information: create the new Index and data files
    MAPPING > TE_7034 aggregate information: Index file is [u01/app/oracle/biapps/dev/Informatica/9.0.1/server/infa_shared/Cache/PMAGG14527_3_0_260.idx]
    MAPPING > information aggregated TE_7035: data file is [u01/app/oracle/biapps/dev/Informatica/9.0.1/server/infa_shared/Cache/PMAGG14527_3_0_260.dat]
    MAPPING > TM_6007 DTM initialized successfully for the session [SDE_GeographyDimension_Business]
    DIRECTOR > PETL_24033 all the DTM connection information: [< NO >].
    MANAGER > PETL_24004 from the tasks before the session. : (My Jul 25 17:29:47 2011)
    MANAGER > task PETL_24027 before the session completed successfully. : (My Jul 25 17:29:47 2011)
    DIRECTOR > PETL_24006 from data movement.
    MAPPING > Total TM_6660 Buffer Pool size is 36000000 bytes and block size is 128000 bytes.
    LKPDP_2 > search for DBG_21097 Transformation [MPLT_LOAD_W_GEO_DS. LKP_W_GEO_DS]: default sql to create the cache of research: SELECT CITY, COUNTRY, POSTAL code, STATE_PROV OF W_GEO_DS of the ORDER BY CITY, COUNTRY, POSTAL code, STATE_PROV

    LKPDP_1 > search for DBG_21312 Transformation [MPLT_LOAD_W_GEO_DS. LKP_W_LST_OF_VAL_G]: search replace sql to create the cache: SELECT W_LST_OF_VAL_G.VAL AS VAL, W_LST_OF_VAL_G.R_TYPE AS R_TYPE FROM W_LST_OF_VAL_G
    WHERE
    W_LST_OF_VAL_G.R_TYPE LIKE '% ETL' ORDER BY R_TYPE, VAL

    LKPDP_1 > TE_7212 increasing [Cache of Index] size of transformation [MPLT_LOAD_W_GEO_DS. LKP_W_LST_OF_VAL_G] of [1048576] to [1050000].
    LKPDP_2 > TE_7212 increasing [Cache of Index] size of transformation [MPLT_LOAD_W_GEO_DS. LKP_W_GEO_DS] of [20000000] to [20006400].
    LKPDP_2 > TE_7212 increasing [Cache data] size of transformation [MPLT_LOAD_W_GEO_DS. LKP_W_GEO_DS] of [20000000] to [20004864].
    READER_1_1_1 > DBG_21438 Reader: Source is [ANSDEV], [SIEBEL] users
    READER_1_1_1 > code page Source of BLKR_16051 database connection [SEBL_VERT_811]: [Unicode UTF-8 encoding]
    READER_1_1_1 > BLKR_16003 initialization completed successfully.
    WRITER_1_ * _1 > WRT_8146 author: target's database [ANBDEV], user [dwhadmin], loose [on] mode
    WRITER_1_ * _1 > WRT_8106 WARNING! Session Mode Bulk - recovery is not guaranteed.
    WRITER_1_ * _1 > code page target database connection [Data Warehouse] WRT_8221: [Unicode UTF-8 encoding]
    WRITER_1_ * _1 > target WRT_8124 W_GEO_DS of Table: SQL INSERT statement:
    INSERT INTO W_GEO_DS(CITY,CONTINENT,COUNTRY,COUNTY,STATE_PROV,ZIPCODE,DATASOURCE_NUM_ID,X_CUSTOM) VALUES (?,?,?,?,?,?,?,?)
    WRITER_1_ * _1 > WRT_8020 No. column that is marked as the primary key for the table [W_GEO_DS]. Updates not supported.
    WRITER_1_ * _1 > connection WRT_8270 #1 target group consists of target (s) [W_GEO_DS]
    WRITER_1_ * _1 > WRT_8003 writer initialization complete.
    READER_1_1_1 > BLKR_16007 player run began.
    WRITER_1_ * _1 > WRT_8005 writer run began.
    WRITER_1_ * _1 > WRT_8158

    START SUPPORT SESSION *.

    Startup load time: my Jul 25 17:29:47 2011

    Target table:

    W_GEO_DS


    READER_1_1_1 > RR_4029 SQ [SQ_S_ADDR_ORG] User Instance specified SQL query [SELECT DISTINCT
    S_ADDR_ORG. CITY,
    S_ADDR_ORG. COUNTRIES,
    S_ADDR_ORG. COUNTY,
    S_ADDR_ORG. PROVINCE,
    S_ADDR_ORG. STATE,
    S_ADDR_ORG. Zip code
    '0' AS X_CUSTOM
    Of
    V_ADDR_ORG, S_ADDR_ORG
    ]
    READER_1_1_1 > RR_4049 SQL query sent to the database: (my Jul 25 17:29:47 2011)
    READER_1_1_1 > CMN_1761 Timestamp event: [lun 25 juil 17:29: 47 2011]
    READER_1_1_1 > RR_4035 SQL Error]
    ORA-00942: table or view does not exist

    Database driver error...
    Function name: run
    Stmt SQL: SELECT DISTINCT
    S_ADDR_ORG. CITY,
    S_ADDR_ORG. COUNTRIES,
    S_ADDR_ORG. COUNTY,
    S_ADDR_ORG. PROVINCE,
    S_ADDR_ORG. STATE,
    S_ADDR_ORG. Zip code
    '0' AS X_CUSTOM
    Of
    V_ADDR_ORG, S_ADDR_ORG

    Fatal error Oracle
    Database driver error...
    Function name: run
    Stmt SQL: SELECT DISTINCT
    S_ADDR_ORG. CITY,
    S_ADDR_ORG. COUNTRIES,
    S_ADDR_ORG. COUNTY,
    S_ADDR_ORG. PROVINCE,
    S_ADDR_ORG. STATE,
    S_ADDR_ORG. Zip code
    '0' AS X_CUSTOM
    Of
    V_ADDR_ORG, S_ADDR_ORG

    [Error fatal Oracle].
    READER_1_1_1 > CMN_1761 Timestamp event: [lun 25 juil 17:29: 47 2011]
    READER_1_1_1 > BLKR_16004 ERROR: prepare failed.
    WRITER_1_ * _1 > WRT_8333 roll back all the targets due to the fatal error of session.
    WRITER_1_ * _1 > rollback WRT_8325 Final, executed for the target [W_GEO_DS] at end of load
    WRITER_1_ * _1 > WRT_8035 of full load time: my Jul 25 17:29:47 2011

    SUMMARY OF THE LOAD
    ============

    WRT_8036 target: W_GEO_DS (Instance name: [W_GEO_DS])
    WRT_8044 responsible for this target data no.



    WRITER_1__1 > WRT_8043 * END LOAD SESSION *.
    MANAGER > PETL_24031
    PERFORMANCE INFORMATION FOR TGT SUPPORT ORDER [1] GROUP, SIMULTANEOUS GAME [1] *.
    Thread [READER_1_1_1] created [stage play] point score [SQ_S_ADDR_ORG] is complete. Running time total was enough for significant statistics.
    [TRANSF_1_1_1] thread created for [the scene of transformation] partition has made to the point [SQ_S_ADDR_ORG]. Running time total was enough for significant statistics.
    [TRANSF_1_2_1] thread created for [the scene of transformation] partition has made to the point [AGG_COUNTRY_CITY_ZIPCODE]. Running time total was enough for significant statistics.
    Thread [WRITER_1_ * _1] created for [the scene of writing] partition has made to the point [W_GEO_DS]. Running time total was enough for significant statistics.

    MAPPING > CMN_1791 size which would take [0] groups total lines of entry for [AGG_COUNTRY_CITY_ZIPCODE], in memory, it is [0] index cache bytes
    MAPPING > CMN_1790 cached data size that would [0] groups total lines of entry for [AGG_COUNTRY_CITY_ZIPCODE], in memory, bytes [0]
    MAPPING > CMN_1793 index cache size which would hold [0] lines in the table to search for [MPLT_LOAD_W_GEO_DS. LKP_W_LST_OF_VAL_G], in memory, is bytes [0]
    MAPPING > CMN_1792 cached data size that would [0] lines in the table to search for [MPLT_LOAD_W_GEO_DS. LKP_W_LST_OF_VAL_G], in memory, is bytes [0]
    MAPPING > CMN_1793 index cache size which would hold [0] lines in the table to search for [MPLT_LOAD_W_GEO_DS. LKP_W_GEO_DS], in memory, is bytes [0]
    MAPPING > CMN_1792 cached data size that would [0] lines in the table to search for [MPLT_LOAD_W_GEO_DS. LKP_W_GEO_DS], in memory, is bytes [0]
    MANAGER > PETL_24005 from tasks after the session. : (My Jul 25 17:29:47 2011)
    MANAGER > task of PETL_24029 after the session completed successfully. : (My Jul 25 17:29:47 2011)
    MAPPING > cache TE_7216 deleting files [PMLKUP14527_524289_0_260L64] for processing [MPLT_LOAD_W_GEO_DS. LKP_W_LST_OF_VAL_G].
    MAPPING > cache TE_7216 deleting files [PMLKUP14527_524293_0_260L64] for processing [MPLT_LOAD_W_GEO_DS. LKP_W_GEO_DS].
    MAPPING > TM_6018 the session completed with errors of processing row [0].
    MANAGER > TE_7216 deleting files cache [u01/app/oracle/biapps/dev/Informatica/9.0.1/server/infa_shared/Cache/PMAGG14527_3_0_260.idx] for [AGG_COUNTRY_CITY_ZIPCODE] transformation.
    MANAGER > TE_7216 deleting files cache [u01/app/oracle/biapps/dev/Informatica/9.0.1/server/infa_shared/Cache/PMAGG14527_3_0_260.dat] for [AGG_COUNTRY_CITY_ZIPCODE] transformation.
    MANAGER > parallel PETL_24002 engine Pipeline completed.
    DIRECTOR > Session PETL_24013 run duly filled with failure.
    DIRECTOR > TM_6022

    PLENARY OF THE LOAD
    ================================================

    DIRECTOR > TM_6252 Source load summary.
    DIRECTOR > Table CMN_1740: [SQ_S_ADDR_ORG] (name of the Instance: [SQ_S_ADDR_ORG])
    Output [0] lines, affected lines [0], applied [0] lines, rejected lines [0]
    DIRECTOR > TM_6253 Target Load summary.
    DIRECTOR > Table CMN_1740: [W_GEO_DS] (name of the Instance: [W_GEO_DS])
    Output [0] lines, affected lines [0], applied [0] lines, rejected lines [0]
    DIRECTOR > TM_6023
    ===================================================

    DIRECTOR > TM_6020 Session [SDE_GeographyDimension_Business] to [my Jul 25 17:29:48 2011].


    After reviewing the log, I found the select statement fails, the SQL below was wrong:

    SELECT DISTINCT
    S_ADDR_ORG. CITY,
    S_ADDR_ORG. COUNTRIES,
    S_ADDR_ORG. COUNTY,
    S_ADDR_ORG. PROVINCE,
    S_ADDR_ORG. STATE,
    S_ADDR_ORG. Zip code
    '0' AS X_CUSTOM
    Of
    V_ADDR_ORG, S_ADDR_ORG

    There is no V_ADDR_ORG but the table S_ADDR_ORG in the transaction of Siebel database. So I don't know why he build this sql when data transfer to OBAW. It is the fate of bi box app.

    Experts! How could I solve this problem? Please help, thanks a lot!


    Best regards
    Ryan

    Ryan,

    Yes, you missed to create views for the source tables. both in the design of dac > tables tab, select any table and clieck right on it and then click capture of change scripts > generate scripts from view. It will ask you if it can generate a script for all tables. so it will generate the script from view for you. now run the whole esript in the source database. then your problem will be solved.

    If this answers your question. do my correct answer.

    Thank you
    Jay.

  • Under certain conditions, update a table based on the comparison with a SQL statement

    I have a table (table 1) that has 4 columns:

    UID. THE NEST | VALUE1 | VALUE2

    I have another statement SQL (STMT) that returns the 3 columns of a few other tables:

    UID. THE NEST | VALUE1

    Now this is the condition of the way in which I want to put up-to-date TABLE1:

    First, to compare a pair of UID and PID of STMT with those in TABLE1,

    -1, for any new pair UID and PID not in TABLE1, insert a new line of STMT in TABLE1 set TABLE1. Value2 = 0 (I already did this).

    2, for an existing UID and PID pair in STMT and TABLE1, do:

    a. in TABLE1. Value2 > 0, update TABLE1. VALUE1 = STMT. VALUE1

    b. to TABLE1. Value2 = 0 and if TABLE1. VALUE1! = STMT. Value1, update of TABLE1. VALUE1 = STMT. Value1, otherwise nothing to do.

    I can't seem to come with a solution for condition 2. Any help is appreciated!

    Hello

    Here's one way:

    MERGE INTO  table1  dst
    USING          (
                 SELECT  ...   -- your stmt query goes here
             )   src
    ON         (    src.uid  = dst.uid
             AND      src.pid  = dst.pid
             )
    WHEN MATCHED THEN UPDATE
    SET           dst.value1 = CASE
                                   WHEN   dst.value2 > 0
                        OR     (   dst.value2 = 0
                             AND dst.calue1 != src.value1
                        )
                        THEN   src.value1
                               END
    WHERE   dst.value2 > 0
    OR (    dst.value2 = 0
       AND  dst.calue1 != src.value1
       )
    ;
    

    This assumes that the combination (uid, pid) is unique in stmt. It doesn't have to be unique in table1.

    sb92075 wrote:

    -1, for any new pair UID and PID not in TABLE1, insert a new line of STMT in TABLE1 set TABLE1. Value2 = 0 (I already did this).

    FUSION could also do parts 1 and 2 together, in the same statement.

    2, for an existing UID and PID pair in STMT and TABLE1, do:

    a. in TABLE1. Value2 > 0, update TABLE1. VALUE1 = STMT. VALUE1

    b. to TABLE1. Value2 = 0 and if TABLE1. VALUE1! = STMT. Value1, update of TABLE1. VALUE1 = STMT. Value1, otherwise nothing to do.

    Why are they not simply your needs ' uid and pid that already exist in stmt and table1, if table1.value2 > = 0, then the value table1.value1 = stmt.value1 "? Are you concerned about shooting triggers unnecessarily? It has something to do with null values? The MERGE statement above does exactly what you asked, but, depending on your needs, something simpler and more efficient could do it as well.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    See the FAQ forum {message identifier: = 9360002}

    Published by: Frank Kulash, June 6, 2012 14:51

  • Helps with the syntax of dynamic sql statements

    Hi all
    How can I pass the value of the result of my dynamic select statement to a Ref Cursor?
    I try the following statement but does not work, I get this error:
    ORA-00932: inconsistent data types: expected - was - ORA-06512: at
    Procedure getItems(v_first In number, v_second In Number, arg_Cursor IN OUT CUSTOM_REF_CURSOR) is
         sqlString varchar(3000);
         Begin
           sqlString := 'select* from bla where o.arg_1 = :1 and arg_2 = :2'; 
       
           execute immediate sqlString 
           into arg_Cursor
           using v_first, v_second;
       End getItems;
    Any ideas?
    Thank you

    Johnny
    PROCEDURE getitems (v_first IN NUMBER, v_second IN NUMBER, arg_cursor IN OUT sys_refcursor)
    IS
      sqlstring   VARCHAR (3000);
    BEGIN
      sqlstring := 'select* from bla where o.arg_1 = :1 and arg_2 = :2';
    
      OPEN arg_cursor FOR sqlstring USING v_first, v_second;
    END getitems;
    
  • normalize the schema of the table in a select statement (without view)

    Hello

    I have a table storing a physical value, mean temperature for different locations every minute. The table schema is as following: timestamp (datetime), rental (string), value (number).

    Do you know a way to have a select statement, return of lines with the following data: timestamp, the value at location1, value of place.2 guests, etc.

    This will help me to create time series in he same diagram in my reporting tool.

    This may be possible with a view, but I don't have access to the database, the best I can do is set my a data source such as a select statement.

    Thank you!

    Brahim

    PS. We use Oracle 10 g R2

    Hello

    8e07ad81-CDAE-4c23-b0fb-b6cd117cf5bc wrote:

    Hello

    I have a table storing a physical value, mean temperature for different locations every minute. The table schema is as following: timestamp (datetime), rental (string), value (number).

    Do you know a way to have a select statement, return of lines with the following data: timestamp, the value at location1, value of place.2 guests, etc.

    This will help me to create time series in he same diagram in my reporting tool.

    This may be possible with a view, but I don't have access to the database, the best I can do is set my a data source such as a select statement.

    Thank you!

    Brahim

    PS. We use Oracle 10 g R2

    What you're asking about is called pivoting.  The ahs Forum FAQ page devoted to this topic: Re: 4. How can I convert rows to columns?

    Since you're using Oracle 10, you cannot use the SELECT... Function PIVOT; You can use GROUP BY and CASE instead.

    Do ' t worry not about creating views.  What you can do with views, you can also do it using a WITH clause in your query.

    If you get stuck, please post some sample data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also to publish the results you want from this data, as well as your best attempt to query a specific question.

    Explain, using specific examples, how you get the results desired from data provided.

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

  • The collection of Pl/SQL statement-

    Hello

    Can we declare pl/sql outside of a package, and according to a specific schema collections?
    Creates an object the right way. Please correct me if wrong.


    Thank you
    Goussard

    Hi guy,
    You can try like this...

    You can use PL/SQL in objects that are defined outside a PL/SQL package!! Use object bodies:
    CREATE TYPE person_typ AS OBJECT (
      idno           NUMBER,
      first_name     VARCHAR2(20),
      last_name      VARCHAR2(25),
      email          VARCHAR2(25),
      phone          VARCHAR2(20),
      MAP MEMBER FUNCTION get_idno RETURN NUMBER,
      MEMBER PROCEDURE display_details ( SELF IN OUT NOCOPY person_typ ));
    /
    
    CREATE TYPE BODY person_typ AS
      MAP MEMBER FUNCTION get_idno RETURN NUMBER IS
      BEGIN
        RETURN idno;
      END;
      MEMBER PROCEDURE display_details ( SELF IN OUT NOCOPY person_typ ) IS
      BEGIN
        -- use the PUT_LINE procedure of the DBMS_OUTPUT package to display details
        DBMS_OUTPUT.PUT_LINE(TO_CHAR(idno) || ' ' || first_name || ' ' || last_name);
        DBMS_OUTPUT.PUT_LINE(email || ' '  || phone);
      END;
    END;
    /
    

    Kind regards
    Symph.

Maybe you are looking for