Persisting Instance Variables in Object Types across PL/SQL Calls

How can I persist instance variables in my java class/object across PL/SQL calls via a PL/SQL object type.
What I am finding is that if I do not have an attribute defined in my PL/SQL datatype that the value is not persisted between calls on the object in the PL/SQL environment. I am using the SQLData interface.
Should I create a static variable that uses the singleton pattern?
Any insights appreciated.

How can I persist instance variables in my java class/object across PL/SQL calls via a PL/SQL object type.
What I am finding is that if I do not have an attribute defined in my PL/SQL datatype that the value is not persisted between calls on the object in the PL/SQL environment. I am using the SQLData interface.
Should I create a static variable that uses the singleton pattern?
Any insights appreciated.

Similar Messages

  • Arbitrary object types in PL/SQL call with OCI for Oracle 9.2

    Hi,
    i'm trying to develop a generic library that is able to execute a call to a pl/sql with a generic list of types.
    If the objects are native (i.e. number, varchar2...) works fine, but i cannot understand how to do the same with a generic user defined object.
    For example:
    CREATE OR REPLACE TYPE A AS object (
         B     VARCHAR2(40),
         C          CLOB
    CREATE OR REPLACE TYPE D AS object (
         E     A
    And the pl/sql:
    CREATE OR REPLACE PACKAGE PLSQL_EX IS
         PROCEDURE exempl (inInfo IN OUT D);                                   
    END PLSQL_EX ;
    Do you have an example of how to do this ??, obviously i dont whant to use the OTT, because i want the maximum level of flexibility. I think i have to use the OCIObjectNew functions and the related ones, but i don't know how.
    thanks.
    Best regards,
    Stefano.

    Hi,
    i'trying to solve the problem with this code (just use of set Object attribute and get object Attribute) , but it doesn't work:
    #define SQLCA_NONE
    #define ORACA_NONE
    EXEC SQL BEGIN DECLARE SECTION;
         sql_context sqlCtx;
         char* dbName = "dbName";
         char* oraPwd;
         char* oraConnection;
         char* oraUsr;
    EXEC SQL END DECLARE SECTION;
    #include <iostream.h>
    #include <stdlib.h>
    #include <string>
    #include <sql2oci.h>
    extern "C" {
         #include <orid.h>
    sword checkErr(sword status, OCIError * error)
         text errbuf[512];
         sb4 errcode = 0;
         int     errorCode = 0;
         string     errorDesc;
         switch (status) {
              case OCI_SUCCESS:
                   break;
              case OCI_SUCCESS_WITH_INFO:
                   OCIErrorGet((dvoid *)error, (ub4) 1, (text *) 0, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
                   errorDesc = (char *)errbuf;                    
                   cout << "error: " << errorDesc << endl;
                   break;
              case OCI_NEED_DATA:
                   cout << "warning: NEED DATA"<< endl;
                   break;
              case OCI_NO_DATA:
                   cout << "warning: NO DATA" << endl;
                   break;
              case OCI_ERROR:
                   OCIErrorGet((dvoid *)error, (ub4) 1, (text *) 0, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
                   errorDesc = (char *)errbuf;
                   cout << "error: " << errorDesc << endl;
                   break;
              case OCI_INVALID_HANDLE:
                   cout << "error: INVALID HANDLE" << endl;
                   break;
              case OCI_STILL_EXECUTING:
                   cout << "error: STILL EXECUTING" << endl;
                   break;
              case OCI_CONTINUE:
                   cout << "error: CONTINUE" << endl;
                   break;
              default:
                   cout << "error: ???" << endl;
                   break;
         return status;
    int main ()
         OCIType *           tdo;
         dvoid *           objectPointer;
         dvoid *          null_struct =(dvoid*) 0;
         OCIString *          message4AB= (OCIString *)0;
         OCIInd                ind4AB = OCI_IND_NOTNULL;
         ub4 len[] = {1};
         const char *attrName[] = {"B"};
         dvoid *               attr_null_struct =(dvoid* ) 0;
         OCIString*           newString = (OCIString*) 0;
         OCIType *          attr_tdo;
         OCIInd                newIndMessage = OCI_IND_NULL;
         OCITypeCode           typecode ;     
         OCIEnv *     mEnvHandler;
         OCISvcCtx *      mSvcEnv;
         OCIError *     mErrorHandler;
         oraUsr = (char*) "gpridb";
         oraPwd = (char*) "gpridb";
         oraConnection = "ic9su002";
         sqlca sqlca;
         EXEC SQL CONTEXT ALLOCATE :sqlCtx;
         EXEC SQL CONTEXT USE :sqlCtx;
         EXEC SQL CONNECT :oraUsr IDENTIFIED BY :oraPwd AT :dbName USING :oraConnection;
         if (SQL_ERROR == SQLEnvGet(sqlCtx, &mEnvHandler) ) {
              cout << "Error during creation of environment Handler"<< endl;
              exit (1);     
         if (SQL_ERROR == SQLSvcCtxGet(sqlCtx, (text *)dbName, (ub4) strlen(dbName), &mSvcEnv )) {
              cout << "Error during creation of svc Environment"<< endl;
              exit (1);     
         if (SQL_ERROR == OCIHandleAlloc( mEnvHandler, (dvoid **) &mErrorHandler, (ub4) OCI_HTYPE_ERROR, 0, (dvoid **) 0)){
              cout << "cannot initialize error handler" << endl;
              exit (1);
    checkErr (OCITypeByName ( mEnvHandler,mErrorHandler,mSvcEnv,(text *) 0,(ub4) 0,
                   (const text *) "A", (ub4) strlen ("A"),
                   (const text *)0, (ub4) 0,OCI_DURATION_SESSION,OCI_TYPEGET_ALL, &tdo),mErrorHandler);
    checkErr( OCIObjectNew ( mEnvHandler, mErrorHandler, mSvcEnv,OCI_TYPECODE_OBJECT,tdo, (dvoid*)0,
                   OCI_DURATION_SESSION,true ,&objectPointer),mErrorHandler);
    checkErr(OCIObjectGetInd (mEnvHandler, mErrorHandler,
    objectPointer, &null_struct ),mErrorHandler);
    checkErr(OCIStringAssignText (mEnvHandler,mErrorHandler, (text *) "INVIO",
    strlen ("INVIO") ,&message4AB),mErrorHandler);
    cout << "Value in string: " << (char *) OCIStringPtr(mEnvHandler, message4AB) << endl;
    checkErr(OCIObjectSetAttr (mEnvHandler, mErrorHandler, objectPointer, null_struct,
    tdo, (const text **) attrName , len, (ub4) 1,(ub4 *) 0,
    (ub4)0, ind4AB, &attr_null_struct,
    (dvoid *) message4AB),mErrorHandler);
    checkErr (OCIObjectGetAttr(mEnvHandler, mErrorHandler, objectPointer, null_struct, tdo,
                   (const text **) attrName, len, 1, (ub4 *)0, (ub4)0, &newIndMessage,&attr_null_struct,
                   (void **) &newString, &attr_tdo),mErrorHandler);
    typecode = OCITypeTypeCode(mEnvHandler, mErrorHandler, attr_tdo);
    if (newIndMessage == OCI_IND_NULL) {
              cout << "null"<< endl;
    } else {
         cout << "indicator: " << newIndMessage << endl;
         switch (typecode)
         case OCI_TYPECODE_DATE : /* fixed length string */
              cout << "date" << endl;
              break;
         case OCI_TYPECODE_RAW : /* RAW */
              cout << "raw" << endl;
              break;
         case OCI_TYPECODE_CHAR : /* fixed length string */
         case OCI_TYPECODE_VARCHAR : /* varchar */
         case OCI_TYPECODE_VARCHAR2 : /* varchar2 */
              cout << "vc" << endl;
              break;
         case OCI_TYPECODE_SIGNED8:
              cout << "sign" << endl;
              break;
         case OCI_TYPECODE_UNSIGNED8:
              cout << "uns" << endl;
              break;
         case OCI_TYPECODE_OCTET:
              cout << "octet" << endl;
              break;
         case OCI_TYPECODE_UNSIGNED16: /* UNSIGNED SHORT */
         case OCI_TYPECODE_UNSIGNED32: /* UNSIGNED LONG */
         case OCI_TYPECODE_REAL: /* REAL */
         case OCI_TYPECODE_DOUBLE: /* DOUBLE */
         case OCI_TYPECODE_INTEGER: /* INT */
         case OCI_TYPECODE_SIGNED16: /* SHORT */
         case OCI_TYPECODE_SIGNED32: /* LONG */
         case OCI_TYPECODE_DECIMAL: /* DECIMAL */
         case OCI_TYPECODE_FLOAT: /* FLOAT */
         case OCI_TYPECODE_NUMBER: /* NUMBER */
              cout << "num" << endl;
              break;
         default:
              cout << "defaut" << endl;
              break;
         char p = (char ) OCIStringPtr(mEnvHandler, newString);
         cout << " read from object (" << typecode << "): " << (char *) OCIStringPtr(mEnvHandler, newString) << endl;
    the output is:
    Value in string: INVIO
    indicator: 0
    vc
    read from object (9): @|

  • How to initialize the object type in pl/sql

    Hi,
    I am looking for an easy way to initialize the object type in pl/sql.
    I have created a object type with around 2 attributes.
    when ever i need to initialize the object ..need to pass:
    declare
    v_obj emp_obj;
    begin
    v_obj := emp_obj(null,null);
    then i can assign the values to object.
    Since I am having more than 50 attributes.. need to pass null to all the object attributes.
    is there any other way to initialize the object.
    thanking you in advance!!!

    RTFM [url http://oraclesvca2.oracle.com/docs/cd/B10501_01/appdev.920/a96594/adobjadv.htm#1008810]Advantages of User-Defined Constructors

  • Updating Object Type Columns with SQL

    Please note that is a re-post from a different forum. I thought I would try this forum as reading through it, it made more sense to post here. Problem:
    I am trying to update a column inside a Nested Table Type in my Table.
    This is what I got from some documentation I found from Oracle.
    UPDATE TABLE(SELECT PROGRAMS FROM TB_ITEM_MASTER WHERE ITEM_NO_ID =1748) IM
    SET IM.PROGRAM_ID = 1;
    WHERE IM.ITEM_NO_ID = 1748;
    Where PROGRAM_ID is a field from the nested table (ITEMS_IN_PROGRAMS_NT) and ITEM_NO_ID is the Primary Key in my TB_ITEM_MASTER table. When I run this it gives me an error of:
    ORA-22908: REFERENCE TO NULL TABLE VALUE
    I assume this is because PROGRAM_ID is currently NULL, and when it pulls the record back, I am pulling a NULL value. Currently all the values will be NULL in the table, but I would like to create a UPDATE Statement that I will call that will update that value, from NULL to whatever ID.
    Here are my def'n's of all my objects for this problem:
    --Object Type def'n
    CREATE OR REPLACE TYPE ITEMS_IN_PROGRAMS_TY AS OBJECT(
    PROGRAM_ID NUMBER(38));
    --Object Type def'n for Nested Table
    CREATE OR REPLACE TYPE ITEMS_IN_PROGRAMS_NT
    AS TABLE OF ITEMS_IN_PROGRAMS_TY;
    --Table def'n
    CREATE TABLE TB_ITEM_MASTER
    (ITEM_NO_ID NUMBER(38) NOT NULL,
    ITEM_NO VARCHAR2(75) NOT NULL,
    NOMENCLATURE VARCHAR2(100) NULL,
    PROGRAMS DMISDBA.ITEMS_IN_PROGRAMS_NT NULL);
    Can someone please help me....I am pulling my hair out on this problem!!! All I want to do is update the column inside a Nested Table. This can not be that hard!!!

    Save your hair...
    SQL> CREATE OR REPLACE TYPE items_in_programs_ty AS OBJECT(
      2  program_id NUMBER(38));
      3  /
    Type created.
    SQL> CREATE OR REPLACE TYPE items_in_programs_nt
      2  AS TABLE OF items_in_programs_ty;
      3  /
    Type created.
    SQL> CREATE TABLE tb_item_master
      2  (item_no_id number(38) not null,
      3  item_no varchar2(75) not null,
      4  nomenclature varchar2(100) null,
      5  programs items_in_programs_nt )
      6  NESTED TABLE programs STORE AS nested_programs
      7  /
    Table created.
    SQL>
    SQL> INSERT INTO tb_item_master (item_no_id, item_no, nomenclature)
      2  VALUES (1748, 'APC/1748', 'Gizmo')
      3  /
    1 row created.
    SQL> UPDATE tb_item_master tmi
      2  SET    tmi.programs =  items_in_programs_nt(items_in_programs_ty( 1))
      3  WHERE  tmi.item_no = 'APC/1748'
      4  /
    1 row updated.
    SQL>
    SQL> Cheers, APC

  • Single Persistent instance of a Object, Many non persistant. Same Identity on persist

    I have a persistent bean class with two Strings as member fields. (example
    below)
    I have many other classes that use it a part of they're member fields.
    I need to have only one persistant version of it (One row, to many Rows in
    different tables). But can have many non persistant versions. I can't
    control the creation of the non persistant objects.
    i.e.
    On persist, How can I configuration JDO to detect that it's the same as an
    object already in the database and use that instead?
    example:
    // Example class One
    package foo;
    public class One(){
    public String var1;
    public String var2;
    public String getVar1(){
    return this.var1;
    public void setVar1(String var1Set){
    this.var1 = var1Set
    public String getVar2(){
    return this.var2;
    public void setVar2(String var2Set){
    this.var2 = var2Set
    /// one.jdo
    <?xml version="1.0"?>
    <jdo>
    <package name="foo">
    <class name="One"/>
    </package>
    </jdo>
    ///Example Scenario
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database
    /// Some time later, in a different thread, or since JVM shutdown and
    restart
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database, instead of two.

    You cannot. You should either find the object by query or retrieve it
    using application identity.
    Graham Cruickshanks wrote:
    I have a persistent bean class with two Strings as member fields. (example
    below)
    I have many other classes that use it a part of they're member fields.
    I need to have only one persistant version of it (One row, to many Rows in
    different tables). But can have many non persistant versions. I can't
    control the creation of the non persistant objects.
    i.e.
    On persist, How can I configuration JDO to detect that it's the same as an
    object already in the database and use that instead?
    example:
    // Example class One
    package foo;
    public class One(){
    public String var1;
    public String var2;
    public String getVar1(){
    return this.var1;
    public void setVar1(String var1Set){
    this.var1 = var1Set
    public String getVar2(){
    return this.var2;
    public void setVar2(String var2Set){
    this.var2 = var2Set
    /// one.jdo
    <?xml version="1.0"?>
    <jdo>
    <package name="foo">
    <class name="One"/>
    </package>
    </jdo>
    ///Example Scenario
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database
    /// Some time later, in a different thread, or since JVM shutdown and
    restart
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database, instead of two.
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Please provide real time scenario for when we use object type in PL/SQL.

    Hi Experts,
    When we use this kind of code in PL/SQL block.
    CREATE OR REPLACE TYPE sample_object IS OBJECT
    (id       NUMBER
    ,name     VARCHAR2(30));
    CREATE OR REPLACE TYPE sample_table IS TABLE OF sample_object;I have read some docs ,but I didn't get any information where exactly we use this.
    Please provide one real time scenario with an example.
    How this is different from record.
    Thanks in advance.

    Hi,
    For an example please have a look at this....
    CREATE OR REPLACE TYPE FML_DAT_ITEMS_OBJ AS OBJECT
                      (F_NAME VARCHAR2 (20), L_NAME VARCHAR2 (20));
    CREATE OR REPLACE TYPE FML_DAT_ITEMS_FTAB AS TABLE OF FML_DAT_ITEMS_OBJ;
    CREATE OR REPLACE FUNCTION GET_FML_ITEMS_DAT (PFML_NR IN NUMBER)
       RETURN FML_DAT_ITEMS_FTAB
       PIPELINED
    AS
       OUT_REC   FML_DAT_ITEMS_OBJ;
    BEGIN
       SELECT FML_DAT_ITEMS_OBJ ('peter', 'zwan') INTO OUT_REC FROM DUAL;
       FOR I IN 1 .. PFML_NR
       LOOP
          PIPE ROW (OUT_REC);
       END LOOP;
    END GET_FML_ITEMS_DAT;To view the o/p:
    SELECT * FROM TABLE (get_fml_items_dat (5));
    F_NAME, L_NAME
    peter,zwan
    peter,zwan
    peter,zwan
    peter,zwan
    peter,zwan Refer these links to know more about the topic...
    http://www.oracle-developer.net/display.php?id=207
    http://www.oracle-base.com/articles/misc/pipelined-table-functions.php

  • How to invoke BPM object instance variable from interactive activity?

    I have a screenflow with an automatic activity "A" followed by an interactive activity "B". "B" calls a BPM object "X" and uses a JSP presentation to show its attributes. Is there a way to use another BPM object, say type "Y", create an instance variable of that type inside "A", and get its attributes values from the JSP page associated to "B"?
    Edited by: user6473912 on 20/07/2010 03:37 PM

    Try this. It assumes you have:
    <li> a user named "auto"
    <li> a project variable named "customerType"
    <li> an instance variable named "orderAmount" that is a decimal
    <li> an instance variable named "order" that is a BPM Object that has attributes named "customerName" and "amount"
    ps as ProcessService
    xmlObject as Fuego.Xml.XMLObject
    do 
      connectTo ps
          using url = Fuego.Server.directoryURL,
          user = "auto",
          password = "auto"
      instF as InstanceFilter
      create(instF, processService : ps)
      addAttributeTo(instF, variable : "customerType", comparator : IS, value : "Gold")
      instF.searchScope = SearchScope(participantScope : ParticipantScope.ALL, statusScope : StatusScope.ONLY_INPROCESS)
      for each inst in getInstancesByFilter(ps, filter : instF) do
        // here's how to get the value inside a primitive instance variable
        orderAmtObj as Object = getVar(inst, var : "orderAmount")
        // here's how to get the value of attributes inside a complex BPM Object instance variable
        //    - in this case this is an "order" object with two attributes (customerName and amount)
        orderObj as Object = (getVar(inst, var : "order"))
        xmlObject = Fuego.Xml.XMLObject(createXmlTextFor(DynamicXml, object : orderObj, topLevelTag : "xsi"))
        logMessage "The value of the order object's customer name is: " +
               selectString(xmlObject, xpath : "customerName")
        logMessage "The value of the order object's order amount is: " +
               selectNumber(xmlObject, xpath : "amount")
        // here's a rather uninspired way to retrieve who the participant is that was assigned the instance
        logMessage "The participant assigned to this instance is: " + inst.participantId
      end
    on exit
      disconnectFrom ps
    endDan

  • SSIS 2012 - Parent/Child Package "Object" Type Variables

    How do I pass Variables of Object type from Parent to Child packages?
    I am using the SSIS 2012 project deployment model.
    Thanks

    You can do it as outlined in
    http://sqlblog.com/blogs/andy_leonard/archive/2010/01/25/ssis-snack-passing-parent-starttime-to-the-child-package.aspx
    But
    When you need an object it is typically a recordset, then just pass the results, or execute the query in a package.
    Arthur My Blog

  • Can not call a static function with-in a instance of the object.

    Another FYI.
    I wanted to keep all of the "option" input parameters values for a new object that
    i am creating in one place. I thought that the easiest way would be to use a
    static function that returns a value; one function for each option value.
    I was looking for a way to define "constants" that are not stored in
    the persistent data of the object, but could be reference each time
    the object is used.
    After creating the static functions in both the "type" and "body" components,
    I created the method that acutally receives the option input values.
    In this method I used a "case" statement. I tested the input parameter
    value, which should be one of the option values.
    I used a set of "WHEN conditions" that called the same
    static functions to get the exact same values that the user should
    pass in.
    When I try to store this new version, I get the error:
    "PLS-00587: a static method cannot be invoked on an instance value"
    It points to the first "when statifc_function()" of the case function.
    This seems weird!
    If I can call the static method from the "type object" without creating
    and instance of an object, then why can't I call it within the body
    of a method of an instance of the object type?
    This doesn't seem appropriate,
    unless this implementation of objects is trying to avoid some type
    of "recursion"?
    If there is some other reason, I can not think of it.
    Any ideas?

    Sorry for the confusion. Here is the simplest example of what
    I want to accomplish.
    The anonymous block is a testing of the object type, which definition follows.
    declare
    test audit_info;
    begin
    test := audit_info(...);
    test.testcall( audit_info.t_EMPLOYER() );
    end;
    -- * ========================================== * --
    create or replace type audit_info as object
    ( seq_key integer
    , static function t_EMPLOYER return varchar2
    , member procedure test_call(input_type varchar2)
    instantiable
    final;
    create or replace type body audit_info
    as
    ( id audit_info
    static function t_EMPLOYER return varchar2
    as
    begin
    return 'EMPLOYER';
    end;
    member procedure test_call(input_type varchar2)
    as
    begin
    CASE input_type
    WHEN t_EMPLOYER()
    select * from dual;
    WHEN ...
    end case;
    end;
    end;
    The error occurs on the "WHEN t_EMPLOYER()" line. This code is only
    an example.
    Thanks.

  • Null Instance Variables on Screenflow

    Hi,
    I have some problems with instance variable of type BPM Objects in a Screenflow.
    I always create automatic processes without user interaction, and on server side I have seen that it's not necessary to instantiate an instance variable. Moreover if within a method I write (I use the Java style syntax):
    String a;
    a.toString(); // just to call a method on a not-instantiated variable
    everything works correctly, the "a" variable is automatically instantiated.
    But it seems that in an automatic activity of a Screenflow it's different, I need to do the new also for Instance Variables.
    Then, in the Screenflow I have an Instance Variable myObject of type MyObject that is a BPM Object. This object has an attribute myStrings that is an array of String.
    To instantiate the instance variable I can write:
    myObject = new MyObject();
    But then I get a java.lang.*NullPointerException* when I call the extend method of its attribute myStrings to add a string.
    Do you agree with me that on the Screenflow code it's necessary to instantiate the variables?
    How can I instantiate an Array of String?
    Thank you.

    Thanks Daniel, I'm using ALBPM 6.0,
    i know the line where I get the exception, I have a logMessage before and after each line of code, and then in the exception stack there is the PBL Method line indicated:
    Caused by: java.lang.NullPointerException
         at xobject.Fuego__AutoGen__Screenflows__.__ScreenflowConJsp.automatic1(__ScreenflowConJsp.xcdl:*19*)
    19 is the code line where I get the exception. In this line I have this:
    myObject.myStrings.extend(arg1 : a);
    but the null object is not the array, it's myObject that is an Instance Variable.
    In ALBPM60_Studio_ReferenceGuide at chapter Programming Styles paragraph Java Programming Style there is:
    This style emulates Java syntax and adds several features to match PBL expressions. These added features include:
    • Output arguments
    • Input and display statements
    • Variable auto-initialization
    In fact in my previuos BPM projects I have seen that is not necessary to istantiate the variables, both for Instance Variable and local variable declared within a method. In my previous post I did an example:
    String a;
    a.toString();
    Usually this causes an Exception, but not in ALBPM methods.
    My main question is: is it possible that this is true just for Server side methods and not for Screenflow methods? Because in my case I need to instantiate every Instance Variable of my Screenflow (for example the myObject instance variable) in an Automatic Activity I have put as first Activity of the flow.
    Thanks again for your help.

  • How can we execute a procedure with object type as its parameter, by passing partial elements.

    Can somebody help...
    I have a procedure which takes parameter as IN OUT extended object type .Below is the example.
    PROCEDURE p_save (example IN OUT xyz_obj)
    my object type "xyz_obj" have elements with other object types also, and that itself have around 100 elements.
    And when calling the above procedure for test purpose, how is it possible to pass partial elements of the object type rather than setting all unused elements to null.

    user13026549 wrote:
    Can somebody help...
    I have a procedure which takes parameter as IN OUT extended object type .Below is the example.
    PROCEDURE p_save (example IN OUT xyz_obj)
    my object type "xyz_obj" have elements with other object types also, and that itself have around 100 elements.
    And when calling the above procedure for test purpose, how is it possible to pass partial elements of the object type rather than setting all unused elements to null.
    It ISN'T possible. How could it be? Each attribute has to be set to something don't you think?
    A common way to handle that is to define a public package variable that is an instance of the object type and has ALL elements set to null. As Odie suggested a custom constructor function can be used for that.
    Then you create your procedure instance by starting with an instance of the package variable (where everything is null) and setting values for the attributes you need.

  • Scope of instance variables in servlets..

    Hi all,
              Sorry for asking a dumb question..
              What is the scope of instance variables in a servlet? Is the scope is
              limited to thread?
              In other words, in the following example, i am setting "testStr", in one
              request and when i tried to access the same instance variable from another
              request, i am getting it as null. Does it mean instance variable is limited
              to that particular thread/request?
              thanks in advance..
              -ramu
              

    Oops ... I had misunderstood and had the problem backwards ;-)
              > Is it known behavior? With registered servlet its working fine (a
              > instance variable is shared by all requests)
              I believe so; I typically deploy in a WAR so have not seen the problem that
              you describe. Servlets can be reloaded, so what you saw could have been
              caused bye a date/time mismatch between the .class file and the server's
              current time. On the other hand, that could be how WebLogic works.
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              +1.617.623.5782
              WebLogic Consulting Available
              "Ramu" <[email protected]> wrote in message
              news:[email protected]...
              > Hi Purdy,
              >
              > I got it. I am testing the servlet as a unregistered servlet, which is
              > creating instance for every new request!!!, which created this whole
              > confusion. Is it known behavior? With registered servlet its working fine
              (a
              > instance variable is shared by all requests)
              >
              > > What theory? ;-) Instance variables are on the object, and the object
              can
              > > be used by multiple threads, thus allowing multiple threads to access
              the
              > > same instance variables.
              > what i mean by theory here is, all instance variables in servlet should
              be
              > shared by all requests. Now i got it sir.
              >
              > Thank you..
              > -ramu
              >
              >
              > >
              > > Peace,
              > >
              > > --
              > > Cameron Purdy
              > > Tangosol, Inc.
              > > http://www.tangosol.com
              > > +1.617.623.5782
              > > WebLogic Consulting Available
              > >
              > >
              > > "Ramu" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Hi,
              > > >
              > > > > No, an instance variable in a servlet class is not limited to a
              > thread.
              > > > There
              > > > > is exactly one copy of the servlet created in memory and all
              requests
              > > pass
              > > > > through the same instance, thus sharing any instance variables. A
              > > couple
              > > > of
              > > > > things to remember:
              > > > I totally agree with you, But i am wondering why my sample servlet(i
              am
              > > > attaching the file) is not sharing the instance variables across
              > > > threads/reqs. (in 1st request set some string to "testStr" instance
              > > > variable, in next request if you read the same instance variable, you
              > will
              > > > get null!!)
              > > > Our current code is having instance variables. But right now we are
              not
              > > > getting any problems. But as per theory, instance variables should be
              > > shared
              > > > across threads/requests..
              > > >
              > > > Any how we are changing our code to remove all instance variables.
              > > >
              > > > thanks,
              > > > -ramu
              > > >
              > > > >
              > > > > 1.) Using instance or class variables in servlets that are not
              > read-only
              > > > is not
              > > > > a good thing to do. This makes the servlet not thread-safe. To
              > > maintain
              > > > > variables across requests, sessions, etc., use the servlet-defined
              > > objects
              > > > to
              > > > > store the state (e.g., request, session, etc.).
              > > > >
              > > > > 2.) If you modify the servlet class on disk, WebLogic will reload
              the
              > > > servlet
              > > > > class thus discarding the old instance and creating a new one (of
              > > course,
              > > > this
              > > > > depends on some configuration parameters for servlet reloading).
              > > > >
              > > > > Hope this helps,
              > > > > Robert
              > > > >
              > > > > Ramu wrote:
              > > > >
              > > > > > Hi,
              > > > > > thanks for quick reply.
              > > > > > I am not at all using SingleThreadModel. See the following code.
              > > > > > In first request i am passing "abc" value to testStr. But in
              second
              > > > request,
              > > > > > I am getting null for testStr in second request. It looks like
              (for
              > > me)
              > > > for
              > > > > > non single threaded model also, scope of instance variables is
              > > limited
              > > > to
              > > > > > Thread/Request.. But as per theory, because its not single
              threaded
              > > > model,
              > > > > > only one instance should be there AND testStr(instace variables)
              > > should
              > > > be
              > > > > > shared across the all threads. But i am not able see that
              behaviour
              > > > here.
              > > > > > But if declare instance variable as static, o am able to share
              it
              > > > across
              > > > > > all threads/requests.
              > > > > >
              > > > > > note:
              > > > > > From browser i am setting testStr to "abc" with URL like
              > > > > > "localhost/test1?testStr=abc"
              > > > > > And 2nd req from browser is like "localhost/test1" (on server
              > output
              > > i
              > > > am
              > > > > > getting null for testStr)
              > > > > >
              > > > > > Any ideas?
              > > > > >
              > > > > > thanks,
              > > > > > -ravi
              > > > > >
              > > > > > import java.io.*;
              > > > > > import javax.servlet.*;
              > > > > > import javax.servlet.http.*;
              > > > > >
              > > > > > public class test1 extends HttpServlet
              > > > > > {
              > > > > > public String testStr;
              > > > > >
              > > > > > public void doGet (HttpServletRequest req, HttpServletResponse
              res)
              > > > > > throws ServletException, IOException
              > > > > > {
              > > > > > doPost(req, res);
              > > > > > }
              > > > > >
              > > > > > public void doPost (HttpServletRequest req,
              HttpServletResponse
              > > res)
              > > > > > throws ServletException, IOException
              > > > > > {
              > > > > > try {
              > > > > > res.setContentType("text/html");
              > > > > > PrintWriter out = res.getWriter();
              > > > > > if(req.getParameter("testStr") != null)
              > > > > > {
              > > > > > testStr = req.getParameter("testStr");
              > > > > > System.out.println("set testStr = " + testStr);
              > > > > > }
              > > > > > else{
              > > > > > System.out.println("get testStr = " + testStr);
              > > > > > }
              > > > > >
              > > > > > }
              > > > > > catch(Exception e){
              > > > > > e.printStackTrace();
              > > > > > }
              > > > > >
              > > > > > }
              > > > > > }
              > > > > >
              > > > > > "Cameron Purdy" <[email protected]> wrote in message
              > > > > > news:[email protected]...
              > > > > > > Yes or no, depending on if your servlet implements
              > > SingleThreadModel.
              > > > > > >
              > > > > > > See the servlet 2.2 spec for documentation on how many instances
              > of
              > > a
              > > > > > > servlet will be created. See the doc for the SingleThreadModel
              > > > interface.
              > > > > > >
              > > > > > > Peace,
              > > > > > >
              > > > > > > --
              > > > > > > Cameron Purdy
              > > > > > > Tangosol, Inc.
              > > > > > > http://www.tangosol.com
              > > > > > > +1.617.623.5782
              > > > > > > WebLogic Consulting Available
              > > > > > >
              > > > > > >
              > > > > > > "Ramu" <[email protected]> wrote in message
              > > > > > > news:[email protected]...
              > > > > > > > Hi all,
              > > > > > > >
              > > > > > > > Sorry for asking a dumb question..
              > > > > > > >
              > > > > > > > What is the scope of instance variables in a servlet? Is the
              > scope
              > > > is
              > > > > > > > limited to thread?
              > > > > > > >
              > > > > > > > In other words, in the following example, i am setting
              > "testStr",
              > > in
              > > > one
              > > > > > > > request and when i tried to access the same instance variable
              > from
              > > > > > another
              > > > > > > > request, i am getting it as null. Does it mean instance
              variable
              > > is
              > > > > > > limited
              > > > > > > > to that particular thread/request?
              > > > > > > >
              > > > > > > > thanks in advance..
              > > > > > > >
              > > > > > > > -ramu
              > > > > > > >
              > > > > > > >
              > > > > > > >
              > > > > > >
              > > > > > >
              > > > >
              > > >
              > > >
              > > >
              > >
              > >
              >
              >
              

  • Concurrency and Oracle Object Types

    Hi All,
    I have a question regarding Concurrent usage of an Object type in Oracle.
    I have a java program which calls an Oracle stored proc with the object's table type as IN parameter. In my stored proc, I am populating an Oracle Object with data received from java and retrieving some data based on that.
    My java program can be invoked concurrently by 500 users at the same time - the application is built to handle that request load.
    Now in Oracle, if a bunch of requests are received at the same, would Oracle create multiple instances of this object type that would be usage to the multiple stored proc invocations? Or would there be a prob of concurrency?
    If multiple instance creation is not supported, is there some alternative I can use?
    My code roughly resembles:
    Object:
    contains two columns - name, age
    Stored proc - logic to retrieve and return data from a table based on the name, age received.
    When a bunch of requests access the stored proc simultaneously, will a bunch of instnaces of the object type get created? Or would there be a scenario where the object is common to all requests and hence data from one request would be conflicted due to data from another request?

    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

  • Member function and member procedure inside an object type in Oracle.

    Hi All,
    Please do have a look at these codes and help me understand. I have no idea about this member function and member procedure. How do they work? Please explain me about this.
    Regards,
    BS2012
    create type foo_type as object (
      foo number,
      member procedure proc(p in number),
      member function  func(p in number) return number
    create type body foo_type as
      member procedure proc(p in number) is begin
        foo := p*2;
      end proc;
      member function func(p in number) return number is begin
        return foo/p;
      end func;
    end;
    /

    Methods are just like functions or procedures in a package, except they're not in a package, their part of an object type.
    The object has attributes (which are the variables declared in it).
    To use such an object you would do things like this...
    SQL> set serverout on
    SQL>
    SQL> declare
      2    v_foo foo_type;
      3    v_val number;
      4  begin
      5    v_foo := foo_type(20); -- instantiate the object and initialize the object attributes
      6    v_foo.proc(20); -- call the object method (proc)
      7    v_val := v_foo.func(4); -- call the object method (func)
      8    dbms_output.put_line(v_val);
      9  end;
    10  /
    10
    PL/SQL procedure successfully completed.The Type definition you've declared creates the object class, but not actually an object itself.
    To actually have an object you need to declare a variable of that object class type, and then instantiate it. When you instantiate the object you need to initialize all the attributes (generally you can pass null if required for each of them to initialize them).
    Once you have your object instantiated, you can call the methods within that object as demonstrated above, a bit like calling functions and procedures in a package, except they are methods within the object type itself, and therefore called directly by referencing them from the variable.
    The documentation goes into a lot more detail of objects if you look it up.

  • Object key for object type WORKITEM is not generated

    Hi experts,
    I have a problem when I create a purchase requisition by workflow. This problem happens a client copy from production to quality system has been done.
    The problem is that the object key for the object type WORKITEM is not generated. I check in transaction SWEL in quality system it displays the following data:
    For the event data I have the following data:
    Event Instance ID - 1099124
    Object Type - BUS2105
    Object key - 0120001588 (purchase requisition number)
    Event - criadaoumodificada (createdorchanged)
    For the Receiver Data I have the following data:
    Receiver Type - WS99900003 
    Object Type  (is not displayed)
    Object Key   (is empty)
    Receiver FM - SWW_WI_CREATE_VIA_EVENT_IBF
    RFC Destination - WORKFLOW_LOCAL_010
    In the Receiver Data the object type is not displayed and the object key is not generated. In production system the object type is WORKITEM, and the object key is filled by a number of workitem.
    Can anyone tell me why this happens?
    Best regards,
    Leonel

    Hi Leonel,
    as far as I remember, those fields are updated once the receiver function module was successfully processed. In your case, I'd suggest, that you ...
    - Check the workflow local RFC destination (SM59, WORKFLOW_LOCAL_<client>)
    - Check the workflow-user (SU01, User-ID WF-BATCH normally),
    - Check for entries that stuck in the event processing (tRFC queue, transaction SM58).
    - To verify the complete system, execute transaction SWU3. The section under "Runtime environment" should be marked green.  (Ignore the red sign on definition environment).
    - For a more extensive workflow runtime check, use the transaction SWUD  (workflow diagnosis).
    After all that, your problem might be solved, or at least you know, what's all okay
    Best wishes,
       Florin

Maybe you are looking for

  • Passing an dataset to a report causes VB 6 application crash

    The problem is around the crdb_adoplus.dll Passing parameters from VB 6 application to Crystal object to generate report. Normally if i run the report there is no problem. but if i open any other .net application which uses memory, my application sud

  • Put a image from web on indesign with quality problem....

    Hello, sorry my english, but I'll try... I need use a lot of images from web, to make a document designed on indesign, and after try with all extension or formats, I mean, tif, png, pdf, jpg, psd, with different resolutions, 72, 150, 300, and differe

  • I am looking for a FREE Video converter

    After spending $300 on an 30g ipod video, i don't have much money in my account to buy a video converter. Are there any free, or cheap (under $15)converters to convert mpeg's and much more?

  • Indesign cs6 trial version

    I downloaded the trial version, but when I launched the program after I downloaded, a dialogue box showed up indication the program is not responding.  I uninstall and reinstall it, but same thing happened.  What went wrong?

  • What is the best way to view Batman and Love Boat to see their transitions?

    David Brewer, you mentioned Batman and Love Boat as providing bad examples of transitions, IYHO. How do you think I could most easily see them in this year? Netflix? Other viewers - shy off from responding to this. This is for David Brewer. LM