Oracle Types

Hello,
I have a little strange question about oracle types.
I am planing to put basic operations of insert,update and delete in types as objects. Now my question is this. Is there a way to update objects and its procedures for insert,update and delete, as table structure changes(I delete one column and insert in procedure would no longer contain that column ). Entity framework does something similar in Visual Studio, but I would like to do this directly inside database. Thx

For example, I have procedure inside my type, that insert data in it. Now, I delete one column from my table. Is there a way to automaticly update and compile my procedure in type, so it no longer have deleted column inside of tis insert

Similar Messages

  • Java Vector to Oracle type; help?

    I've seen only a few postings on this topic, none of which were answered. So I am thinking perhaps a detailed explanation is required? Or is it just too simple to be beyond boring? I need professional help in any event.
    I have an applet users employ to create a table of values. The data model for the table is, ultimately, a Vector, each element of which is itself a Vector with the following fields (all of which are Strings): symbol, label, description, colour, numpar, parent, parsing, objectid. So, I have a Vector of any length comprised of Vectors of length 8.
    On pressing the "SAVE" button I wish the Vector of Vectors to be sent to my Oracle database. To receive the data I created these types in Oracle:
    TYPE LegendItem IS OBJECT(symbol VARCHAR2(50),
    label VARCHAR2(50),
    descrip VARCHAR2(255),
    colour VARCHAR2(20),
    numpar VARCHAR2(10),
    parent VARCHAR2(10),
    parsing VARCHAR2(625),
    objectid VARCHAR2(10));
    TYPE AppletVector IS TABLE OF LegendItem INDEX BY BINARY_INTEGER;
    The stored procedure that takes the data and uses it to update (about 25) tables in the schema is defined as
    PROCEDURE loadLegend (legendata IN AppletVector,
                   schemeid IN INTEGER,
                   sourceid IN INTEGER,
                   message OUT VARCHAR2)
    (Message is returned as "success" if there are no exceptions, or the exception parameters if they exist.)
    I am trying
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    Connection conx_out = DriverManager.getConnection ("jdbc:oracle:thin:@myserveraddress","username", "password");
    CallableStatement feedOra = conx_out.prepareCall("{ call newLegendData.loadLegend(?,?,?,?) }");
    ArrayDescriptor arrDesc = ArrayDescriptor.createDescriptor("AppletVector", conx_out);
    feedOra.setArray(1, new ARRAY(arrDesc, conx_out, legendModel.getDataVector().toArray()));
    feedOra.setString(2, MakeLegend.mapScheme);
    feedOra.setString(3, MakeLegend.mapSource);
    feedOra.registerOutParameter(4, Types.VARCHAR);
    feedOra.execute();which returns
    setArray(int,java.sql.Array) in java.sql.PreparedStatement cannot be applied to (int,oracle.sql.ARRAY)
    feedOra.setArray(1, new ARRAY(arrDesc, conx_out, legendModel.getDataVector().toArray()));
    ^
    cannot resolve symbol
    symbol : method setString (int,int)
    location: interface java.sql.CallableStatement
                   feedOra.setString(2, MakeLegend.mapScheme);
    ^
    cannot resolve symbol
    symbol : method setString (int,int)
    location: interface java.sql.CallableStatement
                   feedOra.setString(3, MakeLegend.mapSource);
    Is this the way to approach the problem? Should I use a different method? How do I make java.sql.Array == oracle.sql.ARRAY?
    Your suggestions are gratefully received.

    Not a problem, the code will below is the basics
    // the vector of vectors you are going to write.
    Vector aVectorOfVectors;
    // create a ByteArrayOutputStream so you can get the data to create an inout stream
    ByteArrayOutputStream aBaos=new ByteArrayOutputStream();
    // make an objectOutputStream to write your searlizable to.
    ObjectOutputStream anOut = new ObjectOutputStream(aBaos);
    // write your vector of vectors
    anOut.writeObject(anObject);
    // get the byte array from the ByteArrayOutputStream
    byte[]aByteArray = aBaos.toByteArray();
    // create the input stream from the byte array
    ByteArrayInputStream aBais = new ByteArrayInputStream(aByteArray);
    // set this as the binary stream for your column.
    insertPreparedStatement.setBinaryStream(aColumn,  aBais, aByteArray.length);when reading the data you basically do the reverse and cast the result
    ObjectInputStream anInputStream = new ObjectInputStream( theResultSet.getBinaryStream(aColumn));
    Vector aVectorOfVectors = (Vector) anInputStream.readObject();

  • Generate Java class from Oracle Type defined in Package w/ JPublisher

    I was wondering if its possible to generate a Java class for an Oracle Type defined in a Package? I know passing the package name to JPublisher (SQL <package_name>) causes all Oracle Types in the Package to have a Java class generated for them but I'd like to be able to do this for an individual Type defined in a Package (something like SQL <package_name>.<type_name>).
    Thanks for any information you can give me.

    Hi Marinel,
    The support for XSD import is limited on 10.1.2. If you can, you should consider moving to the 10.1.3 preview as the support for document style web services has improved. The other option will be to inline the schema in your WSDL.
    Eric.

  • Convert type dats to oracle type date

    Hi guys,
    I have abap field
    data: begin of itab occurs 0,
            dat type dats,
    end of itab.
    how can I convert abap field dat into oracle type DATE, so I can insert dat into that oracle field?
    thanks,
    nihad
    Edited by: nihad omerbegovic on Mar 25, 2009 5:47 PM

    Thanks for suggestion, now I got different error
    Database error text........: "ORA-01858: a non-numeric character was found
    where a numeric was expected#"             
    When I debugg I have some unxpected field values in internal table itab:
    DAT      USNAM        NOVI                                              
    X2009032|0NIHADOM     |                                                   
    X2009032|0NIHADOM     |                                                                               
    But, it should be like this
    DAT      USNAM        NOVI                                              
    20090320|NIHADOM     |X
    20090320|NIHADOM     |X       
    Any idea why I got indicator X in DAT field but it should be in NOVI. Is that why I got above error?
    Thnaks,
    Nihad

  • JPUBLISHER ORACLE TYPES

    I use jpublisher in my j2ee aplication.
    i change de presicion in a oracle type
    create or replace type x as object (
    field1 number(3)
    create or replace type x_array as table of x
    to
    create or replace type x as object (
    field number(2)
    create or replace type x_array as table of x
    my class generated by the jpublisher not change.
    but my aplication j2ee crash with the error ORA-00902: invalid datatype
    when use a x_array
    reinstalling the aplication not work
    the only way in this that work is restarting the application server
    Any idea why i need restart the application server?
    thank in advance

    Diaz,
    When you change any database object, like triggers, stored routines or types, the database connection pool used by OC4J cannot pick these up. Hence you need to reset OC4J's connection pool and the only way to do that is by restarting OC4J.
    Nonetheless I recall reading somewhere that this problem has been (or will be) rectified.
    Possibly you need to upgrade your version of OC4J?
    Good Luck,
    Avi.

  • Returning Oracle Types & Performance

    Hi,
    We have a J2EE based application that makes a call to an Oracle stored procedure. This stored procedure then runs some SQL and forms a return oracle type (that in turn contains nested types) and returns this type back to the java realm.
    We are facing enormous performance issues with this as it takes about 50-60 seconds from the time the user clicks on a certain link in the application to the time when he see's the result on a subsequent screen. We have timed the stored procedure execution times and most of the stored procedures are running within 5 seconds. One of the java guru's in our project ran a JProbe analysis and says that once the java gets the result object, it still is making calls to oracle to retrieve the nested object and hence the performance degradation.
    Has anyone encountered such a problem and/or if some one can explain as to what is happening behind the scenes?
    Best Regards,
    Ram

    Although, having an imagination of about what might be more efficient, I don't want to offer ready to use information, however you can easily try corresponding tests using runstats_pkg.
    http://asktom.oracle.com/tkyte/runstats.html
    Using this package, you can compare two different implementations.
    Just use the following steps:
    1) call runstats_pkg.rs_start
    2) try your test implementation using your first alternative
    3) call runstats_pkg.rs_middle
    4) try your test implementation using your second alternative
    5) call runstats_pkg.rs_stop
    The stop procedure evaluates the differences and generates a correpsonding report.

  • Suggestion: Why not implement IConvertible in oracle types

    Hi,
    I'm thinking that it will be better to implement IConvertible interface in all oracle types : OracleDecimal, OracleDate, OracleString ...
    And instead of using .Value, .ToInt32() .... to use Convert.ToInt64(reader.GetOracleDecimal(0));
    Thanks

    Hi,
    Your suggestion may get better visibility if you put it on the feature request page: http://forums.oracle.com/forums/ann.jspa?annID=1593
    Hope it helps,
    Greg

  • Problem with setting oracle type parameter in viewobject query

    Hi There,
    I am facing a problem with JDev1013. I have a view that has JDBC positional parameters that are supposed to be in parameters for function like:
    SELECT x.day, x.special_exact_period_only
    FROM (
      SELECT x.day, x.special_exact_period_only
      FROM (
        SELECT
          x.day,
          rb.special_exact_period_only
      FROM TABLE (
        RentabilityPkg.findMarkerSlots(
          'start',
          ? /* dchannel */,
          NULL,
          ? /* resorts */,
          'special',
          NULL,
          ? /* code */,
          NULL,
          TRUNC(SYSDATE),
          TRUNC(SYSDATE + 365 * 2),
          NULL
      ) x
        JOIN resourcebase rb USING (rentabilitymanager_id)
        UNION
        SELECT
          x.day,
          rb.special_exact_period_only
        FROM TABLE (
          RentabilityPkg.findMarkerSlots(
            'start',
            ? /* dchannel */,
            NULL,
            ? /* resorts */,
            'composition',
            NULL,
            ? /* code */,
            NULL,
            TRUNC(SYSDATE),
            TRUNC(SYSDATE + 365 * 2),
            NULL
        ) x
        JOIN resourcebase rb USING (rentabilitymanager_id)
      )x
      ORDER BY x.day
    ) x
    WHERE ROWNUM <= 30now the JDBC positional parameters take our custom defined list type defined as:
    CREATE TYPE NumberList AS TABLE OF NUMBER;
    we are setting the parameter in the views with the help of oracle.sql.ARRAY class like:
       * Set parameters.
      public void setParams(Integer dchannelId, Integer[] resorts, String specialCode)
        try {
              System.out.println(this.getClass() + ".setParams()");
              ARRAY arrParam1 = ((NWSApplicationModule)getApplicationModule()).toSQLNumberList(Arrays.asList(resorts));
              ARRAY arrParam2 = ((NWSApplicationModule)getApplicationModule()).toSQLNumberList(Arrays.asList(resorts));
              System.out.println("arrParam1 - " + arrParam1);
              System.out.println("arrParam1 - " + arrParam1);
              System.out.println(this.getClass() + " ARRAY - " + arrParam1.getArray());
              System.out.println(this.getClass() + " -- " + arrParam1.length());
              System.out.println("arrParam2 - " + arrParam2);
              System.out.println("arrParam2 - " + arrParam2);
              System.out.println(this.getClass() + " ARRAY - " + arrParam2.getArray());
              System.out.println(this.getClass() + " -- " + arrParam2.length());
              Object[] params =
                   { dchannelId,
                        arrParam1,
                        specialCode,
                        dchannelId,
                        arrParam2,
                        specialCode
              setWhereClauseParams(params);
              System.out.println("DONE WITH " + this.getClass() + ".setParams()");
        catch(Exception ex)
              ex.printStackTrace(System.out);
      }the toSQLNumberList() method is defined in our App module baseclass as follows:
      public ARRAY toSQLNumberList(Collection coll)
           debug("toSQLNumberList()");
           DBTransaction txn = (DBTransaction)getTransaction();
           debug("txn - " + txn + " : " + txn.getClass());
           return NWSUtil.toSQLNumberList(coll, getConnection(txn));
      public static ARRAY toSQLNumberList(Collection c, Connection connection)
        //printTrace();
        debug("toSQLNumberList()");
        try
          ArrayDescriptor numberList = ArrayDescriptor.createDescriptor("NUMBERLIST", connection);
          NUMBER[] elements = new NUMBER[c == null ? 0 : c.size()];
          if (elements.length > 0 )
            Iterator iter = c.iterator();
            for (int i = 0; iter.hasNext(); i++)
              elements[i] = new NUMBER(iter.next().toString());
          return new ARRAY(numberList, connection, elements);
        catch (Exception ex)
          ex.printStackTrace();
          return null;
      protected Connection getConnection(DBTransaction dbTransaction)
        //return null;
        debug("Inside getConnection()");
        CallableStatement s = null;
        try
           * Getting Conenction in BC4J is dirty but its better
           * as otherwise we might end up coding with connections
           * and the Transaction Integrety will be
          s = dbTransaction.createCallableStatement("BEGIN NULL; END;", 0);
          debug("DOING s.getConnection()...");
          Connection conn = s.getConnection();
          debug("DONE WITH  s.getConnection()...");
          /*try
                throw new Exception("TEST");
           catch (Exception ex)
                ex.printStackTrace(System.out);
          debug("conn CLASS - " + conn.getClass());
          return conn;
        catch (Exception ex)
          ex.printStackTrace();
          return null;
        finally
          try { s.close(); }
          catch (Exception ex) {}
      }Whenever we try setting the parameters in view using setParams() and use this view to set the model of a java control it thorws the following exception :
    [2006-10-10 12:34:48,797 AWT-EventQueue-0 ERROR] JBO-28302: Piggyback write error
    oracle.jbo.PiggybackException: JBO-28302: Piggyback write error
         at oracle.jbo.common.PiggybackOutput.getPiggybackStream(PiggybackOutput.java:185)
         at oracle.jbo.common.JboServiceMessage.marshalRefs(JboServiceMessage.java:267)
         at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:343)
         at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:316)
         at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:2283)
         at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7509)
         at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:2221)
         at oracle.jbo.server.remote.ejb.ServerApplicationModuleImpl.doMessage(ServerApplicationModuleImpl.java:79)
         at oracle.jbo.server.ejb.SessionBeanImpl.doMessage(SessionBeanImpl.java:474)
         at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.TxBeanManagedInterceptor.invoke(TxBeanManagedInterceptor.java:53)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.StatefulSessionEJBObject.OC4J_invokeMethod(StatefulSessionEJBObject.java:840)
         at RemoteAMReservation_StatefulSessionBeanWrapper906.doMessage(RemoteAMReservation_StatefulSessionBeanWrapper906.java:286)
         at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    ## Detail 0 ##
    java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1369)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1341)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
         at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)
         at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1245)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1069)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
         at oracle.jbo.common.SvcMsgResponseValues.writeObject(SvcMsgResponseValues.java:116)
         at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:890)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1333)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1284)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1073)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:291)
         at oracle.jbo.common.PiggybackOutput.getPiggybackStream(PiggybackOutput.java:173)
         at oracle.jbo.common.JboServiceMessage.marshalRefs(JboServiceMessage.java:267)
         at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:343)
         at oracle.jbo.server.remote.PiggybackManager.marshalServiceMessage(PiggybackManager.java:316)
         at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:2283)
         at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7509)
         at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:2221)
         at oracle.jbo.server.remote.ejb.ServerApplicationModuleImpl.doMessage(ServerApplicationModuleImpl.java:79)
         at oracle.jbo.server.ejb.SessionBeanImpl.doMessage(SessionBeanImpl.java:474)
         at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.TxBeanManagedInterceptor.invoke(TxBeanManagedInterceptor.java:53)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.StatefulSessionEJBObject.OC4J_invokeMethod(StatefulSessionEJBObject.java:840)
         at RemoteAMReservation_StatefulSessionBeanWrapper906.doMessage(RemoteAMReservation_StatefulSessionBeanWrapper906.java:286)
         at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)This is a typical interaction between 2 server-side components (view-object and app module). Now the question is why is this exception thrown? Any answers?
    This application is one that we have migrated from 904 to 1013 and are trying to get it running in 3-tier.
    Regards,
    Anupam

    Sorry I missed out some semicolons, the script follws:
    -- The following TABLE was created to simulate the issue
    CREATE TABLE TEST_OBJECT
         ASSET_ID NUMBER,
         OBJECT_ID NUMBER,
         NAME VARCHAR2(50)
    INSERT INTO TEST_OBJECT VALUES(1,1,'AAA');
    INSERT INTO TEST_OBJECT VALUES(2,2,'BBB');
    INSERT INTO TEST_OBJECT VALUES(3,3,'CCC');
    COMMIT;
    SELECT * FROM TEST_OBJECT;
    -- The following TYPES was created to simulate the issue
    CREATE OR REPLACE
    TYPE DUTYRESULTOBJECTTAB AS TABLE OF DUTYRESULTOBJECT;
    CREATE OR REPLACE
    type DutyResultObject as object
    ( ASSET_ID number,
      OBJECT_ID number,
      NAME varchar2(150)
    -- The following PACKAGE N FUNCTION was created to simulate the issue
    CREATE OR REPLACE PACKAGE TESTOBJECTPKG
    IS
         FUNCTION OBJECTSEARCH(P_RESOURCE IN NUMBERLIST) RETURN DUTYRESULTOBJECTTAB;
    END;
    CREATE OR REPLACE PACKAGE BODY TESTOBJECTPKG
    IS
         FUNCTION OBJECTSEARCH(P_RESOURCE IN NUMBERLIST) RETURN DUTYRESULTOBJECTTAB
         IS
           BULKDUTYRESULTOBJECTTAB DUTYRESULTOBJECTTAB;
         BEGIN
           SELECT DUTYRESULTOBJECT(ASSET_ID, OBJECT_ID, NAME)
           BULK COLLECT INTO BULKDUTYRESULTOBJECTTAB
           FROM TEST_OBJECT;
           RETURN BULKDUTYRESULTOBJECTTAB;
         END;
    END;
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Using union query to return a value to Oracle Type object in a view

    Hi All,
    I am using type objects inside a view to fetch data. For a particular type, in select statement when i use a "union all", it is throwing oracle error ora-03001 unimplemented feature. But it is working fine when it contains only select statement inside the type.
    Thanks in advance
    Sathish K

    Sathish,
    I think you'll find the answer here:
    http://www.jlcomp.demon.co.uk/ch_16.html
    Cheers,
    Colin

  • Oracle Types in sql

    Hello All,
    I'm in oracle 11gR2 and have a   question about using oracle UDT in a sql.
    I have a procedure that takes in a TYPE like below. This utb_id is number(38). One of a query inside the procedure has issues and I need to test it.
    procedure RESEQUENCE(p_edge_tab IN utb_id)
    Since the sql uses this TYPE, is there a way to test just the SQL directly. For providing values to the highlighted table( p_edge_tab )   tab
    Select * from from  rcl.mv_xref.edge stes,  table( p_edge_tab )   tab
    --                         where
    stes.edge_id = tab.column_value;
    Thanks in advance for your time and help!
    NU

    You can replace with the type name, e.g.
    SELECT *
    FROM   rcl.mv_xref.edge stes, TABLE(utb_id(1, 2, 3, 4, 5)) tab
    WHERE  stes.edge_id = tab.column_value;
    Is that what you are asking?

  • How to call stored procedure having parameter as oracle type from java???

    Hello,
    I have created following type & stored procedure in oracle. How can i call this stored procedure from my java class?
    I want to pass 2d array to this procedure.
    CREATE OR REPLACE TYPE type_survey AS OBJECT ( emp_id number,emp_name varchar(100));
    CREATE OR REPLACE TYPE tbl_survey AS VARRAY(100) OF type_survey;
    CREATE OR REPLACE PROCEDURE INSERTEMP (pp in tbl_survey)
    IS
    BEGIN
    FOR I IN pp.FIRST .. pp.LAST
    LOOP
    INSERT INTO SURVEY (id) VALUES (pp(I).emp_id);
    END LOOP;
    END;
    /

    CREATE OR REPLACE TYPE type_survey AS OBJECT ( emp_id number,emp_name varchar(100));
    CREATE OR REPLACE TYPE tbl_survey AS VARRAY(100) OF type_survey;
    CREATE OR REPLACE PROCEDURE APP_DATA.INSERTEMP (pp in tbl_survey,result out varchar)
    IS
    BEGIN
    FOR I IN pp.FIRST .. pp.LAST
    LOOP
    INSERT INTO SURVEY (id) VALUES (pp(I).emp_id);
    END LOOP;
    result:='done';
    END;
    public static void passArray() throws SQLException
         Connection conn=null;
         try{
              conn=getOracleConnection();//this method returns connection object
         catch (Exception e)      
              e.printStackTrace();
         String[][] val=new String[2][2];
    *     val[0][0]="1";*
    *     val[0][1]="aaa";*
    *     val[1][0]="2";*
    *     val[1][0]="bbb";*
    StructDescriptor desc1=StructDescriptor.createDescriptor("TYPE_SURVEY",conn);
    STRUCT p1struct1 = new STRUCT(desc1,conn,_val_); *//showing error at this line*
    ArrayDescriptor arraydesc = ArrayDescriptor.createDescriptor("TBL_SURVEY",conn);
    ARRAY array = new ARRAY(arraydesc,conn,*p1struct1*);
    CallableStatement cstmt = conn.prepareCall("{ call INSERTEMP(?,?)}");
    cstmt.setObject(1,array);
    cstmt.registerOutParameter(2, OracleTypes.VARCHAR);
    cstmt.execute();
    String res=cstmt.getString(2);
    System.out.println(res);
    in the above java code, I have passed 2d array of string to STRUCT constructor and passed STRUCT object i.e. p1struct1  to ARRAY constructor. is it correct? that means @bottom line, I want to pass val array to my stored porcedure. How can i do this? above code is showing following error......
    Exception in thread "main" java.sql.SQLException: Fail to convert to internal representation: [Ljava.lang.String;@146c1d4
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
         at oracle.jdbc.oracore.OracleTypeNUMBER.toNUMBER(OracleTypeNUMBER.java:540)
         at oracle.jdbc.oracore.OracleTypeNUMBER.toDatum(OracleTypeNUMBER.java:54)
         at oracle.sql.StructDescriptor.toOracleArray(StructDescriptor.java:717)
         at oracle.sql.StructDescriptor.toArray(StructDescriptor.java:1375)
         at oracle.sql.STRUCT.<init>(STRUCT.java:159)
         at com.flologic.ArrayDemo.passArray(ArrayDemo.java:29)
         at com.flologic.ArrayDemo.main(ArrayDemo.java:57)

  • ORA-04043 Error when oracle type is declared in a package

    We have a package defining a type and a procedure which uses that type. The problem is - If the type is defined in a package jdbc fails with an error. If the type is declared outside the package everything works fine. The package is declared as
    create or replace
    PACKAGE TEST_ARRAY AS
    TYPE COLTYPE_NUMTAB is table of number;
    procedure Test_Procedure(some_var_name in COLTYPE_NUMTAB);
    END TEST_ARRAY;My Jdbc call is made by declaring the type as "TEST_ARRAY.COLTYPE_NUMTAB".
    Is there any different style/way of declaring this type?
    Thanks

    I tried tracing the oracle jdbc driver logs (we use the OCI jdbc driver) for the success and failure scenarios. Here are the logs
    1. When the type is defined outside the package the logs look like
    2011-05-31T03:23:56.177+0530 UCP TRACE_1 seq-408,thread-10 oracle.jdbc.driver.PhysicalConnection.createARRAY Public Enter: "COLTYPE_NUMTAB", [Ljava.lang.Object;@16a9424
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-409,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: "COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@180cb01
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-410,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: "COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@180cb01, false, false
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-411,thread-10 oracle.sql.SQLName.<init> Public Enter: "COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@180cb01
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-412,thread-10 oracle.sql.SQLName.init Enter: "COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@180cb01
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-413,thread-10 oracle.sql.SQLName.parse Enter: "COLTYPE_NUMTAB", [Ljava.lang.String;@1cec874, [Ljava.lang.String;@ca6cea, true
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-414,thread-10 oracle.sql.SQLName.parse return: false
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-415,thread-10 oracle.sql.SQLName.parse Exit
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-416,thread-10 oracle.sql.SQLName.init Exit
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-417,thread-10 oracle.sql.SQLName.<init> Exit
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-418,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: SCHEMA_NAME.COLTYPE_NUMTAB, oracle.jdbc.driver.T2CConnection@180cb01
    2011-05-31T03:23:56.177+0530 UCP TRACE_16 seq-419,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: SCHEMA_NAME.COLTYPE_NUMTAB, oracle.jdbc.driver.T2CConnection@180cb01, false, false2. When the type is defined inside the same package as the procedure which is TEST_ARRAY, the logs look like
    2011-05-31T05:10:05.219+0530 UCP TRACE_16 seq-409,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: "TEST_ARRAY.COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@6a435f
    2011-05-31T05:10:05.219+0530 UCP TRACE_16 seq-410,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: "TEST_ARRAY.COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@6a435f, false, false
    2011-05-31T05:10:05.250+0530 UCP TRACE_16 seq-411,thread-10 oracle.sql.SQLName.<init> Public Enter: "TEST_ARRAY.COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@6a435f
    2011-05-31T05:10:05.250+0530 UCP TRACE_16 seq-412,thread-10 oracle.sql.SQLName.init Enter: "TEST_ARRAY.COLTYPE_NUMTAB", oracle.jdbc.driver.T2CConnection@6a435f
    2011-05-31T05:10:05.250+0530 UCP TRACE_16 seq-413,thread-10 oracle.sql.SQLName.parse Enter: "TEST_ARRAY.COLTYPE_NUMTAB", [Ljava.lang.String;@129c445, [Ljava.lang.String;@114a947, true
    2011-05-31T05:10:05.250+0530 UCP TRACE_16 seq-414,thread-10 oracle.sql.SQLName.parse return: true
    2011-05-31T05:10:05.265+0530 UCP TRACE_16 seq-415,thread-10 oracle.sql.SQLName.parse Exit
    2011-05-31T05:10:05.265+0530 UCP TRACE_16 seq-416,thread-10 oracle.sql.SQLName.init Exit
    2011-05-31T05:10:05.265+0530 UCP TRACE_16 seq-417,thread-10 oracle.sql.SQLName.<init> Exit
    2011-05-31T05:10:05.265+0530 UCP TRACE_16 seq-418,thread-10 oracle.sql.ArrayDescriptor.createDescriptor Public Enter: TEST_ARRAY.COLTYPE_NUMTAB, oracle.jdbc.driver.T2CConnection@6a435fIn the second scenario the SQLName class constructor does not append the schema name.
    Though I am not the right person to interpret the jdbc logs hope it helps in troubleshooting the problem.

  • Oracle type error using cygwin on windows to connect via sqlplus to oracle.

    Hi,
    Found already some information on the internet regarding this topic but wasn't able to solve it so far.
    So all informartion, tips are more then welcome.
    Scripts runs with admin account 'DBA_Services'
    Sqlplus connection sqlplus sys/***@oracle_sid
    Thx already
    OWBrun Script (v2.0)
    Enviroment : GAMMA
    Hostname : pvspdb04
    Database : sgviv5
    Date : 05Nov2010
    Time : 15:58:21
    Schema : dwhins
    RuntimeRep: OWBRUN
    Mapping : INS_DLITE_CTRL_JOB_03
    Location : DNA_STAGING_LOCATION
    Type load : PLSQL
    Custom par: ,
    Identifier: INS_DLITE_CTRL_JOB_03_20101105155820
    Logfile : /ING/DWH/ora_dwh_loader/log/dwhins/owbrun_dwhins_INS_DLITE_CTRL_JOB_03_20101105155820.log
    === Check DB connect ===
    05-NOV-2010 15:58:22
    DB connection test is OK (attemps=1)
    === OWB RUN ===
    SQL*Plus: Release 10.1.0.2.0 - Production on Fri Nov 5 15:58:22 2010
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, OLAP and Data Mining options
    SQL> SQL> SQL> SQL>
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    Session altered.
    Elapsed: 00:00:00.00
    SQL> SQL> SQL> SQL> SQL>
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    SQL> ++ Execute owbruntask dwhins.INS_DLITE_CTRL_JOB_03
    SQL>
    Stage 1: Decoding Parameters
    | location_name=DNA_STAGING_LOCATION
    | task_type=PLSQL
    | task_name=INS_DLITE_CTRL_JOB_03
    Stage 2: Opening Task
    declare
    ERROR at line 1:
    ORA-20001: Task not found - Please check the Task Type, Name and Location are correct.
    ORA-06512: at line 267
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, OLAP and Data Mining options Exitcode = 33 Error : OWBRUN INS_DLITE_CTRL_JOB_03
    Date : 05Nov2010
    Time : 15:58:24

    This are the most important scripts:
    DLITE_Sub1_201.ksh
    #!/bin/ksh
    #set -x
    cp /ING/DWH/ora_dwh_loader/conf/stgins.cfg.sgviv5 /ING/DWH/ora_dwh_loader/conf/stgins.cfg
    export FPATH=/ING/IIB/DNA/Interfaces/Scripts
    export FINPATH=/ING/IIB/DNA/In/
    export FOUTPATH=/ING/IIB/DNA/Out/
    #load script into memory
    autoload DLITE_fct_JS
    #load script into memory
    #autoload DNA_fct_JS_EXEC
    JS_SCRIPT=`basename $0`
    JS_ID=201
    JS_TSK_ID=001;JS_TSK_NAM="FP_START_Remove_Files"
    echo "\nstart subtask '${JS_TSK_NAM}"
    cd /ING/IIB/DNA/Out
    rm -f DLITE_CAPSIL_CODE_*.CSV
    rm -f DLITE_CAPSIL_VAL_*.CSV
    rm -f DLITE_VARIA_CODE_*.CSV
    rm -f DLITE_VARIA_VAL_*.CSV
    echo "\nend subtask '${JS_TSK_NAM}"
    JS_TSK_ID=002;JS_TSK_NAM="F_DLITE_01_CODE_DESC"
    cd /ING/IIB/DNA/Interfaces/Scripts
    echo "\nstart subtask '${JS_TSK_NAM}"
    ksh DLITE_owbrun.ksh -s dwhins -t PROCESS -m F_DLITE_01_CODE_DESC -l LOC_DNA_FLOW_STORE -c ","
    JS_TSK_STA=$?
    echo "\nverifying correct execution of subtask '${JS_TSK_NAM}"
    if [ ${JS_TSK_STA} -ne 0 ] ; then
    ksh DLITE_owbrun.ksh -s dwhins -t PLSQL -m INS_DLITE_CTRL_JOB_03 -l DNA_STAGING_LOCATION -c ","
    exit 1
    fi
    echo "\nend subtask '${JS_TSK_NAM}"
    JS_TSK_ID=002;JS_TSK_NAM="Check header/footer of files"
    echo "\nstart subtask '${JS_TSK_NAM}"
    ksh DLITE_CheckHeaderFooter.ksh
    JS_TSK_STA=$?
    if [ ${JS_TSK_STA} -ne 0 ] ; then
    exit 1
    fi
    echo "\nend subtask '${JS_TSK_NAM}"
    DLITE_owbrun.ksh
    . /ING/IIB/DNA/Interfaces/Scripts/DLITE_ods_set_env.ksh
    fout_melding()
         echo "Error : ${1}" | tee -a ${LOGFILE}
         echo " Date     :     $(date +%d%b%Y)" >> ${LOGFILE}
         echo " Time     :     $(date +%H:%M:%S)" >> ${LOGFILE}
    if [ -s ${LOGFILE:=/tmp/foutmelding} ]
    then
    cat ${LOGFILE} | mailx -s "'hostname':${ORACLE_SID};'Enviroment' :${APPL_ENV} : Error OWB run ${SCHEMA} : ${MAPPING}" "${dstG_OWB_errors[*]} ${dstA_OWB_errors[*]}"
    else
    echo "Error : ${1}" | mailx -s "'hostname':${ORACLE_SID};'Enviroment' :${APPL_ENV} : Error OWB run ${SCHEMA} : ${MAPPING}" "${dstG_OWB_errors[*]} ${dstA_OWB_errors[*]}"
    fi
    rm -f ${STATSFILE}
    waarschuwing()
         echo "Warning : ${1}" | tee -a ${LOGFILE}
         echo " Date     :     $(date +%d%b%Y)" >> ${LOGFILE}
         echo " Time     :     $(date +%H:%M:%S)" >> ${LOGFILE}
    if [ -s ${LOGFILE:=/tmp1/foutmelding} ]
    then
    echo ${1} | mailx -s "'hostname':${ORACLE_SID};'Enviroment' :${APPL_ENV} : Warning OWB run ${SCHEMA} : ${TABLENAME}" "${dstG_OWB_errors[*]} ${dstA_OWB_errors[*]}"
    else
    echo "Warning : ${1}" | mailx -s "'hostname':${ORACLE_SID};'Enviroment' :${APPL_ENV} : Warning OWB run ${SCHEMA} : ${TABLENAME}" "${dstG_OWB_errors[*]} ${dstA_OWB_errors[*]}"
    fi
    USAGE="Usage : owbrun.ksh -s target_schema -t type -m mapping -l location -c custom_param -p system_param [-i ident]"
    umask 022
    ORVERSION=2.0
    set -- `getopt s:t:m:c:p:i:l: $*`
    if [ $? -ne 0 ]
    then
         echo ${USAGE}
         exit 2
    fi
    while [ $# -gt 0 ]
    do
    case ${1} in
         -s)
              SCHEMA=${2}
              shift 2
         -t)
              LOADTYPE=${2}
              shift 2
         -l)
              LOCATION=${2}
              shift 2
         -m)
              MAPPING=${2}
              shift 2
         -i)
              IDENT=${2}
              shift 2
         -c)
              CUSTPARAM=${2}
              shift 2
              shift
              break
    esac
    done
    export LISTFILENAMES=${*}
    if [ "${SCHEMA}" = "" ]
    then
         fout_melding "Target Schema is mandatory"
         echo ${USAGE}
         exit 1
    fi
    if [ "${MAPPING}" = "" ]
    then
         echo "Error : Mapping is mandatory"
         echo ${USAGE}
         exit 1
    fi
    if [ "${LOCATION}" = "" ]
    then
         echo "Error : Location is mandatory"
         echo ${USAGE}
         exit 1
    fi
    MAPPING=$(echo ${MAPPING} | tr [:lower:] [:upper:])
    if [ "${LOADTYPE}" = "" ]
    then
         echo "Error : Type (PLSQL/SQLLDR/PROCESS) is mandatory"
         echo ${USAGE}
         exit 1
    fi
    LOADTYPE=$(echo ${LOADTYPE} | tr [:lower:] [:upper:])
    if [ "${LOADTYPE}" != "PLSQL" -a "${LOADTYPE}" != "SQLLDR" -a "${LOADTYPE}" != "PROCESS" ]
    then
         echo "Error : Illegal type ${LOADTYPE}"
         echo ${USAGE}
         exit 1
    fi
    export SCHEMA=$(echo ${SCHEMA} | tr [:upper:] [:lower:])
    export UPSCHEMA=$(echo ${SCHEMA} | tr [:lower:] [:upper:])
    # Call the Configuration script
    . /ING/DWH/ora_dwh_loader/bin/config.ksh -s ${SCHEMA}
    exitcode=$?
    if [ $exitcode -ne 0 ]
    then
         echo "Error : during config.ksh"
         exit ${exitcode}
    fi
    if [ "${IDENT}" = "" ]
    then
         IDENT=${MAPPING}_$(date +%Y%m%d%H%M%S)
         CUSTPARAM=$(echo ${CUSTPARAM} | awk -f ${BASEPATH}/bin/owbrun.awk "datum=$(date +%Y%m%d%H%M%S)")
    fi
    if [ "${RUNREP}" = "" ]
    then
         fout_melding "Runtime Repository is mandatory (see ${SCHEMA}.cfg)"
         echo ${USAGE}
         exit 1
    fi
    export BPIDFILE=${TMPDRIVE}/owbrun_${SCHEMA}_${IDENT}_$$.pidlist
    export LOGFILE=${LOGDRIVE}/owbrun_${SCHEMA}_${IDENT}.log
    export STATSFILE=${LOGDRIVE}/owbrun_${SCHEMA}_${IDENT}.stats
    echo "OWBrun Script (v${ORVERSION})" > ${LOGFILE}
    echo "Enviroment : ${APPL_ENV}" >> ${LOGFILE}
    echo "Hostname : $(hostname)" >> ${LOGFILE}
    echo "Database : ${ORACLE_SID}" >> ${LOGFILE}
    echo "Date     :     $(date +%d%b%Y)" >> ${LOGFILE}
    echo "Time     :     $(date +%H:%M:%S)" >> ${LOGFILE}
    echo "Schema     : ${SCHEMA}" >> ${LOGFILE}
    echo "RuntimeRep: ${RUNREP}" >> ${LOGFILE}
    echo "Mapping : ${MAPPING}" >> ${LOGFILE}
    echo "Location : ${LOCATION}" >> ${LOGFILE}
    echo "Type load : ${LOADTYPE}" >> ${LOGFILE}
    echo "Custom par: ${CUSTPARAM}" >> ${LOGFILE}
    echo "Identifier: ${IDENT}" >> ${LOGFILE}
    echo "Logfile     :     ${LOGFILE}" >> ${LOGFILE}
    echo " " >> ${LOGFILE}
    echo "Hostname : $(hostname)" > ${STATSFILE}
    echo "Database : ${ORACLE_SID}" >> ${STATSFILE}
    echo "Schema     : ${SCHEMA}" >> ${STATSFILE}
    echo "Mapping : ${TABLENAME}" >> ${STATSFILE}
    echo "Period : P${PERIOD}" >> ${STATSFILE}
    echo "Type load : ${LOADTYP}" >> ${STATSFILE}
    echo "Identifier: ${IDENT}" >> ${STATSFILE}
    echo "Start     : $(date +%d%m%Y%H%M%S)" >> ${STATSFILE}
    echo "=== Check DB connect ===" >> ${LOGFILE}
    ${BASEPATH}/bin/chk_db_connect.ksh >> ${LOGFILE}
    exitcode=${?}
    if [ $exitcode -ne 0 ]
    then
         fout_melding "Could NOT connect to database ${ORACLE_SID}"
         exit ${exitcode}
    fi
    echo "=== OWB RUN ===" >> ${LOGFILE}
    sqlplus 'system/*****' <<-EOF >> ${LOGFILE}
    set timing on
    set serveroutput on
    alter session set sort_area_size=2621440;
    alter session set hash_area_size=2621440;
    alter session set skip_unusable_indexes=true;
    alter session enable resumable timeout ${ResumableTimeout} name 'OwbRunTask ${UPSCHEMA}.${MAPPING}';
    set pages 0
    set timing on
    set serveroutput on
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    exec dbms_application_info.set_module('OWBRUNTASK','${UPSCHEMA}.${MAPPING}');
    Prompt ++ Execute owbruntask ${SCHEMA}.${MAPPING}
    declare
    p_repos_owner varchar2(100):= '${RUNREP}';
    p_location_name varchar2(100):='${LOCATION}';
    p_task_type varchar2(100) :='${LOADTYPE}';
    p_task_name varchar2(100) default '${MAPPING}';
    p_system_params varchar2(100) default '","';
    p_custom_params varchar2(200) default '${CUSTPARAM}"';
    p_oem_friendly number default 0;
    l_oem_style boolean := case (p_oem_friendly)
    when 0 then false
    else true
    end ;
    l_audit_execution_id number; -- Audit Execution Id
    l_audit_result number := ${RUNREP}.wb_rt_api_exec.RESULT_FAILURE; -- Result Code
    l_audit_result_disp varchar2(64) := 'FAILURE'; -- Result Display Code
    l_task_type_name varchar2(64); -- Task Type Name
    l_task_type varchar2(64); -- Task Type
    l_task_name varchar2(64); -- Task Name
    l_location_name varchar2(64); -- Location Name
    l_return number ;
    fout exception;
    opgepast exception;
    p_parameters varchar2(4000);
    p_parameter_kind number;
    l_anchor_offset number := 1;
    l_start_offset number := 1;
    l_equals_offset number;
    l_comma_offset number;
    l_value_offset number;
    l_esc_offset number;
    l_esc_count number;
    l_esc_char varchar2(4);
    l_parameter_name varchar2(4000);
    l_parameter_value varchar2(4000);
    begin
    p_custom_params:=replace(p_custom_params,'~',' ');
    execute immediate ('alter session set current_schema = ' || p_repos_owner) ;
    -- Initialize Return Code
    l_return := ${RUNREP}.wb_rt_api_exec.RESULT_FAILURE;
    -- Import Parameters
    dbms_output.put_line('Stage 1: Decoding Parameters');
    l_task_type_name := p_task_type ;
    if UPPER(l_task_type_name) = 'PLSQL'
    then
    l_task_type := 'PLSQL';
    elsif UPPER(l_task_type_name) = 'SQL_LOADER'
    then
    l_task_type := 'SQLLoader';
    elsif UPPER(l_task_type_name) = 'PROCESS'
    then
    l_task_type := 'ProcessFlow';
    else
    l_task_type := l_task_type_name;
    end if;
    l_task_name := p_task_name ;
    l_location_name := p_location_name ;
    dbms_output.put_line('| location_name=' || l_location_name);
    dbms_output.put_line('| task_type=' || l_task_type);
    dbms_output.put_line('| task_name=' || l_task_name);
    -- Decode Parameters
    begin
    -- Prepare Execution
    dbms_output.put_line('Stage 2: Opening Task');
    l_audit_execution_id := ${RUNREP}.wb_rt_api_exec.open(l_task_type, l_task_name, l_location_name);
    dbms_output.put_line('| l_audit_execution_id=' || to_char(l_audit_execution_id));
    commit;
    -- Override Parameters
    p_parameters:=p_system_params;
    p_parameter_kind :=${RUNREP}.wb_rt_api_exec.PARAMETER_KIND_SYSTEM;
    l_anchor_offset:= 1;
    l_start_offset:= 1;
    l_equals_offset:=0;
    l_comma_offset:=0;
    l_value_offset:=0;
    l_esc_offset:=0;
    l_esc_count:=0;
    l_esc_char:=null;
    l_parameter_name:=null;
    l_parameter_value:=null;
    begin
    loop
    l_equals_offset := INSTR(p_parameters, '=', l_start_offset);
    exit when l_equals_offset = 0;
    l_start_offset := l_equals_offset + 1;
    loop
    l_comma_offset := INSTR(p_parameters, ',', l_start_offset);
    if l_comma_offset = 0
    then
    l_comma_offset := length(p_parameters) + 1;
    exit;
    else
    l_esc_count := 0;
    l_esc_offset := l_comma_offset - 1;
    loop
    l_esc_char := SUBSTR(p_parameters, l_esc_offset, 1);
    exit when l_esc_char != '\';
    l_esc_count := l_esc_count + 1;
    l_esc_offset := l_esc_offset - 1;
    end loop;
    if MOD(l_esc_count, 2) != 0
    then
    l_start_offset := l_comma_offset + 1;
    else
    exit;
    end if;
    end if;
    end loop;
    l_parameter_name := LTRIM(RTRIM(SUBSTR(p_parameters, l_anchor_offset, l_equals_offset - l_anchor_offset)));
    l_parameter_value := SUBSTR(p_parameters, l_equals_offset + 1, l_comma_offset - (l_equals_offset + 1));
    -- Override Input Parameter
    ${RUNREP}.wb_rt_api_exec.override_input_parameter(l_audit_execution_id,l_parameter_name,l_parameter_value,p_parameter_kind);
    exit when l_comma_offset >= length(p_parameters)-1;
    l_start_offset := l_comma_offset + 1;
    l_anchor_offset := l_start_offset;
    end loop;
    end;
    p_parameters:=p_custom_params;
    p_parameter_kind :=${RUNREP}.wb_rt_api_exec.PARAMETER_KIND_CUSTOM;
    l_anchor_offset:= 1;
    l_start_offset:= 1;
    l_equals_offset:=0;
    l_comma_offset:=0;
    l_value_offset:=0;
    l_esc_offset:=0;
    l_esc_count:=0;
    l_esc_char:=null;
    l_parameter_name:=null;
    l_parameter_value:=null;
    begin
    loop
    l_equals_offset := INSTR(p_parameters, '=', l_start_offset);
    exit when l_equals_offset = 0;
    l_start_offset := l_equals_offset + 1;
    loop
    l_comma_offset := INSTR(p_parameters, ',', l_start_offset);
    if l_comma_offset = 0
    then
    l_comma_offset := length(p_parameters) + 1;
    exit;
    else
    l_esc_count := 0;
    l_esc_offset := l_comma_offset - 1;
    loop
    l_esc_char := SUBSTR(p_parameters, l_esc_offset, 1);
    exit when l_esc_char != '\';
    l_esc_count := l_esc_count + 1;
    l_esc_offset := l_esc_offset - 1;
    end loop;
    if MOD(l_esc_count, 2) != 0
    then
    l_start_offset := l_comma_offset + 1;
    else
    exit;
    end if;
    end if;
    end loop;
    l_parameter_name := LTRIM(RTRIM(SUBSTR(p_parameters, l_anchor_offset, l_equals_offset - l_anchor_offset)));
    l_parameter_value := SUBSTR(p_parameters, l_equals_offset + 1, l_comma_offset - (l_equals_offset + 1));
    -- Override Input Parameter
    ${RUNREP}.wb_rt_api_exec.override_input_parameter(l_audit_execution_id,l_parameter_name,l_parameter_value,p_parameter_kind);
    exit when l_comma_offset >= length(p_parameters)-1;
    l_start_offset := l_comma_offset + 1;
    l_anchor_offset := l_start_offset;
    end loop;
    end;
    -- Execute
    dbms_output.put_line('Stage 4: Executing Task');
    l_audit_result := ${RUNREP}.wb_rt_api_exec.execute(l_audit_execution_id);
    if l_audit_result = ${RUNREP}.wb_rt_api_exec.RESULT_SUCCESS
    then
    l_audit_result_disp := 'SUCCESS';
    elsif l_audit_result = ${RUNREP}.wb_rt_api_exec.RESULT_WARNING
    then
    l_audit_result_disp := 'WARNING';
    elsif l_audit_result = ${RUNREP}.wb_rt_api_exec.RESULT_FAILURE
    then
    l_audit_result_disp := 'FAILURE';
    else
    l_audit_result_disp := 'UNKNOWN';
    end if;
    dbms_output.put_line('| l_audit_result=' || to_char(l_audit_result) || ' (' || l_audit_result_disp || ')');
    -- Finish Execution
    dbms_output.put_line('Stage 5: Closing Task');
    ${RUNREP}.wb_rt_api_exec.close(l_audit_execution_id);
    commit;
    dbms_output.put_line('Stage 6: Processing Result');
    if l_oem_style
    then
    if l_audit_result = ${RUNREP}.wb_rt_api_exec.RESULT_SUCCESS
    then
    l_return := 0;
    elsif l_audit_result = ${RUNREP}.wb_rt_api_exec.RESULT_WARNING
    then
    l_return := 0;
    else
    l_return := l_audit_result;
    end if;
    else
    l_return := l_audit_result;
    end if;
    dbms_output.put_line('| exit=' || to_char(l_return));
    if (l_return = 3) then
    raise fout;
    elsif (l_return = 2 ) then
    raise opgepast;
    end if;
    exception
    when fout then
    raise_application_error(-20002, 'Error during executing task');
    when opgepast then
    raise_application_error(-20003, 'Warning during executing task');
    when no_data_found
    then
    raise_application_error(-20001, 'Task not found - Please check the Task Type, Name and Location are correct.');
    end;
    dbms_output.put_line('| exit=' || to_char(l_return));
    end ;
    EOF
    exitcode=${?}
    if [ ${exitcode} -ne 0 ]
    then
         echo "Exitcode = ${exitcode}" >> ${LOGFILE}     
         fout_melding "OWBRUN ${MAPPING} "
         exit ${exitcode}
    else
         echo "OWBRUN succesfull" >> ${LOGFILE}
    fi
    echo "---------------------------------------------------------------------" >> ${LOGFILE}
    echo "Date     :     $(date +%d%b%Y)" >> ${LOGFILE}
    echo "Time     :     $(date +%H:%M:%S)" >> ${LOGFILE}
    echo "Terminated succesfull" >> ${LOGFILE}
    echo "---------------------------------------------------------------------" >> ${LOGFILE}
    echo "Stop     : $(date +%d%m%Y%H%M%S)" >> ${STATSFILE}
    times >> ${STATSFILE}
    #echo "Loader Statistics" >> ${LOGFILE}
    #awk -f ${BASEPATH}/bin/loadstat.awk ${STATSFILE} >> ${LOGFILE}
    #${BASEPATH}/bin/loadstat.ksh -s ${SCHEMA} -f ${STATSFILE}
    exit 0

  • Mapping Oracle types

    How can I collect in oracle the type of data "TABLE" returned by a procedure stored to utilize its data. It is to do the mapping to java.
    String mp = "{call MP_Procedure(?,?)}";          
    // Access to database
         CallableStatement cs = (CallableStatement)con.prepareCall(mp);               
         cs.setInt(1,326);          
         cs.registerOutParameter(2, OracleTypes.ARRAY); ?????????????
         cs.execute();               
    .....

    Well, in oracle database exists the type Table that is a matrix of objetcs. My database administrator use them to make stored procedure so i need to colect his contents, you know I can't explain why my database admnistrator use it, but she uses them.
    So can you help me?
    Sorry about my english :D

  • How to return oracle type from select statment

    I have the following oracle[b] types
    create or replace type course_obj as object
         name varchar2(20),
         start_date date,
         instructor varchar2(20)
    create or replace type course_arr
    is varray(10000) of course_obj;
    create or replace type student_obj as object
    first_name varchar2(50),
    last_name varchar2(50),
    student_number number,
    courses course_arr
    create or replace type student_arr
    is varray(10000) of student_obj;
    package
    CREATE OR REPLACE PACKAGE testing
    AS
    FUNCTION get_student_info ( student_number in number ) RETURN student_arr PIPELINED;
    END;
    CREATE OR REPLACE PACKAGE BODY testing
    AS
    FUNCTION get_student_info ( student_number in number ) RETURN student_arr PIPELINED IS
    course1 course_obj;
    course2 course_obj;
    courses course_arr := course_arr();
    student student_obj;
    BEGIN
    course1 := course_obj('Computer 101', sysdate, 'John Anderson');
    course2 := course_obj('Computer 102', sysdate, 'Jo Doe');
    courses.extend;
    courses(1) := course1;
    courses.extend;
    courses(2) := course2;
    student := student_obj('Jack', 'Smith', 781509790, courses);
    PIPE ROW(student);
    END;
    END;
    When I issue the following select SQL
    select student_number, courses from table(testing.get_student_info(1))
    The result I get is
    student
    number courses
    781509790 ((Computer 101, 9/7/2006 5:13:11 PM, John Anderson), (Computer 102, 9/7/2006 5:13:11 PM, Jo Doe), , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , )
    How can I return the result as
    student
    number name start date instructor
    781509790 Computer 101 9/7/2006 5:13:11 PM John Anderson
    781509790 Computer 102 9/7/2006 5:13:11 PM Joe Doe

    Hi,
    Instead of creating varray, create a table type of objects for both courses as well as students like below.
    create or replace type course_obj as object
    name varchar2(20),
    start_date date,
    instructor varchar2(20)
    create or replace type course_arr
    as TABLE OF course_obj;
    create or replace type student_obj as object
    first_name varchar2(50),
    last_name varchar2(50),
    student_number number,
    courses course_arr
    create or replace type student_arr as TABLE OF student_obj
    Then create a pipelined function like below,
    CREATE OR REPLACE FUNCTION get_student_info ( student_number in number )
    RETURN student_arr PIPELINED IS
    student_arr1 student_arr:=student_arr();
    course_arr1 course_arr:=course_arr();
    i number:=0;
    BEGIN
    i:=i+1;
    course_arr1.extend;
    student_arr1.extend;
    course_arr1(course_arr1.count) := course_obj('maths',sysdate,'vv2');
    student_arr1(student_arr1.count) := student_obj('raja','ram',23232,course_arr1);
    PIPE ROW(student_arr1(i));
    course_arr1(course_arr1.count) := course_obj('computer',sysdate,'vv');
    student_arr1(student_arr1.count) := student_obj('raj','raam',223232,course_arr1);
    PIPE ROW(student_arr1(i));
    END;
    You'll get the result like below,
    FIRST_NAME LAST_NAME STUDENT_NUMBER
    COURSES(NAME, START_DATE, INSTRUCTOR)
    raja ram 23232
    COURSE_ARR(COURSE_OBJ('maths', '08-SEP-06', 'vv2'))
    raj raam 223232
    COURSE_ARR(COURSE_OBJ('computer', '08-SEP-06', 'vv'))
    With regards
    Ram

Maybe you are looking for

  • In a dynamic page how to share variable between PL/SQL and javascript

    For example, my dynamic page contains such PL/SQL codes: <ORACLE> DECLARE info varchar(100); rowid urowid; procedure doDelete( row_id in urowid ) IS begin Delete From xxx WHERE rowid = row_id; end doDelete; BEGIN Select name, rowid INTO info, rowid F

  • Accessing the same object from multiple classes.

    For the life of me I can't workout how I can access things from classes that haven't created them. I don't want to have to use "new" multiple times in seperate classes as that would erase manipulated values. I want to be able to access and manipulate

  • How can I install iOS 7 on my iPod touch 4th gen?

    How can I install iOS 7 on my iPod touch 4th gen?

  • I need help connecting drums with MIDI-USB cable.

    I've been trying this for years, but I just don't know what to do or what I need to connect my electronic drums to GarageBand or any other MIDI programs, I pretty much connect the module and my mac with a MIDI to USB cable and nothing seems to recogn

  • Hi installation Prolem in client

    Hi all, I getting problem in installaing client in clleint pc. server in workgruop and all client pc in domain is that any problem. odbc sql server  connetionOpen connetion failed sql state 08001 sql server error 17 sql server does not exist or acces