Oracle Object Type Constructor Called Multiple Times

I have an object type with a custom constructor. In SQL, when I reference the attributes the constructor is called multiple times in Oracle 11.2.0.4.
Why is the constructor called multiple times?
How do I stop it?
My current work around is to reference the attributes and use the /*+ materialize */ hint.
Problem Setup
    create or replace type Foo as object
      Bar1 NUMBER,
      Bar2 NUMBER,
      Bar3 NUMBER,
      CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
        RETURN SELF AS RESULT
        DETERMINISTIC
    create or replace type body Foo is
      -- Member procedures and functions
      CONSTRUCTOR FUNCTION Foo(p_Bar1 NUMBER, p_Bar2 NUMBER, p_Bar3 NUMBER)
        RETURN SELF AS RESULT
        DETERMINISTIC
      AS
      BEGIN
        SELF.Bar1 := p_Bar1;
        SELF.Bar2 := p_Bar2;
        SELF.Bar3 := p_Bar3;
        dbms_output.put_line('Foo Constructor Called');
        RETURN;
      END;
    end;
Problem
    -- Constructor is called 6 times!
    -- Once for each column and once for each predicate in the where clause.
    SELECT x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3, f
    FROM (
      SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
      FROM dual d
    ) x
    WHERE x.f.bar1 = x.f.bar1 AND x.f.bar2 = x.f.bar2
Output
Foo Constructor Called
Foo Constructor Called
Foo Constructor Called
Foo Constructor Called
Foo Constructor Called
Foo Constructor Called
Workaround
    -- Work Around
    -- Constructor is called 3 times
    -- Once for each column in the inline view.
    -- Note, I removed column f (the object type) because it's not compatible with the materialize hint.
    WITH y AS (
      SELECT /*+ materialize */ x.f.bar1 AS bar1, x.f.bar2 AS bar2, x.f.bar3 AS bar3
      FROM (
        SELECT foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3) f
        FROM dual d
      ) x
    SELECT y.bar1, y.bar2, y.bar3
    FROM y
    WHERE y.bar1 = y.bar1 AND y.bar2 = y.bar2

Another work-around is described in this thread... Accessing fields of a custom object type... which makes use of a collection type combined with the TABLE operator, like so...
create or replace type FooTable as table of Foo;
SELECT x.bar1 AS bar1, x.bar2 AS bar2, x.bar3 AS bar3, value(x) f
    FROM table(FooTable(
      foo(p_Bar1 => 1, p_Bar2 => 2, p_Bar3 => 3)
    )) x
    WHERE x.bar1 = x.bar1 AND x.bar2 = x.bar2
BAR1 BAR2 BAR2 F
1    2    3    (1, 2, 3)
Foo Constructor Called
Hope that helps...
Gerard

Similar Messages

  • Finalize() method being called multiple times for same object?

    I got a dilly of a pickle here.
    Looks like according to the Tomcat output log file that the finalize method of class User is being called MANY more times than is being constructed.
    Here is the User class:
    package com.db.multi;
    import java.io.*;
    import com.db.ui.*;
    import java.util.*;
    * @author DBriscoe
    public class User implements Serializable {
        private String userName = null;
        private int score = 0;
        private SocketImage img = null;
        private boolean gflag = false;
        private Calendar timeStamp = Calendar.getInstance();
        private static int counter = 0;
        /** Creates a new instance of User */
        public User() { counter++;     
        public User(String userName) {
            this.userName = userName;
            counter++;
        public void setGflag(boolean gflag) {
            this.gflag = gflag;
        public boolean getGflag() {
            return gflag;
        public void setScore(int score) {
            this.score = score;
        public int getScore() {
            return score;
        public void setUserName(String userName) {
            this.userName = userName;
        public String getUserName() {
            return userName;
        public void setImage(SocketImage img) {
            this.img = img;
        public SocketImage getImage() {
            return img;
        public void setTimeStamp(Calendar c) {
            this.timeStamp = c;
        public Calendar getTimeStamp() {
            return this.timeStamp;
        public boolean equals(Object obj) {
            try {
                if (obj instanceof User) {
                    User comp = (User)obj;
                    return comp.getUserName().equals(userName);
                } else {
                    return false;
            } catch (NullPointerException npe) {
                return false;
        public void finalize() {
            if (userName != null && !userName.startsWith("OUTOFDATE"))
                System.out.println("User " + userName + " destroyed. " + counter);
        }As you can see...
    Every time a User object is created, a static counter variable is incremented and then when an object is destroyed it appends the current value of that static member to the Tomcat log file (via System.out.println being executed on server side).
    Below is the log file from an example run in my webapp.
    Dustin
    User Queue Empty, Adding User: com.db.multi.User@1a5af9f
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    User Dustin destroyed. 0
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 1
    User Dustin destroyed. 1
    User Dustin destroyed. 1
    User Dustin destroyed. 1
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    User Dustin destroyed. 2
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    User Dustin destroyed. 3
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    User Dustin destroyed. 4
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    User Dustin destroyed. 5
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    User Dustin destroyed. 6
    Joe
    USER QUEUE: false
    INSIDE METHOD: false
    AFTER METHOD: false
    User Dustin pulled from Queue, Game created: Joe
    User Already Placed: Dustin with Joe
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    User Dustin destroyed. 7
    INSIDE METHOD: false
    INSIDE METHOD: false
    USER QUEUE: true
    INSIDE METHOD: false
    INSIDE METHOD: false
    User Dustin destroyed. 9
    User Joe destroyed. 9
    User Dustin destroyed. 9
    User Dustin destroyed. 9
    User Dustin destroyed. 9
    User Dustin destroyed. 9
    INSIDE METHOD: true
    INSIDE METHOD: false
    USER QUEUE: true
    INSIDE METHOD: false
    INSIDE METHOD: false
    INSIDE METHOD: true
    INSIDE METHOD: false
    USER QUEUE: true
    INSIDE METHOD: false
    INSIDE METHOD: false
    It really does seem to me like finalize is being called multiple times for the same object.
    That number should incremement for every instantiated User, and finalize can only be called once for each User object.
    I thought this was impossible?
    Any help is appreciated!

    Thanks...
    I am already thinking of ideas to limit the number of threads.
    Unfortunately there are two threads of execution in the servlet handler, one handles requests and the other parses the collection of User objects to check for out of date timestamps, and then eliminates them if they are out of date.
    The collection parsing thread is currently a javax.swing.Timer thread (Bad design I know...) so I believe that I can routinely check for timestamps in another way and fix that problem.
    Just found out too that Tomcat was throwing me a ConcurrentModificationException as well, which may help explain the slew of mysterious behavior from my servlet!
    The Timer thread has to go. I got to think of a better way to routinely weed out User objects from the collection.
    Or perhaps, maybe I can attempt to make it thread safe???
    Eg. make my User collection volatile?
    Any opinions on the best approach are well appreciated.

  • Backing  Bean constructor getting called multiple times

    I have a List of records in the Table with a link Add.
    When i click Add i show a popup dialog which is attached to the dialogListener.
    On clicking OK on the dialog i want to add a record in the List in the backing Bean, but the Bean constructor is getting called multiple times.
    and the list to which the table is attached is also getting called multiple times.
    is there a way in which the method gets called only once?
    Message was edited by:
    user607056

    Hi!
    af:table have property ContentDelivery. When <default> (lazy), the table "frame" iz rendered in first page cycle, and content (rows in table) are fetched lazy i.e. in second cycle. Thus, your backing bean is constructed twice.
    If you set ContentDelivery to immediate, the table including data rows is generated in single page cycle thus your backing bean is constructed only once.
    Hope this helps,
    PaKo

  • How to return Values from Oracle Object Type to Java Class Object

    Hello,
    i have created an Oracle Object Types in the Database. Then i created Java classes with "jpub" of these types. Here is an example of the type.
    CREATE OR REPLACE TYPE person_type AS OBJECT
    ID NUMBER,
    vorname VARCHAR2(30),
    nachname VARCHAR2(30),
    geburtstag DATE,
    CONSTRUCTOR FUNCTION person_type RETURN SELF AS RESULT,
    CONSTRUCTOR FUNCTION person_type(p_id NUMBER) RETURN SELF AS RESULT,
    CONSTRUCTOR FUNCTION person_type(p_vorname VARCHAR2,
    p_nachname VARCHAR2,
    p_geburtstag DATE) RETURN SELF AS RESULT,
    MEMBER FUNCTION object_exists(p_id NUMBER) RETURN BOOLEAN,
    MEMBER PROCEDURE load_object(p_id NUMBER),
    MEMBER PROCEDURE save_object,
    MEMBER PROCEDURE insert_object,
    MEMBER PROCEDURE update_object,
    MEMBER PROCEDURE delete_object
    MEMBER PROCEDURE load_object(p_id NUMBER) IS
    BEGIN
    SELECT p.id, p.vorname, p.nachname, p.geburtstag
    INTO SELF.ID, SELF.vorname, self.nachname, SELF.geburtstag
    FROM person p
    WHERE p.id = p_id;
    END;
    My problem is, that if i use the member function "load_object" from my java app it doesnt return the selected values to the java class and i dont know why. I use the java class like this:
    PersonObjectType p = new PersonObjectType();
    p.load_object(4);
    There is a reocrd in the database with id = 4 and the function will execute successful. But if i try to use "p.getVorname()" i always get "NULL". Can someone tell me how to do that?
    Thanks a lot.
    Edited by: NTbc on 13.07.2010 15:36
    Edited by: NTbc on 13.07.2010 15:36

    CallableStatement =
    "DECLARE
    a person_type;
    BEGIN
    a.load_object(4);
    ? := a;
    END;"
    And register as an out parameter.
    Edited by: michael76 on 14.07.2010 05:01

  • Generic Data Source is calling multiple times in RSA3

    [color:red}<Moderator Message: This topic has alread been discussed a lot of times. Additionally there are weblogs related to it. Please search the forums and/or the blogs for this issue>
    Hi experts,
    I have the requirement to get data from Generic Data Sources with function Module,
    after finishing the FM I have checked in extact checker(RSA)
    in the internal table I_T_DATA is displays 281 records,
    but in RSA3 it shows 112560 records, I found that the FM is calling multiple time by executing one time in RSA3.
    1.what would be the problem
    2.where is the porblem is it in FM coding or any other places to check.
    <removed by moderator>
    Regards
    Vijay
    Edited by: Siegfried Szameitat on Feb 3, 2009 11:45 AM

    Hi Savita,
    I don't understand clearly from your reply regarding flow you transported and what all you transported.
    You need to first transport objects in R/3 and import them.
    Then transport Infoprovider, Datasource in BI assuming depenedent Infoare Infoobject, application component already transported.
    Then transport your Infosource, Update rule, Transfer rules, Infopackage.
    Hope you understood.
    Ravi

  • Invoking stored procedure that returns array(oracle object type) as output

    Hi,
    We have stored procedures which returns arrays(oracle type) as an output, can anyone shed some light on how to map those arrays using JPA annotations? I tried using jdbcTypeName but i was getting wrong type or argument error, your help is very much appreciated. Below is the code snippet.
    JPA Class:
    import java.io.Serializable;
    import java.sql.Array;
    import java.util.List;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import org.eclipse.persistence.annotations.Direction;
    import org.eclipse.persistence.annotations.NamedStoredProcedureQuery;
    import org.eclipse.persistence.annotations.StoredProcedureParameter;
    * The persistent class for the MessagePublish database table.
    @Entity
    @NamedStoredProcedureQuery(name="GetTeamMembersDetails",
         procedureName="team_emp_maintenance_pkg.get_user_team_roles",
         resultClass=TeamMembersDetails.class,
         returnsResultSet=true,
         parameters={  
         @StoredProcedureParameter(queryParameter="userId",name="I_USER_ID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="employeeId",name="I_EMPLOYEEID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="TEAMMEMBERSDETAILSOT",name="O_TEAM_ROLES",direction=Direction.OUT,jdbcTypeName="OBJ_TEAM_ROLES"),
         @StoredProcedureParameter(queryParameter="debugMode",name="I_DEBUGMODE",direction=Direction.IN,type=Long.class)
    public class TeamMembersDetails implements Serializable {
         private static final long serialVersionUID = 1L;
    @Id
         private long userId;
         private List<TeamMembersDetailsOT> teamMembersDetailsOT;
         public void setTeamMembersDetailsOT(List<TeamMembersDetailsOT> teamMembersDetailsOT) {
              this.teamMembersDetailsOT = teamMembersDetailsOT;
         public List<TeamMembersDetailsOT> getTeamMembersDetailsOT() {
              return teamMembersDetailsOT;
    Procedure
    PROCEDURE get_user_team_roles (
    i_user_id IN ue_user.user_id%TYPE
    , o_team_roles OUT OBJ_TEAM_ROLES_ARRAY
    , i_debugmode IN NUMBER :=0)
    AS
    OBJ_TEAM_ROLES_ARRAY contains create or replace TYPE OBJ_TEAM_ROLES_ARRAY AS TABLE OF OBJ_TEAM_ROLES;
    TeamMembersDetailsOT contains the same attributes defined in the OBJ_TEAM_ROLES.

    A few things.
    You are not using a JDBC Array type in your procedure, you are using a PLSQL TABLE type. An Array type would be a VARRAY in Oracle. EclipseLink supports both VARRAY and TABLE types, but TABLE types are more complex as Oracle JDBC does not support them, they must be wrapped in a corresponding VARRAY type. I assume your OBJ_TEAM_ROLES is also not an OBJECT TYPE but a PLSQL RECORD type, this has the same issue.
    Your procedure does not return a result set, so "returnsResultSet=true" should be "returnsResultSet=false".
    In general I would recommend you change your stored procedure to just return a select from a table using an OUT CURSOR, that is the easiest way to return data from an Oracle stored procedure.
    If you must use the PLSQL types, then you will need to create wrapper VARRAY and OBJECT TYPEs. In EclipseLink you must use a PLSQLStoredProcedureCall to access these using the code API, there is not annotation support. Or you could create your own wrapper stored procedure that converts the PLSQL types to OBJECT TYPEs, and call the wrapper stored procedure.
    To map to Oracle VARRAY and OBJECT TYPEs the JDBC Array and Struct types are used, these are supported using EclipseLink ObjectRelationalDataTypeDescriptor and mappings. These must be defined through the code API, as there is currently no annotation support.
    I could not find any good examples or doc on this, your best source of example is the EclipseLink test cases in SVN,
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/plsql/
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/customsqlstoredprocedures/
    James : http://www.eclipselink.org

  • Working with oracle object type tables

    Hi,
    I've created a table which only contains Oracle object types (e.g. CREATE TABLE x OF <...>). When I create an Entity for this table using the Entity wizard, I end up with an entity with the attributes of the base object type and two special attributes REF$ (reference to the object type instance) and SYS_NC_OID$ (unique object identifier). The REF$ attribute is on the Java side of type oracle.jbo.domain.Ref and the other attribute is on the Java side a simple String.
    It seems this only allows me to save objects of the base type in this table. First of all in my situation this is also impossible because the base type is not instantiable. What I do want is to save several different subtypes into this table using the BC4J custom domain mechanism. Is there any way to make this possible? I first thought I could maybe do something with the special REF$ attribute, but this doesn't seem te case. So I might need to override most of the EntityImpl methods, like doUML, remove etc. Am I right? And does anyone have any hints on how to do this?
    Regards,
    Peter

    Peter:
    Hi,
    I've created a table which only contains Oracle
    object types (e.g. CREATE TABLE x OF <...>).
    When I create an Entity for this table using the
    Entity wizard, I end up with an entity with the
    attributes of the base object type and two special
    attributes REF$ (reference to the object type
    instance) and SYS_NC_OID$ (unique object identifier).
    The REF$ attribute is on the Java side of type
    oracle.jbo.domain.Ref and the other attribute is on
    the Java side a simple String.
    It seems this only allows me to save objects of the
    base type in this table. First of all in my situation
    this is also impossible because the base type is not
    instantiable. What I do want is to save several
    different subtypes into this table using the BC4J
    custom domain mechanism. Is there any way to make
    this possible? Sorry, but this is not supported out of the box.
    Since you have an object table, you wouldn't use domains to achieve this. Instead, you would have a superclass and subclass entity objects, e.g., PersonEO subclassed into StudentEO and EmployeeEO.
    I first thought I could maybe do
    something with the special REF$ attribute, but this
    doesn't seem te case. So I might need to override
    most of the EntityImpl methods, like doUML, remove
    etc. Am I right? And does anyone have any hints on
    how to do this?
    If you want, you can try this by overridding EntityImpl's:
       protected StringBuffer buildDMLStatement(int operation,
          AttributeDefImpl[] allAttrs,
          AttributeDefImpl[] retCols,
          AttributeDefImpl[] retKeys,
          boolean batchMode)
    and
       protected int bindDMLStatement(int operation,
          PreparedStatement stmt,
          AttributeDefImpl[] allAttrs,
          AttributeDefImpl[] retCols,
          AttributeDefImpl[] retKeys,
          HashMap retrList,
          boolean batchMode) throws SQLException
    Handle the case when operation == DML_INSERT.
    There, build an insert statement with substitutable row, e.g.:
    INSERT INTO persons VALUES (person_t('Bob', 1234));
    INSERT INTO persons VALUES (employee_t('Joe', 32456, 12, 100000));
    where person_t and employee_t are database types and you are invoking the respective constructor.
    Thanks.
    Sung

  • CommandLink Disabled called multiple times

    Hello,
    I'm developing a brief method to enable/disable af:commandLink on certain condition.
    The layout is simple: a table to the left and a panelTabbed to the right. PanelTabbed has a partialTrigger to the table.
    In a visible tab there is a commandLink with Disabled attribute bound to a backingBean method.
    In this method I placed a System.out.println and I can see that this method is called multiple times.
    On pagestart the method is called 2 times.
    On table current row change the method is called 3 times.
    On tab change out of first tab 1 time.
    On tab change to first tab 2 times.
    I wen through all the way from commandLink to top component and there are no additional partialTriggers.
    Could someone explain this to me, please?
    Thanks.
    ADF 11.1.1.4

    Ilya,
    Have you tried using the ADF logger (see [url http://blogs.oracle.com/groundside/entry/adventures_in_logging_index]this blog for lots of details, especially part 5)? Replace your System.out.println calls with calls to the logger, crank up the logging level and use the log analyser to see by ADF/JSF phase when things are called.
    John

  • On Execute operation, the bean getter is being called multiple times

    Hi,
    I have a JCR data control, i am trying to write a method that returns predicate, but this method is being called multiple times, when executing the advanced search operation.
      public List<Predicate> getPredicates() {
      ArrayList<Predicate> predicates = new ArrayList<Predicate>();
       // predicates.add(new Predicate("jcr:content/idc:metadata/idc:xScope",Operator.EQUALS,"GLOBAL"));
      DCBindingContainer bc=(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
      JUCtrlListBinding attrBinding=(JUCtrlListBinding)  bc.findCtrlBinding("StateId");
      Object stateId= attrBinding.getSelectedValue();
      if(stateId instanceof Row){
      predicates.add(new Predicate("jcr:content/idc:metadata/idc:xState"
      , Operator.EQUALS
      ,((Row)stateId).getAttribute("StateId").toString()));
      attrBinding=(JUCtrlListBinding)  bc.findCtrlBinding("DistrictId");
      Object districtId=attrBinding.getSelectedValue();
      if(districtId instanceof Row){
          predicates.add(new Predicate("jcr:content/idc:metadata/idc:xDistrict",Operator.EQUALS,((Row)districtId).getAttribute("DistrictId").toString()));
        attrBinding=(JUCtrlListBinding)  bc.findCtrlBinding("Scope");
        Object scopeId=attrBinding.getSelectedValue();
        if(scopeId instanceof Row){
            predicates.add(new Predicate("jcr:content/idc:metadata/idc:xScope",Operator.EQUALS,((Row)scopeId).getAttribute("ScopeType")));
        AttributeBinding tempAttrBinding=(AttributeBinding)bc.findCtrlBinding("CreatedDate");
        Object createdDate=tempAttrBinding.getInputValue();
        if(createdDate!=null){
            predicates.add(new Predicate("jcr:content/jcr:created",Operator.EQUALS,createdDate.toString()));
        if (predicates.size()>0){
          return predicates;
      return Collections.emptyList();
      } The problem is while it's being called multiple times different list's are being returned which is causing the method not to work . The bean is in pageFlowScope .

    That is bc ADF life cicle... Is always executing 2 times...

  • Calling multiple times BAPI_GOODSMVT_CREATE getting error

    Hi Friends,
    I am calling multiple times BAPI_GOODSMVT_CREATE for same Purchase order to post goods receipt.
    for the first 4 times it is creating the GR successfully, but then it returning the message 'No goods receipt possible for purchase order 4500001004 01350'.
    Please help.
    Thanks
    Ravi

    Use Wait up to statement in loop.
    Ex:
    loop at it_filedir1.
        REFRESH I_TAB.
        CLEAR I_TAB.
       REFRESH I_TAB2.
       REFRESH ITAB1.
        data: g_file(100) type c .
        name = it_filedir1-name.
        concatenate: gfile '\' name into g_file.
        data : i_tab1(500).
        OPEN DATASET g_file FOR INPUT IN TEXT MODE
                                         ENCODING DEFAULT
                                         IGNORING CONVERSION ERRORS.
        IF SY-SUBRC EQ 0.
          DO.
            READ DATASET g_file INTO i_tab1.
            if sy-subrc = 0.
              split i_tab1 at ',' into  I_TAB-SOL_DOCNO I_TAB-SOL_DOCDT
               I_TAB-GI_TXN_TYPE I_TAB-WERKS I_TAB-LGOBE I_TAB-MATNR
               I_TAB-ERFMG I_TAB-ERFME.
            else.
              exit.
            endif.
            APPEND I_TAB.
            clear I_TAB.
          ENDDO.
        ENDIF.
        CLOSE DATASET g_file.
        concatenate: hfile '\' name into h_file.
        REFRESH I_MAIN.
        CLEAR I_MAIN.
        I_MAIN[] = I_TAB[].
        REFRESH I_OUT.
        CLEAR I_TAB.
        I_OUT[] = I_TAB[].
        DELETE ADJACENT DUPLICATES FROM I_TAB COMPARING SOL_DOCNO.
        SORT I_TAB BY SOL_DOCNO.
        LOOP AT I_TAB.
          count = sy-tabix.
          SELECT SINGLE * FROM ZMM_GI_WIP
                                    WHERE GI_NO = I_TAB-SOL_DOCNO AND
                                    GI_DATE = I_TAB-SOL_DOCDT.
          IF SY-SUBRC = 0.
            I_TAB-FLAG = 'C'.
            modify i_tab index count.
            CONCATENATE 'ERROR  GI : ' I_TAB-SOL_DOCNO
            '  WAS ALREADY UPLOADED' INTO I_MSG1.
            APPEND I_MSG1.
            CLEAR I_TAB-FLAG.
            CONTINUE.
          ELSE.
            CONCATENATE I_TAB-SOL_DOCDT+4(2)
                        I_TAB-SOL_DOCDT+6(2)
                        I_TAB-SOL_DOCDT+2(2)
                        I_TAB-SOL_DOCDT+0(2)
                        INTO G_DATE.
            gmhead-pstng_date = G_DATE.
            gmhead-doc_date = sy-datum.
            gmhead-pr_uname = sy-uname.
    "01 - MB01 - Goods Receipts for Purchase Order
            gmcode-gm_code = '03'.
            refresh itab.
            clear itab.
            SORT I_MAIN BY SOL_DOCNO.
            LOOP AT I_MAIN WHERE SOL_DOCNO = I_TAB-SOL_DOCNO.
              IF I_MAIN-GI_TXN_TYPE = 'RMGI'.
                itab-move_type  = '291'.
              ENDIF.
              itab-mvt_ind    = ' '.
              itab-plant      = I_MAIN-WERKS.
              itab-material   = I_MAIN-MATNR.
              itab-entry_qnt  = I_MAIN-ERFMG.
             itab-stge_loc   = 'OMR1'.
    itab-move_stloc = pcitab-recv_loc.
              itab-stge_loc   = I_MAIN-LGOBE.
              itab-ENTRY_UOM = I_MAIN-ERFME.
              IF I_MAIN-WERKS = 'OMR'.
                itab-TR_PART_BA = '11'.
              ELSEIF I_MAIN-WERKS = 'OMR'.
                itab-TR_PART_BA = '12'.
              ENDIF.
              append itab.
            ENDLOOP.
            if not itab[] is initial.
              call function 'BAPI_GOODSMVT_CREATE'
               exporting
                   goodsmvt_header             = gmhead
                   goodsmvt_code               = gmcode
                 *   TESTRUN                     = ' '
              IMPORTING
                  goodsmvt_headret            = mthead
             *   MATERIALDOCUMENT            =
      MATDOCUMENTYEAR             =
               tables
                 goodsmvt_item               = itab
      GOODSMVT_SERIALNUMBER       =
                return                      = errmsg.
              clear errflag.
              loop at errmsg.
                if errmsg-type eq 'E'.
                  write:/'Error in function', errmsg-message.
                  errflag = 'X'.
                else.
                  write:/ errmsg-message.
                endif.
                move errmsg-message to i_msg1.
                append i_msg1.
              endloop.
              if errflag is initial.
                CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                WAIT          =
              IMPORTING
                RETURN        =
               commit work and wait.
                if sy-subrc ne 0.
                  write:/ 'Error in updating'.
                  exit.
                else.
                  write:/ mthead-mat_doc, mthead-doc_year.
                  ZMM_GI_WIP-GI_NO = I_TAB-SOL_DOCNO.
                  ZMM_GI_WIP-GI_DATE = I_TAB-SOL_DOCDT.
                  INSERT ZMM_GI_WIP.
                  COMMIT WORK.
                  I_TAB-FLAG = 'C'.
                  MODIFY I_TAB INDEX COUNT.
                  CONCATENATE mthead-mat_doc  mthead-doc_year
                             into i_msg1.
                  append i_msg1.
                 perform upd_sta.
                endif.
              endif.
            endif.
          ENDIF.
           wait up to 20 seconds.
        ENDLOOP.

  • ERD and oracle object types

    Is there a good way to model oracle object types using ERD's in designer 6i. I can only figure out how to map to tables with columns of predefined datatypes (varchar2, number, date, long). I'd like to use designer to create new datatypes. Is this possible? Thanks.

    Hi Wiiliam
    Sorry for the late acknowledgement (i dozed off!).. Thanks for the response. So the private instance specific to a session ensure that theres no conflict between multiple requests to the same stored proc and hence no conflict of data... Great
    Chaitanya

  • Problem using Oracle Object Types and Arrays.

    I'm currently trying to work with oracle object types in java and I'm running into some issues when trying to add an item to an array.
    The basic idea is that I have a header object and a detail object (both only containing an ID and a description). Inside of my java code I'm trying to add a new detail line to the header that has been retrieved from the database.
    Here's what I'm working with.
    --Oracle Objects:
    CREATE OR REPLACE TYPE dtl_obj AS OBJECT
        detail_id INTEGER,
        header_id INTEGER,
        detail_desc VARCHAR2(300)
    CREATE TYPE dtl_tab AS TABLE OF dtl_obj;
    CREATE OR REPLACE TYPE hdr_obj AS OBJECT
        header_id INTEGER,
        src VARCHAR(30),
        details dtl_tab
    CREATE TYPE hdr_tab AS TABLE OF hdr_obj;
    /--Java test methods
         public static void main(String[] args) throws SQLException,
                   ClassNotFoundException
              // Initialize the objects
              Test t = new Test();
              t.connect(); //Connects to the database
              //The oracle connection will be accessible through t.conn
              // Create the oracle call
              String query = "{? = call get_header(?)}";
              OracleCallableStatement cs = (OracleCallableStatement) t.conn.prepareCall(query);
              cs.registerOutParameter(1, OracleTypes.ARRAY, "HDR_TAB"); //Register the out parameter and associate it with our oracle type
              int[] hdrs = { 240 }; //we just want one for testing.
              ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor(
                        "ARRAY_T", t.conn);
              oracle.sql.ARRAY oHdrs = new ARRAY(descriptor, t.conn, hdrs);
              cs.setARRAY(2, oHdrs); //Set the headers to retrieve
              // Execute the query
              cs.executeQuery();
              try
                   ARRAY invArray = cs.getARRAY(1);
                   // Start the retrieval process
                   Class cls = Class.forName(Header.class.getName());
                   Map<String, Class<?>> map = t.conn.getTypeMap();
                   map.put(Header._SQL_NAME, cls);
                   Object[] invoices = (Object[]) invArray.getArray();
                   ArrayList<Header> invs = new ArrayList(
                             java.util.Arrays.asList(invoices));
                   if (invs != null)
                        for (Header inv : invs)
                             System.out.println(inv.getHeaderId() + " " + inv.getSrc());
                             t.addDetail(inv, "new line");
                             for (Detail dtl : inv.getDetails().getArray()) // Exception thrown here
    //                              java.sql.SQLException: Fail to construct descriptor: Invalid arguments
    //                              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    //                              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
    //                              at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
    //                              at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:128)
    //                              at oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:109)
    //                              at com.pcr.tst.Detail.toDatum(Detail.java:40)
    //                              at oracle.jpub.runtime.Util._convertToOracle(Util.java:151)
    //                              at oracle.jpub.runtime.Util.convertToOracle(Util.java:138)
    //                              at oracle.jpub.runtime.MutableArray.getDatumElement(MutableArray.java:1102)
    //                              at oracle.jpub.runtime.MutableArray.getOracleArray(MutableArray.java:550)
    //                              at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:689)
    //                              at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:695)
    //                              at com.pcr.tst.DetailTable.getArray(DetailTable.java:76)
    //                              at com.pcr.tst.Test.main(Test.java:91)
                                  System.out.println(dtl.getDetailDesc());
              catch (Exception ex)
                   System.out.println("Error while retreiving header");
                   ex.printStackTrace();
              public void addDetail(Header hdr, String desc) throws Exception
              if (hdr == null)
                   throw new Exception("header not initialized");
              // Convert the current list to an ArrayList so we can easily add to it.
              ArrayList<Detail> dtlLst = new ArrayList<Detail>();
              dtlLst.addAll(java.util.Arrays.asList(hdr.getDetails().getArray()));
              // Create the new detail
              Detail dtl = new Detail();
              dtl.setDetailDesc(desc);
              // add the new detail
              dtlLst.add(dtl);
              Detail[] ies = new Detail[dtlLst.size()];
              ies = dtlLst.toArray(new Detail[0]);
              DetailTable iet = new DetailTable(ies);
              hdr.setDetails(iet);
         }I know its the addDetail method causing the issue because if I comment out the t.addDetail(inv, "new line"); call it works fine.
    Message was edited by:
    pcristini

    Oracle® Database Object-Relational Developer's Guide
    Also note that object relational database design is often less performant and scalable than relational. It is not very often used in production environments.
    However, the object orientated programming feature that is provided with Oracle object feature set are used and can make development and interfaces a lot easier.
    So in a nutshell. Say no to ref and nested table columns. Say yes to most of the other object features. IMO of course...

  • Php include file getting called multiple times

    I have created a form in file career.php. To carry out the validation user_registration.php is called at the beginning of the file.
    user_registration.php in turn calls library.php. Issue is that library.php is getting called multiple times.
    I have attached phperror.log which confirms the same.
    career.php
    <?php
    session_start();
    require_once('phpScript/user_registration.php');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    user_registration.php
    <?php // This file is used for validating user form data. It calls process_upload.php to validate file uploaded by user
    $errors = array();  
    $messages = array();
    $testing = TRUE;
    error_log("Enter- user_registration.php. Testing mode $testing", 0);
    try {
              error_log("user_registration.php: Entered try catch block",0);
    require_once('library.php');
              error_log("Successfully called library.php",0);
              $public_key = '6LeDsNUSAAAAAIoaYuNhGm2zx_qgBECiybUWUkt6';
              $private_key = '6LeDsNUSAAAAACuvmJrec-_5seLdmhqUMngt8AiU';
              $recaptcha = new Zend_Service_ReCaptcha($public_key, $private_key);
              if(isset($_POST['submit'])) {          // Only execute if form is submitted by user
                error_log("user_registration.php. Submit button pressed by user", 0);
                require_once('Zend/Mail.php');
                $mail = new Zend_Mail('UTF-8');
                if (isset($_POST['name'])) {
                        $val = new Zend_Validate_Regex('/^\p{L}+[-\'\p{L} ]+$/u');
                        if (!$val->isValid($_POST['name'])) {
                          $errors['name'] = "Please enter your name, no numbers permitted";
    error_log("Exit- user_registration.php.", 0);
    library.php
    <?php
    error_log("Enter- library.php. Testing mode $testing", 0);
    if ($testing)  // If true then go to testing mode
              $library = '/Applications/MAMP/htdocs/mgtools-india/ZendFramework/library';
              set_include_path(get_include_path() . PATH_SEPARATOR . $library);
    require_once('Zend/Loader/Autoloader.php');
    try {
    Zend_Loader_Autoloader::getInstance();
    error_log("Exit- library.php. Testing mode $testing", 0);
    phperror.log
    Marker - 12-Oct-2012 10:27:26 AM
    [12-Oct-2012 04:57:33 UTC] Enter- user_registration.php. Testing mode 1
    [12-Oct-2012 04:57:33 UTC] user_registration.php: Entered try catch block
    [12-Oct-2012 04:57:33 UTC] Enter- library.php. Testing mode 1
    [12-Oct-2012 04:57:33 UTC] Exit- library.php. Testing mode 1
    [12-Oct-2012 04:57:33 UTC] Successfully called library.php
    [12-Oct-2012 04:57:36 UTC] Enter- user_registration.php. Testing mode 1
    [12-Oct-2012 04:57:36 UTC] Entered try catch block
    [12-Oct-2012 04:57:36 UTC] Enter- library.php. Testing mode 1
    [12-Oct-2012 04:57:36 UTC] Exit- library.php. Testing mode 1
    [12-Oct-2012 04:57:36 UTC] Successfully called library.php
    [12-Oct-2012 04:58:38 UTC] Enter- user_registration.php. Testing mode 1
    [12-Oct-2012 04:58:38 UTC] Entered try catch block
    [12-Oct-2012 04:58:38 UTC] Enter- library.php. Testing mode 1
    [12-Oct-2012 04:58:38 UTC] Exit- library.php. Testing mode 1
    [12-Oct-2012 04:58:38 UTC] Successfully called library.php
    [12-Oct-2012 04:58:38 UTC] user_registration.php. Submit button pressed by user
    [12-Oct-2012 04:58:39 UTC] user_registration.php, Processing enquiry form
    [12-Oct-2012 04:58:39 UTC] Enter- process_upload.php. Testing mode 1
    [12-Oct-2012 04:59:01 UTC] Exit- user_registration.php.
    I am not able to understand why user_registration.php and library.php are executing again and again.
    I ran this test on local testing server MAMP.
    The results are the same on remote server also.
    Please guide.

    I'm not sure what's happening there. The important question is whether the code is executed successfully.
    Since you're using the Zend Framework, it might be better to ask in a dedicated ZF forum.

  • Oracle Object Types vs. Table Fields

    Hello, all.
    I`m totally new to Oracle, and I am facing a very hard problem for me, and I would like to ask your help.
    I've been working on a project which uses Oracle Object Types, from a database of a legacy system.
    I did not know Oracle Objects until 5 minutes ago, so sorry If I say something stupid:
    Per my understanding, a Oracle Object Type can be formed by fields like myField varchar(200)... and fields from an existing table or view.
    I have a lot of objects on my system and I need to map each field and its respective table or view that compose each object.
    Does anyone have a query for that? I think it should be common, but I could not find anything at google (maybe I don`t which terms use to find...)
    I would be very thankful if somebody could help (save) me.
    Thanks in advance.
    Paulo

    First, it would help if you post what you object types look like.
    I'm assuming they may look something like this:
    SQL> create TYPE emp_type AS OBJECT
      2    (emp_id   NUMBER,
      3     name VARCHAR2(20));
      4  /
    Type created.
    SQL> create TYPE emp_tab IS TABLE OF emp_type;
      2  /
    Type created.
    SQL> create or replace package emp_test as
      2  procedure get_emps;
      3  end emp_test ;
      4  /
    Package created.
    SQL> create or replace package body emp_test as
      2    employees emp_tab := emp_tab();
      3    procedure get_emps as
      4      g_rc sys_refcursor;
      5  BEGIN
      6    employees.EXTEND(2);
      7    employees(1) := emp_type (1, 'John Smith');
      8    employees(2) := emp_type (2, 'William Jones');
      9    OPEN g_rc FOR
    10    SELECT * FROM TABLE (CAST (employees AS emp_tab));
    11  END get_emps ;
    12  end emp_test ;
    13  /
    Package body created.

  • ADF Faces Tree - getChildren() called multiple times

    Hi,
    I have a simple tree based on the demo's 'tree.jspx'. Each time I click on a node in this tree, I see that TreeNodeImpl.getChildren() gets called multiple times for each node. This is not an issue in tree.jspx where the tree is static. However in a case where tree is constructed dynamically based on the back end state, it is going to hurt performance. Each getChildren() call then invokes backend methods which could be remote. So multiple getChildren() will invoke backend methods multiple times.
    Is this behavior of calling getChildren() multiple times per node a bug? Is there any way for me to avoid it?

    this is expected behaviour.
    Your tree model should cache data and prevent the multiple calls to the back end.

Maybe you are looking for

  • Errot while activating ODS in BI 7.0

    Hi guys,             I created a ODS with a set of data fields and key fields...I am trying to activate it and its not getting activated. A error message is coming up as  - Object  cannot be activated. please help thanks, Vikki.

  • How do is setup my iphone to print on my laserjet cp5525

    i am trying to get my iphone app to see my printer on my phone in the hp eprint app i am on the connect to the hp eprint enterprise screen.  it is asking me for a host name i used the host name that is in the web access that did not work and i entere

  • CUCCX script issue

    We are running CUCCX 7.  We have a script that prompts the caller to enter their "control ID"  (4 digit account number) It then does a DB Read to a database we created this does a read then populates the enterprise parameters displayed in the agent d

  • Replace devfsd with udev from "testing"? [Y/n]

    pacman -Syu keeps asking me this: :: Replace devfsd with udev from "testing"? [Y/n] n but im already using udev. why?

  • What's with the lousy WiFi on 3.0

    The wifi on 3.0 is as bad as edge on the iPhone 1st gen. Why?