Implementing First In First Out Behaviour Using PL/SQL object types

Hi Friends,
I have a Integer Array of type Varray, I want to implement first in first out behaviour using Pl/SQL object type.Please provide me some idea that i can proceed. If you can provide me any sample code or any documentation,i will be very much thankful to you.Eagerly waiting for your reply.
Thanks

basically i have to implement a queue using pl/sql object types to traverse a tree as we can implement stack (LIFO).
I can give an example of Stack implementation...
CREATE or replace TYPE IntArray AS VARRAY(50) OF INTEGER;
CREATE or replace TYPE IntStack_O AS OBJECT (
maximalSize INTEGER
,top INTEGER
,position IntArray
,MEMBER PROCEDURE initialize
,MEMBER FUNCTION full RETURN BOOLEAN
,MEMBER FUNCTION empty RETURN BOOLEAN
,MEMBER FUNCTION getAnzahl RETURN INTEGER
,MEMBER PROCEDURE push (n IN INTEGER)
,MEMBER PROCEDURE pop (n OUT INTEGER)
CREATE or replace TYPE body IntStack_O AS
MEMBER PROCEDURE initialize IS
BEGIN
top := 0;
-- Call Constructor und set element 1 to NULL
position := IntArray(NULL);
maximalSize := position.LIMIT; -- Get Varray Size
position.EXTEND(maximalSize -1, 1); -- copy elements 1 in 2..50
END initialize;
MEMBER FUNCTION full RETURN BOOLEAN IS
BEGIN
RETURN (top = maximalSize); — Return TRUE when Stack is full
END full;
MEMBER FUNCTION empty RETURN BOOLEAN IS
BEGIN
RETURN (top = 0); — Return TRUE when Stack is empty
END empty;
MEMBER FUNCTION getAnzahl RETURN integer IS
BEGIN
RETURN top;
END;
MEMBER PROCEDURE push (n IN INTEGER) IS
BEGIN
IF NOT full
THEN
top := top + 1; — Push Integer onto the stack
position(top) := n;
ELSE
–Stack ist voll!
RAISE_APPLICATION_ERROR(-20101, ‘Error! Stack overflow. ‘
||’limit for stacksize reached.’);
END IF;
END push;
MEMBER PROCEDURE pop (n OUT INTEGER) IS
BEGIN
IF NOT empty
THEN
n := position(top);
top := top -1; — take top element from stack
ELSE
–Stack ist leer!
RAISE_APPLICATION_ERROR(-20102, ‘Error! Stack underflow. ‘
||’stack is empty.’);
END IF;
END pop;
END;
Now if i run this..i will be getting the following output...
DECLARE
stack intstack_o := intstack_o(NULL,NULL,NULL);
a INTEGER;
BEGIN
stack.initialize;
dbms_output.put_line('Anzahl: ' || stack.getAnzahl);
stack.push(1111);
dbms_output.put_line('Anzahl: ' || stack.getAnzahl);
stack.push(1112);
dbms_output.put_line('Anzahl: ' || stack.getAnzahl);
stack.push(1113);
dbms_output.put_line('Anzahl: ' || stack.getAnzahl);
stack.pop(a);
dbms_output.put_line('Anzahl: ' || stack.getAnzahl);
dbms_output.put_line(a);
stack.pop(a);
dbms_output.put_line('Anzahl: ' || stack.getAnzahl);
dbms_output.put_line(a);
stack.pop(a);
dbms_output.put_line('Anzahl: ' || stack.getAnzahl);
dbms_output.put_line(a);
stack.pop(a);
dbms_output.put_line('Anzahl: ' || stack.getAnzahl);
dbms_output.put_line(a);
END;
Output...
Anzahl: 0
Anzahl: 1
Anzahl: 2
Anzahl: 3
Anzahl: 2
1113
Anzahl: 1
1112
Anzahl: 0
1111
Above is the Stack (Last In First Out) Implementations of integer array.Now my Requirement is Queue(First In First Out) Implementation of Integer array.

Similar Messages

  • SharePoint 2013 implement simple logout button which do not redirect to default sign out page using JavaScript client object model

    I am using windows authentication in my web application.
    My requirement is to implement a sign out button which will sign out the user without having him to close the browser and application should not ask him to login again.
    I tried following two options:
     1. Redirecting the user to default signout.aspx page " /_layouts/15/SignOut.aspx "
     2. Using "Sign In as a different user" URL " /_layouts/15/closeConnection.aspx?loginasanotheruser=true "
    In first case, user is redirected to default sign out page but he can press "Go Back to Site" link to revisit the site. Another major issue is that the user has to close the browser to sign out from the application completely, which is not desirable
    in my project requirement.
    In second case, the the current user is signed out of the application but if the user has saved the password in browser, he gets signed in automatically to the application.
    I also came across the solution where we replace the default sign out page with a custom sign out page, but I am not sure whether it can be implemented using JavaScript Client Object Model of SharePoint.

    Hi 
    I'm basically looking for the exact answer for the query.
    Meanwhile you need to go through the link mentioned below in order to understand how to do it.
    Debugging and Logging Capabilities in SharePoint 2010
    Indul Hassan
    Microsoft Community Contributor
    http://www.indulhassan.com
    You Snooze.. You Lose !!

  • Help:  Error when using LSMW (Recording Object Type)

    Dear all,
       I encountered an error when using "Batch Input Recording" way in LSMW,which is as follows:
    I have recorded the transaction MM01 and the source structure and data mapping.When dealing
    with "Specify Files",the error comes out with message
    --> "File Name 'Converted Data':Max.45 Characters:Remaining saved". 
    and the subsequent steps cannot be maintained due to the error.

    Alex,
    The name of file for Converted data is a system generated combination of your Project subproject and object followed by lsmw.conv  as   Project_Subproject_Object.lsmw.conv
    System has set a limit of a maximum of 45 characters. It the file name exceeds 45 characters, the system will throw the error.
    Just rename the file such that it is with in the 45 charcter limit....you will be fine
    Hope this helps
    Vinodh Balakrishnan

  • Dbms_xmlgen using pl-sql record type

    Hi
    I want to pass pl-sql record type and want to generate xml. Can dbms_xmlgen access pl-sql record type instead of query?
    OR please let me know any other package to pass pl-sql record type and generate XML.
    Thanks in advance

    Can dbms_xmlgen access pl-sql record type instead of query?Don't think so, but can't you pass the individual record components:
    SQL> declare
      type rec is record
        a   int,
        b   varchar2 (30)
      r     rec;
      ctx   int;
      x     xmltype;
    begin
      r.a := 1;
      r.b := 'Michael';
      ctx := dbms_xmlgen.newcontext ('select :x id, :y name from dual');
      dbms_xmlgen.setbindvalue (ctx, 'x', r.a);
      dbms_xmlgen.setbindvalue (ctx, 'y', r.b);
      x := dbms_xmlgen.getxmltype (ctx);
      dbms_output.put_line (x.getstringval ());
      dbms_xmlgen.closecontext (ctx);
    end;
    <ROWSET>
    <ROW>
      <ID>1</ID>
      <NAME>Michael</NAME>
    </ROW>
    </ROWSET>
    PL/SQL procedure successfully completed.?

  • Ever used the Table API (TAPI) with object type in the DB?

    Hi all,
    We are trying to generate the table API of a table that has a column defined by an object type. It works without problems if that column always has a value (is instantiated in object term). The problem is when we update a row where the column is null (all attributes of the object are null thus the object is not instantiated).
    The "before update row" trigger of the Table API fails with error "ora-30625-method dispath on NULL SELF argument is disallowed".
    Any of you guys made it work? If so, how?
    Thanks

    user8879206 wrote:
    Hi friends,
    I have a procedure with object type IN OUT parameters which is used for fetching status. We are calling this from Java. But I want to call it from oracle for testing purpose. I am trying from my end but not able to do it as of now. This is the first time I am dealing with object type.We need more information. What is wrong? Your code looked okay and you did not mention any Oracle errors. What is happening that should not be or not happening that should be?
    You can call the procedure with a simple call in PL/SQL but will not be able to use it in SQL because 1) it is a procedure and 2) it has an OUT argument. A sample call should look something like (untested)
    declare
       x rec2;
       y rec3;
    begin
      --use the arguments rru was defined with as the arguments in the same order: types rec2 (x), rec3 (y)
      rru(x,y);
    end;>
    Any help would be appreciated.
    Details are given below.
    CREATE OR REPLACE TYPE REC1 AS OBJECT
    (RELAY_USAGE VARCHAR2(30)
    ,STATE VARCHAR2(1)
    TYPE REC AS TABLE OF REC1;
    CREATE OR REPLACE TYPE REC2 AS OBJECT
    (GSRN VARCHAR2(18)
    ,METERING_POINT_NAME VARCHAR2(80)
    ,RELAYS REC)
    CREATE OR REPLACE TYPE REC3 AS OBJECT
    (INFO VARCHAR2(2000)
    ,STATUS NUMBER
    PROCEDURE RRU(
    rcRelayControl IN OUT REC2
    , rcResp IN OUT REC3)
    IS
    BEGIN
    APKG.GetDetails(rcRelayControl, rcResp);
    IF rcResp.Status = BPKG.iStatusFailure THEN
    rcResp.Info := BPKG.Get_Message('20889', rcResp.Info);
    END IF;
    END RRU;
    How to call this procedure in oracle?
    Thanks.

  • Future support for using PL/SQL core business logic with ADF BC

    We want to migrate our large Forms client/server (6i) application to ADF, possibly using a migration tool like Ciphersoft Exodus.
    One scenario could be to use ADF BC and ADF-Faces or a different JSF-Implementation for presentation and business layer but keep our heavy PL/SQL-businesslogic inside the Oracle database in packages, triggers, functions and procedures.
    This scenario could be chosen due to the huge amount of interconnected logic inside the database (10 years of development; no technical components; any package may access any table and more of this kind of dependencies). The business logic nowadays held in Forms client will be moved mainly into the database as a prerequisite to this scenario.
    Choosing this "keep-logic-in-DB"-scenario we need a good support by ADF BC to do so. We know and prototyped that it is possible to call some PL/SQL via JDBC from ADF BC and it is possible to use stored procedure calls for standard business entity data access (ins, del, upd, ..). But this does not solve our problems. We want to reuse core business logic coded in PL/SQL. This is much more than change the ADF standard behavior for an update with an own PL/SQL-call.
    Now my question:
    Will there be a kind of sophisticated support to use ADF BC in combination with database-kept logic?
    If so, when will this happen and how will the common problems of transactional state inside the database and inside the ADF BC be solved? Any plans or ideas yet?
    Many other clients do have similar applications built in Forms and PL/SQL and would be glad to hear about a path of direction.
    I've read the technical article 'understanding the ADF BC state management feature' which you have contributed to. One current limitation is pointed out there: Using PL/SQL with ADF BC limits ADF AM pooling to 'restricted level' which reduces scalability.
    Are you aware of additional main problems/tasks to solve when using PL/SQL heavily with ADF BC, which we have to think about?
    Thank you for any response.
    Ingmar

    My main problem is two 'concurrent' areas holding state in an application system based on DB-stored PL/SQL-logic in combination with ADF BC.
    For a new System everything can be made ok:
    Sure, it is possible to build a new system with the business logic included in ADF BC only. All long-living state will be handled in the BC layer ( including support for UnitsOfWork longer than the webside short HTTP-requests and HTTP-sessions and longer than the database transactions.
    For an old system these problems arise:
    1. DB data changes not reflected in BC layer:
    Our PL/SQL-logic changes data in tables without notifying the ADF BC layer (and its cache). To keep the data in ADF BC entity objects identical to the changed database content a synchronization is needed. BC does not know which part of the application data has been changed because it has not initiated the changes through its entity objects. Therefore a full refresh is needed. In a Forms4GL environment the behavior is similar: We do frequently requeries of all relevant (base)tables after calling database stored logic to be sure to get the changed data to display and to operate on it.
    -> Reengineering of the PL/SQL-logic to make the ADF BC layer aware of the changes is a big effort (notifying BC about any change)
    2. longer living database transactions
    Our PL/SQL-logic in some areas makes use of lengthy database transactions. The technical DB-transaction is similar to the UnitOfWork. If we call this existing logic from ADF BC, database state is produced which will not be DB-committed in the same cycle.
    This reduces scalability of ADF BC AM pooling.
    Example:
    a) Call a DB-stored logic to check if some business data is consistent and prepare some data for versioning. This starts a DB-transaction but does not commit it.
    b) Control is handed back to the user interface. Successful result of step a) is displayed
    c) User now executes the versioning operation
    d) Call another DB-stored logic to execute the versioning. DB-transaction is still open
    e) Business layer commits the transaction automatically after successful finishing step d). Otherwise everything from a) to e) is rolled back.
    -> redesign of this behavior (= cutting the 1to1 relation between LogicalUnitOfWork and the technicalDatabaseTransaction is a big effort due to the big amount of code.

  • Any tricks to use PL/SQL types in object attributes?

    I guess this is a bit of a newbie-question, but I haven't been able to find any workarounds elsewhere, so please bear with me... I'm far from new to object orientation, but I'm rather new to Oracle's object features.
    I was wondering if there's some trick you can use to keep references to attributes of PL/SQL types even though they are not allowed in object types (as these are "SQL", yes I do think I understand). I was thinking there might be some way you could cast them to some data type that is supported in SQL and then get them back by the reverse process when you need them in the PL/SQL inside the methods?
    In the concrete case, I would like to keep a reference to a utl_smtp connection in my object. It doesn't matter that the reference would be meaningless in other sessions etc. (actually I may not even want to store the objects in any persistent table - it's the polymorphism I'm after):
    CREATE OR REPLACE TYPE o_test AS OBJECT (
    att1 NUMBER,
    att2 sys.utl_smtp.connection
    - which of course give me:
    LINE/COL ERROR
    0/0     PL/SQL: Compilation unit analysis terminated
    3/12     PLS-00329: schema-level type has illegal reference to
         SYS.UTL_SMTP
    The problem becomes rather dull since I can't pass the connection record as a parameter to methods either.
    The only workaround I could think of was to keep the connection as a global variable in a PL/SQL package and then get it from there inside the methods. Of course this can be refined using an index by table and some object unique id to support multiple objects with their separate connections. But it still seems rather clumbsy - especially given that what I was looking for was the elegance of polymorphism.
    Any tricks I don't know of?
    I'm working in Oracle 10gR2.
    best regards,
    Jakob
    Edited by: schmidt on Mar 21, 2011 10:52 PM

    The UTL_SMTP Connection record is not too complicated, and can be easily translated into SQL object types. Add a package to aid in conversion between SQL and PLSQL, and voila!
    create or replace type o_utl_tcp_connection is object (
         remote_host     VARCHAR2(255),
         remote_port     INTEGER,
         local_host     VARCHAR2(255),
         local_port     INTEGER,
         charset          VARCHAR2(30),
         newline          VARCHAR2(2),
         tx_timeout     INTEGER,
         private_sd     INTEGER
    define     typeOf_SQL_BOOLEAN     = 'number'
    define     SQL_BOOLEAN          = '&typeOf_SQL_BOOLEAN(1)'
    define     SQL_TRUE          = 1
    define     SQL_FALSE          = 0
    create or replace type o_utl_smtp_connection is object (
         host          VARCHAR2(255),          -- remote host name
         port          INTEGER,          -- remote port number
         tx_timeout     INTEGER,          -- Transfer time out (in seconds)
         private_tcp_con o_utl_tcp_connection,     -- private, for implementation use
         private_state     INTEGER,          -- private, for implementation use
         -- Optionally, encapsulate all UTL_SMTP package calls behind object methods
         member procedure open(
              self                    IN OUT NOCOPY     o_utl_smtp_connection,
              host                    IN          VARCHAR2,
              port                    IN          INTEGER DEFAULT 25,
              tx_timeout               IN          INTEGER DEFAULT NULL,
              wallet_path               IN          VARCHAR2 DEFAULT NULL,
              wallet_password               IN          VARCHAR2 DEFAULT NULL,
              secure_connection_before_smtp     IN          &typeOf_SQL_BOOLEAN DEFAULT &SQL_FALSE
         member procedure writeData(
              self                    IN OUT NOCOPY     o_utl_smtp_connection,
              data                    IN          VARCHAR2 CHARACTER SET ANY_CS
    create or replace type body o_utl_smtp_connection is
         member procedure open(
              self                    IN OUT NOCOPY     o_utl_smtp_connection,
              host                    IN          VARCHAR2,
              port                    IN          INTEGER DEFAULT 25,
              tx_timeout               IN          INTEGER DEFAULT NULL,
              wallet_path               IN          VARCHAR2 DEFAULT NULL,
              wallet_password               IN          VARCHAR2 DEFAULT NULL,
              secure_connection_before_smtp     IN          &typeOf_SQL_BOOLEAN DEFAULT &SQL_FALSE
         is
         begin
              self := SMTP_UTILS.toSqlConnection(SYS.UTL_SMTP.Open_Connection(
                        host
                   ,     port
                   ,     tx_timeout
                   ,     wallet_path
                   ,     wallet_password
                   ,     nvl(secure_connection_before_smtp = &SQL_TRUE, false)
         end;
         member procedure writeData(
              self                    IN OUT NOCOPY     o_utl_smtp_connection,
              data                    IN          VARCHAR2 CHARACTER SET ANY_CS
         is
              conn     SYS.UTL_SMTP.Connection          := SMTP_UTILS.toPlSqlConnection(self);
         begin
              begin
                   SYS.UTL_SMTP.Write_Data(conn, data);
                   self := SMTP_UTILS.toSqlConnection(conn);
              exception
              when others then
                   self := SMTP_UTILS.toSqlConnection(conn);
                   raise;
              end;
         end;
    end;
    create or replace type o_test is object (
         attr1          number,
         attr2          o_utl_smtp_connection,
         member procedure doSomethingWithConnection
    create or replace package SMTP_UTILS
    is
         function toPLSQLConnection(aConnection in o_utl_smtp_connection)
         return SYS.UTL_SMTP.Connection;
         function toSQLConnection(aConnection in SYS.UTL_SMTP.Connection)
         return o_utl_smtp_connection;
    end;
    create or replace package body SMTP_UTILS
    is
         function toPLSQLConnection(aConnection in o_utl_smtp_connection)
         return SYS.UTL_SMTP.Connection
         is
              result     SYS.UTL_SMTP.Connection;
         begin
              result.host                    := aConnection.host;
              result.port                    := aConnection.port;
              result.tx_timeout               := aConnection.tx_timeout;
              result.private_state               := aConnection.private_state;
              result.private_tcp_con.remote_host     := aConnection.private_tcp_con.remote_host;
              result.private_tcp_con.remote_port     := aConnection.private_tcp_con.remote_port;
              result.private_tcp_con.local_host     := aConnection.private_tcp_con.local_host;
              result.private_tcp_con.local_port     := aConnection.private_tcp_con.local_port;
              result.private_tcp_con.charset          := aConnection.private_tcp_con.charset;
              result.private_tcp_con.newline          := aConnection.private_tcp_con.newline;
              result.private_tcp_con.tx_timeout     := aConnection.private_tcp_con.tx_timeout;
              result.private_tcp_con.private_sd     := aConnection.private_tcp_con.private_sd;
              return     result;
         end;
         function toSQLConnection(aConnection in SYS.UTL_SMTP.Connection)
         return o_utl_smtp_connection
         is
              result     o_utl_smtp_connection;
         begin
              result.host                    := aConnection.host;
              result.port                    := aConnection.port;
              result.tx_timeout               := aConnection.tx_timeout;
              result.private_state               := aConnection.private_state;
              result.private_tcp_con.remote_host     := aConnection.private_tcp_con.remote_host;
              result.private_tcp_con.remote_port     := aConnection.private_tcp_con.remote_port;
              result.private_tcp_con.local_host     := aConnection.private_tcp_con.local_host;
              result.private_tcp_con.local_port     := aConnection.private_tcp_con.local_port;
              result.private_tcp_con.charset          := aConnection.private_tcp_con.charset;
              result.private_tcp_con.newline          := aConnection.private_tcp_con.newline;
              result.private_tcp_con.tx_timeout     := aConnection.private_tcp_con.tx_timeout;
              result.private_tcp_con.private_sd     := aConnection.private_tcp_con.private_sd;
              return     result;
         end;
    end;
    create or replace type body o_test is
         member procedure doSomethingWithConnection
         is
         begin
              -- Make SMTP calls thru connection object methods
              self.attr2.open();
         end;
    end;
    /Hope it helps.
    Gerard
    Edited by: gaverill on May 17, 2011 3:02 PM - formatted code

  • Update VBKD table using open sql

    HI
    when i use BAPI_SALESORDER_CREATEFROMDAT2 to create SO!
    but some field i can't fill in BAPI_SALESORDER_CREATEFROMDAT2 of parameter. so i want update it using open SQL.
    so i want to use BAPI_SALESORDER_CREATEFROMDAT2 first. and next using
    open sql to update VBKD of field! VBKD-TRATY(Means-of-Transport Type)
    abap code:
       CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
          EXPORTING
      SALESDOCUMENTIN               =
            ORDER_HEADER_IN               = header
            ORDER_HEADER_INX              = headerx
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
         IMPORTING
           SALESDOCUMENT                 = saledocument
          TABLES
           RETURN                        = return
           ORDER_ITEMS_IN                = item
           ORDER_ITEMS_INX               = itemx
            ORDER_PARTNERS                = partner
      ORDER_SCHEDULES_IN            =
      ORDER_SCHEDULES_INX           =
           ORDER_CONDITIONS_IN           = condition
           ORDER_CONDITIONS_INX          = conditionx
      ORDER_CFGS_REF                =
      ORDER_CFGS_INST               =
      ORDER_CFGS_PART_OF            =
      ORDER_CFGS_VALUE              =
      ORDER_CFGS_BLOB               =
      ORDER_CFGS_VK                 =
      ORDER_CFGS_REFINST            =
      ORDER_CCARD                   =
      ORDER_TEXT                    =
      ORDER_KEYS                    =
      EXTENSIONIN                   =
      PARTNERADDRESSES              =
    if sy-subrc = 0.
    update vbkd
    set TRATY = in_data-TRATY
    where vbeln = saledocument.
    if sy-subrc = 0.
      commit work.
    endif.
    endif.
    but i don't what affect if i use open sql to update sap VBKD table.
    who can help me to explain it!
    thank you!

    Hi,
       Try like thais
    *&      Form  SUB_READ_UPDATE_BSEG
          text
    FORM sub_read_update_bseg.
      IF NOT it_final[] IS INITIAL.
        LOOP AT it_final INTO wa_final.
          UPDATE bseg SET zuonr = wa_final-ccnum
                      WHERE bukrs EQ wa_final-bukrs
                      AND   belnr EQ wa_final-vbeln
                      AND   rfzei EQ wa_final-rfzei
                      AND   saknr NE ' '.
        ENDLOOP.
    *--Message data updated successfully
        MESSAGE i888 WITH text-002.
        LEAVE LIST-PROCESSING.
      ELSE.
    *--Message No data found
        MESSAGE i888 WITH text-003.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " SUB_READ_UPDATE_BSEG
    Regards,
    Prashant

  • Serialization by Object Type of IDOCS Out of XI

    Hi,
    I have the following scenario:
        File>XI>SAP DEBMAS IDOC(s)
    If an IDOC errors out (bad data sent in, customer locked etc.) it is going to create a work item on the receiving SAP system that will be reprocessed by a business user.
    The situation I want to prevent is this:
    IDOC 1 -
    Updates customer 100. 
    Changes the street to 222 Main St.
    This IDOC errors out because customer 100 is locked.  A work item gets created for reprocessing.
    IDOC 2 sent in before the work item is reprocessed -
    Updates customer 100.  Customer is no longer locked.
    Changes the street to 222 Main St South.
    Now the work item is reprocessed and the customer is updated to 222 Main St when it should be 222 Main St South.
    I think I can use serialization to prevent the second IDOC from being processed before the 1st IDOC is successfully processed.  However, I would like to allow an IDOC for customer 300 to be processed even if an IDOC for customer 100 is in error.
    Can I use Serialization By Object Type to accomplish this?(http://help.sap.com/saphelp_erp2004/helpdata/en/0b/2a66c9507d11d18ee90000e8366fc2/frameset.htm)
    Help.sap shows me how to set up the Serialization on the receiving SAP system.  However it states that the serialziation has to be set up on both systems.  Does this mean that I just do that same config on the XI system?  How does XI support the Serialization By Ojbects concept?
    Thanks,
    Jeff

    HI Jeff,
    My thoughts below....
    XI has to do the Job that would have been done by an SAP sending system...
    For instance, based on an object key some serialization numbers needs to be created & attached to the IDOC control record.
    I donot have access to a system right now...but one should be able to do this in many ways...
    One way i would do is like this...Enable serialization (say for customer master from the SAP system which i have access to)...Trigger some IDOCs making changes to different master records..see how the numbering is done by the SAP System and how it is attached to the IDOC(This is just to do a similar process as sap would do)....
    Once i see how SAP does it while sending the IDOCs, i will genearate a number on XI abap stack using a number range object & attach it to the IDOC as though it was done by the sending system...
    My 2 Cents...
    Thanks,
    Renjith.

  • Bulk loading BLOBs using PL/SQL - is it possible?

    Hi -
    Does anyone have a good reference article or example of how I can bulk load BLOBs (videos, images, audio, office docs/pdf) into the database using PL/SQL?
    Every example I've ever seen in PL/SQL for loading BLOBs does a commit; after each file loaded ... which doesn't seem very scalable.
    Can we pass in an array of BLOBs from the application, into PL/SQL and loop through that array and then issue a commit after the loop terminates?
    Any advice or help is appreciated. Thanks
    LJ

    It is easy enough to modify the example to commit every N files. If you are loading large amounts of media, I think that you will find that the time to load the media is far greater than the time spent in SQL statements doing inserts or retrieves. Thus, I would not expect to see any significant benefit to changing the example to use PL/SQL collection types in order to do bulk row operations.
    If your goal is high performance bulk load of binary content then I would suggest that you look to use Sqlldr. A PL/SQL program loading from BFILEs is limited to loading files that are accessible from the database server file system. Sqlldr can do this but it can also load data from a remote client. Sqlldr has parameters to control batching of operations.
    See section 7.3 of the Oracle Multimedia DICOM Developer's Guide for the example Loading DICOM Content Using the SQL*Loader Utility. You will need to adapt this example to the other Multimedia objects (ORDImage, ORDAudio .. etc) but the basic concepts are the same.
    Once the binary content is loaded into the database, you will need a to write a program to loop over the new content and initialize the Multimedia objects (extract attributes). The example in 7.3 contains a sample program that does this for the ORDDicom object.

  • How to use PL/SQL procs with portlet enabled CA's?

    I have written some PL/SQL procedures in a package.
    Now I would like to use this in a FOLDER-portlet (a new CA created for this purpose).
    But when I select the 'Open Item In Folder' (which should show the PL/SQL procedure results in the portlet I hope) I get:
    Call to utl_http failed (WWS-32136)
    ORA-1: User-Defined Exception (WWC-36000)
    If instead the option 'Open in new browser window' (or something like that) I get no error.
    My CA calls the PL/SQL pkg using a URL item like this:
    http://myserver/pls/dad/schema.package.procedure?p_arg=...
    It works entered directly in the address bar and if the item opens in a new window.
    But I want it to display in the SAME portlet as the link I click on.
    How is this done?
    null

    JDBC (and SQLJ) only support SQL types as stored procedure arguments, not PL/SQL types.
    If your stored procedure uses a PL/SQL-only type, such as BOOLEAN, record types, or index-by tables, then you cannot call it from Java (or, for that matter, from other languages as well).
    There is one exception: scalar index-by table arguments have been supported since JDBC 8.1.7 in the JDBC-OCI driver (refer to the JDBC manual for specifics).
    One workaround is to create wrapper PL/SQL stored procedures that take SQL arguments and convert them to PL/SQL -and vice versa- and call the original PL/SQL stored procedures. For example, a record type could be exploded into individual arguments, or it could be converted into a SQL object type, index-by tables could be represented as SQL collection types, etc.
    You can find a small example of this in the back of the JPublisher manual, where an example is given how to call a PL/SQL stored procedure that takes BOOLEAN arguments.

  • Table used for repository objects

    Hi Guys,
    Would like to check with you for the table used for below object type:
    1. Program = TRDIR
    2. Smartform = STXFORM
    3. SAPscript = ???
    4. Transcaction code = TSTC
    Thanks in advance.

    Hi Ravi,
    Thanks for your prompt reply. But i may know which table stored the description/text of SAPscript?
    Thanks in advance.

  • Huge memory leaks in using PL/SQL tables and collections

    I have faced a very interesting problem recently.
    I use PL/SQL tables ( Type TTab is table of ... index by binary_integer; ) and collections ( Type TTab is table of ...; ) in my packages very widely. And have noticed avery strange thing Oracle does. It seems to me that there are memory leaks in PGA when I use PL/SQL tables or collections. Let me a little example.
    CREATE OR REPLACE PACKAGE rds_mdt_test IS
    TYPE TNumberList IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    PROCEDURE test_plsql_table(cnt INTEGER);
    END rds_mdt_test;
    CREATE OR REPLACE PACKAGE BODY rds_mdt_test IS
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    x TNumberList;
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    x(indx) := indx;
    END LOOP;
    END;
    END rds_mdt_test;
    I run the following test code:
    BEGIN
    rds_mdt_test.test_plsql_table (1000000);
    END;
    and see that my session uses about 40M in PGA.
    If I repeat this example in the same session creating the PL/SQL table of smaller size, for instance:
    BEGIN
    rds_mdt_test.test_plsql_table (1);
    END;
    I see again that the size of used memory in PGA by my session was not decreased and still be the same.
    The same result I get if I use not PL/SQL tables, but collections or varrays.
    I have tried some techniques to make Oracle to free the memory, for instance to rewrite my procedure in the following ways:
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    x TNumberList;
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    x(indx) := indx;
    END LOOP;
    x.DELETE;
    END;
    or
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    x TNumberList;
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    x(indx) := indx;
    END LOOP;
    FOR indx in 1 .. cnt LOOP
    x.DELETE(indx);
    END LOOP;
    END;
    or
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    x TNumberList;
    empty TNumberList;
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    x(indx) := indx;
    END LOOP;
    x := empty;
    END;
    and so on, but result was the same.
    This is a huge problem for me as I have to manipulate collections and PL/SQL tables of very big size (from dozens of thousand of rows to millions or rows) and just a few sessions running my procedure may cause server's fall due to memory lack.
    I can not understand what Oracle reseveres such much memory for (I use local variables) -- is it a bug or a feature?
    I will be appreciated for any help.
    I use Oracle9.2.0.1.0 server under Windows2000.
    Thank you in advance.
    Dmitriy.

    Thank you, William!
    Your advice about using DBMS_SESSION.FREE_UNUSED_USER_MEMORY was very useful. Indeed it is the tool I was looking for.
    Now I write my code like this
    declare
    type TTab is table of ... index binary_integer;
    res TTab;
    empty_tab TTab;
    begin
    res(1) := ...;
    res := empty_tab;
    DBMS_SESSION.FREE_UNUSED_USER_MEMORY;
    end;
    I use construction "res := empty_tab;" to mark all memory allocated to PL/SQL table as unused according to Tom Kyte's advices. And I could live a hapy life if everything were so easy. Unfortunately, some tests I have done showed that there are some troubles in cleaning complex nested PL/SQL tables indexed by VARCHAR2 which I use in my current project.
    Let me another example.
    CREATE OR REPLACE PACKAGE rds_mdt_test IS
    TYPE TTab0 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    TYPE TRec1 IS RECORD(
    NAME VARCHAR2(4000),
    rows TTab0);
    TYPE TTab1 IS TABLE OF TRec1 INDEX BY BINARY_INTEGER;
    TYPE TRec2 IS RECORD(
    NAME VARCHAR2(4000),
    rows TTab1);
    TYPE TTab2 IS TABLE OF TRec2 INDEX BY BINARY_INTEGER;
    TYPE TStrTab IS TABLE OF NUMBER INDEX BY VARCHAR2(256);
    PROCEDURE test_plsql_table(cnt INTEGER);
    PROCEDURE test_str_tab(cnt INTEGER);
    x TTab2;
    empty_tab2 TTab2;
    empty_tab1 TTab1;
    empty_tab0 TTab0;
    str_tab TStrTab;
    empty_str_tab TStrTab;
    END rds_mdt_test;
    CREATE OR REPLACE PACKAGE BODY rds_mdt_test IS
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    BEGIN
    FOR indx1 IN 1 .. cnt LOOP
    FOR indx2 IN 1 .. cnt LOOP
    FOR indx3 IN 1 .. cnt LOOP
    x(indx1) .rows(indx2) .rows(indx3) := indx1;
    END LOOP;
    END LOOP;
    END LOOP;
    x := empty_tab2;
    dbms_session.free_unused_user_memory;
    END;
    PROCEDURE test_str_tab(cnt INTEGER) IS
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    str_tab(indx) := indx;
    END LOOP;
    str_tab := empty_str_tab;
    dbms_session.free_unused_user_memory;
    END;
    END rds_mdt_test;
    1. Running the script
    BEGIN
    rds_mdt_test.test_plsql_table ( 100 );
    END;
    I see that usage of PGA memory in my session is close to zero. So, I can judge that nested PL/SQL table indexed by BINARY_INTEGER and the memory allocated to it were cleaned successfully.
    2. Running the script
    BEGIN
    rds_mdt_test.test_str_tab ( 1000000 );
    END;
    I can see that plain PL/SQL table indexed by VARCHAR2 and memory allocated to it were cleaned also.
    3. Changing the package's type
    TYPE TTab2 IS TABLE OF TRec2 INDEX BY VARCHAR2(256);
    and running the script
    BEGIN
    rds_mdt_test.test_plsql_table ( 100 );
    END;
    I see that my session uses about 62M in PGA. If I run this script twice, the memory usage is doubled and so on.
    The same result I get if I rewrite not highest, but middle PL/SQL type:
    TYPE TTab1 IS TABLE OF TRec1 INDEX BY VARCHAR2(256);
    And only if I change the third, most nested type:
    TYPE TTab0 IS TABLE OF NUMBER INDEX BY VARCHAR2(256);
    I get the desired result -- all memory was returned to OS.
    So, as far as I can judge, in some cases Oracle does not clean complex PL/SQL tables indexed by VARCHAR2.
    Is it true or not? Perhaps there are some features in using such way indexed tables?

  • Sener file adapter has read/pick the files first in first out method.

    HI
    In my Interface I am Using Sender as File adapter. As per my requirement Sender file adapter has to read the file from file directory. This directory having 1000u2019s of files with some files are same name (time stamp is different) and some files are different name here file adapter has to pick the file with mentioned name   in File sender adapter like ZMPSMSGSTATUSMST-.xml .
    But source file name is like <TABLENAME>-<TIME_STAMP>.XML (ZMPSWRKFLOWHIST-20090527-150522-628) in file directory.
    The file adapter in XI will poll to this directory and picks the file in first- in first-out by sorting according to timestamp.
    To do this configuration what I have to do in sender file adapter please give me your valuable inputs.

    HI Abhi,
    Thank you for your spot replay.
    I tested now but i am geting below error.
    Putting message into send queue failed, due to: com.sap.aii.af.ra.ms.api.DuplicateMessageException: Message ID f4ca4f86-9c5d-4bdd-1fb1-a6bd7cda99a8(OUTBOUND) already exists in database: com.sap.sql.DuplicateKeyException: [NWMss][SQLServer JDBC Driver][SQLServer]Violation of PRIMARY KEY constraint 'PK__XI_AF_MSG__491A1D0B'. Cannot insert duplicate key in object 'dbo.XI_AF_MSG'..
    Could not archive file 'E:\file\in\ZMPSMSGSTATUSMST-20090527-150522-628.xml' after processing
    but i am able to see this file in Archive foleder. once file is archivied sucessfully the same file is delted from source directory?
    I given processing parametes queue name is TEST.
    Thanks
    srinivas
    Edited by: srinivasreddy p on May 28, 2009 8:43 AM
    Edited by: srinivasreddy p on May 28, 2009 8:52 AM

  • How to notify the waiting queue with first-in-first-out?

    Could anyone know
    how to notify the waiting queue with first-in-first-out?
    I dont want to notify the waiting queue randomly!
    thanks~

    i assume you are referring to wait "queue" of threads waiting to be notified. while you can do this with some effort on your own part (it's not trivial), depending on what type of guarantees you want, you could use a ReentrantLock with the "fair" policy. it tries to be FIFO but doesn't guarantee it. if you need stronger guarantees, then you will have to code it yourself.
    note, that many of the reasons for using wait/notify explicitly are now handled with some of the concurrent utilities like BlockingQueue, so you may not need to code your own wait/notify logic.

Maybe you are looking for