Initializing a varying array of records?

Hi everybody,
Given below is a sample code. I have created a varying array of records. However I am unable to initialize the same. Can anybody help me out?
DECLARE
TYPE XRECORD IS RECORD(x NUMBER, y VARCHAR2(12));
TYPE VARRAYTYPE IS VARYING ARRAY(10) OF XRECORD;
xvartab VARRAYTYPE;
BEGIN
----How do I populate/initialize the varying array
--The following line gives me an error
--xvartab := VARRAYTYPE(2,'XXXX');
NULL;
END;

declare
   type xrecord is record(x number, y varchar2(12)); -- declare record type
   xrec xrecord; -- declare working record of type xrecord 
   type varraytype is varying array(10) of xrecord; -- declare varray type
   xvartab varraytype := varraytype(); -- declare and initialise varray of type varraytype   
begin
   -- populate working record 
   xrec.x := 1;
   xrec.y := 'XXXX';
   -- make room for one new record in varray 
   xvartab.extend(1);
   -- insert record into element one of varray
   xvartab(1) := xrec;
   -- populate working record  
   xrec.x := 2;
   xrec.y := 'XXXX';
   -- make room for one new record in varray 
   xvartab.extend(1);
   -- insert record into element two of varray
   xvartab(2) := xrec;
   -- display record in element one of varray
   dbms_output.put_line('ELEMENT ONE : x='||xvartab(1).x||' and y='||xvartab(1).y);  
   -- display record in element two of varray  
   dbms_output.put_line('ELEMENT TWO : x='||xvartab(2).x||' and y='||xvartab(2).y);  
end;
SQL> /
ELEMENT ONE : x=1 and y=XXXX
ELEMENT TWO : x=2 and y=XXXX
PL/SQL procedure successfully completed.
SQL>

Similar Messages

  • How to send a Varying Array param to a PL/SQL Stored Procedure from Java

    * I am VERY new to jdbc, and even somewhat new to Java
    * I'm using Java 1.5, Oracle 10g.
    * I need to call the following PL/SQL Stored Procedure from Java:
    procedure setEventStatus
    i_deQueueStatus in deQueueStatus_type
    *deQueueStatus_type is the following (an array of deQueueStatus_OBJ):
    CREATE OR REPLACE TYPE deQueueStatus_OBJ as object
    eventID number (20),
    dequeuestatus varchar2(20)
    CREATE OR REPLACE TYPE deQueueStatus_TYPE IS VARYING ARRAY(500) of deQueueStatus_obj
    *I have created a Java object as follows:
    public class EventQueueDeQueueStatus
         long      eventID;
         String      dequeueStatus;
         EventQueueDeQueueStatus(long eventID, String dequeueStatus)
              this.eventID = eventID;
              this.dequeueStatus = dequeueStatus;
    I have an ArrayList of these.
    I need to pass this list to the Stored Procedure. How do I create a java.sql.Array so I can call CallableStatement.setArray to set the parameter? Or do I use something else? I have tried setObject with both the ArrayList and also with a primitive array, but got "Invalid Column Type" both times.
    Any help would be greatly appreciated. I just got this task today, and I have to make it work by Tuesday :-( !
    Thanks,
    Kathy

    Kathy,
    Search the archives of this forum and the JDBC forum for the terms STRUCT and ARRAY and you can find some sample code on the JDBC How-To Documents page and the JDBC Samples which can both be accessed from this page:
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/index.html
    Good Luck,
    Avi.

  • ARRAY and records at multiple level ? please help

    Hi experts!!
    I am struck up with a problem. If u can please help me.
    I need a structure of this type.
    create type GRADE as object(
    grade varchar2(30)
    / -- works fine , creates
    create type GRADE_ARRAY as VARRAY(10) of GRADE;
    / -- works fine and creates
    create type SPECIES as object
    Species_number number,
    array_of_grade GRADE_ARRAY
    / works fine
    create type SPECIES_ARRAY as VARRAY(20) of SPECIES;
    -- error comes here.. Can not have multiple level..type error
    and so can not go ahead. In fect I wanted to use next level also. like this.
    The next command remains my dream only then because I could not create the SPECIES ARRAY it self..
    create type TIMBER as object
    timber_mark varchar2(6),
    no_species number,
    array_of_species(20) SPECIES_ARRAY
    the problem is for multiple level ARRAY AND RECORD/object combination..
    I tried with OBJECT AND VARRAY it does only for one level.. not even two level.
    my Mail ID:
    [email protected]
    Thanks and Regards..
    Virendra chauhan

    I think multi-level collections was first implemented in 9.2. You failed to mention what version of the DB you are using.

  • Create Array from Record

    Hi
    Somebody have a example how can I to create a Array from record ?
    tks

    Hi!
    Pls go through the followinglink --
    [url http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10807/05_colls.htm]VArray From Record In Oracle
    Hope that will help u.
    Regards.
    Satyaki De.

  • Passing a Variant array to ArrayToImage Function

    Hi,
    I need help passing a Variant array to the ArrayToImage function in the NI Vision library.
    I have no problems using the ImageToArray function - but when going back to the CWIMAQImage type the application throws an exception.
    Are there any code samples for doing this?
    Thanks!

    Hello,
    Thank you for posting to the NI forums! Try calling the ImageToArray function then immediately passing the resultant array back to ArrayToImage. That will determine whether the ArrayToImage function is causing the error, or the array that is passed into it. Can you post a small sample of how you call the ArrayToImage function and the errors that are thrown?
    Thanks,
    Maclean G.
    Applications Engineering
    National Instruments

  • Array of records registerOutParameter

    Hi !!
    I have a Pl/SQL function that returns an array of records. I want to call this procedure doing the following:
    st =conn.prepareCall("{? = call partes.PROYECTOS_DISPONIBLES(?,?,?)}");
    st.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.ARRAY);
    but i don4t know how to cast the oracle array that return this function to i can access to this data.
    could anyone help me???
    Thanks in Advance

    I have the following:
    Type PROYECTO_REC
    AS OBJECT
    fat_pry_codig varchar2(10),
    fat_pry_pro_are_div_soc_codig number(3),
    fat_pry_pro_are_div_codig number(3),
    fat_pry_pro_are_codig number(3),
    fat_pry_pro_codig number(3),
    fat_pry_nrevi number(3),
    fat_codig varchar2(10),
    icate varchar2(1),
    cod varchar2(10),
    dproy varchar2(50),
    denom varchar2(50),
    drazas varchar2(100),
    horasl number,
    horasm number,
    horasx number,
    horasj number,
    horasv number,
    horass number,
    horasd number);
    and a table of it:
    type tabla_proy is table of proyecto_rec;
    and i have a function in pl/sql that returns a table of this type and i want from jdbc to have access to the tabla that return this function.
    Could anyone help me????

  • Receive array of record as a storeprocedure parameter

    Hello!
    Can I receive an array of record in a storeprocedure?
    I have seen that in C sharp you can receive an array of varchar, for example, but I don' t know if it's possible to receive a complex type array like a record or you can only receive a simple type array like output parameter.
    I work with this record:
    TYPE prueba IS RECORD
    TIPO VARCHAR2(30),
    CODIGO varchar2(10),
    DENOMINACION VARCHAR2(55),
    COD_TIPO NUMBER,
    DENOMINACION2 VARCHAR2(55)
    Thanks!!

    Hi, you can't pass array of record to stpred procedure, inside use UDT.
    [See.|http://forums.oracle.com/forums/thread.jspa?messageID=3606898&#3606898]
    Roberto
    Edited by: rober584812 on Sep 19, 2009 5:26 PM

  • Replicating data once again to CRM after initial load fails for few records

    My question (to put it simply):
    We performed an initial load for customers and some records error out in CRM due to invalid data in R/3. How do we get the data into CRM after fixing the errors in R/3?
    Detailed information:
    This is a follow up question to the one posted here.
    Can we turn off email validation during BP replication ?
    We are doing an initial load of customers from R/3 to CRM, and those customers with invalid email address in R/3 error out and show up in SMW01 as having an invalid email address.
    If we decide to fix the email address errors on R/3, these customers should then be replicated to CRM automatically, right? (since the deltas for customers are already active) The delta replication takes place, but, then we get this error message "Business Partner with GUID 'XXXX...' does not exist".
    We ran the program ZREPAIR_CRMKUNNR provided by SAP to clear out any inconsistent data in the intermediate tables CRMKUNNR and CRM_BUT_CUSTNO, and then tried the delta load again. It still didn't seem to go through.
    Any ideas how to resolve this issue?
    Thanks in advance.
    Max

    Subramaniyan/Frederic,
    We already performed an initial load of customers from R/3 to CRM. We had 30,330 records in R/3 and 30,300 of them have come over to CRM in the initial load. The remaining 30 show BDOC errors due to invalid email address.
    I checked the delta load (R3AC4) and it is active for customers. Any changes I make for customers already in CRM come through successfully.  When I make changes to customers with an invalid email address, the delta gets triggered and data come through to CRM, and I get the BDOC error "BP with GUID XXX... does not exist"
    When I do a request load for that specific customer, it stays in "Wait" state forever in "Monitor Requests"
    No, the DIMA did not help Frederic. I did follow the same steps you had mentioned in the other thread, but it just doesn't seem to run. I am going to open an OSS message with SAP for it. I'll update the other thread.
    Thanks,
    Max

  • How to insert array of records in Storage table and  Nested table same time??

    Hi,
    I am using ProC++ ( Oracle 8i) . I want to insert a host array
    in a table. That table has a nested table in it. So for every
    record in my host array, there are muliple records to be
    inserted in Nested table. How is this possible using pro*C??
    Pls help.
    Thanks
    Nivedita

    Have a look at the Oracle 9i PL/SQL manual, which has an example.

  • Array of array of records

    hey, i have an array of twelve weeks, and each week is an array of 240 records which have a char for the status and an integer for the student number.
    I was wanting to store this structure to file, can anyone help me?
    preferably the data should be accessed randomly?
    thanks in advance!

    Hi.
    Take a look at the Java 2 API Documentation. The class RandomAccessFile should meet your demands.
    Regards,
    Kai

  • Mass deletion of variants for Total Records

    Hi there,
    during tranings we create a lot of variants for the Total Records (UCWB->Analysis->Total Records->Save Variant). Is there a way to do a mass deletion of those variants?
    The standard options of deleting variants only allows to delete one variant per selection.
    We work with a SEM BCS EHP 4.
    Thanks for all help,
    Helge

    Helge
    you can do a mass deletion of variants.
    First you will need to find the program name for the Totals Records.  This can be found from the totals records screen when you click the Get Variant button. Across the top of the dialogue box you will see;
    "Variant catelogue for program XXXXXXXXX". 
    Note this program ID.
    Go to TCode SE38
    Key in the program - make sure the Short description for the Program is "List of Totals Records"
    Check the Variants checkbox
    Click on Display
    From the menu - go Variants > Catelogue
    This should give a list of the variants for the Totals Records. If not then you must have the wrong program.
    Click the button which has the picture of the rubbish bin with the words "Selection Criteria".
    This will then allow you to put a check mark against all the variants you want deleted.
    Click the button which has the picture of the rubbish bin with the word "Variant"
    This will then mass delete your variants.
    Regards

  • Using dynamic array as record selection criteria-performance issue

    Hi All,
    I have successfully passed an array to my subreport and using it as selection criteria. This subreport is embedded in a group and prints data recursively. Problem is the selection is happening locally which causes all the records to be brought and then filters them. Any solution/help will be greatly appreciated.
    Thanks, in advance.
    -Vishal

    Thanks Vinay. But I think I found my answer actually at the selection criteria I was creating an array from string as follows,
    stringvar array ConjugateLots = split( str, ",")
    in ConjugateLots* //this was causing the local fitration and then I switch to
    * in split( str, ",") // which worked.
    But once again thanks. But now I have another issue, I want the records to be sort in the array items. Any help with that also greatly appreciated.
    Thanks,
    -Vishal

  • Initial loading with less added record in a cube

    Hi Everybody,
    I have loaded a Initial delta into a cube. in  that cube there are more than one lakh entries are transfered, but only 30,000 records are added, i donot know why it happened? how can i solved? help me...

    Hi Jaya,
               It is not a problem with no of records
    as cube is aggregates the key figure value.
    match the infocube data with PSA........if u find any missing records then debug the routines........

  • How to Disassemble Varying Multiple Repeating Records from Single Row

    I have a flat file that has hundreds of thousands of rows.  Each row is a new record.
    On each row there are about 23 elements that occur once per row and then there are two groups of 4-6 fields each group that repeat a certain number of times.  There is an integer field before each group that indicates how many times the group repeats
    0 or greater.  An few examples rows are the following. 
    a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|0|0
    a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|1|b|b|b|b|0
    a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|2|b|b|b|b|c|c|c|c|0
    a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|2|b|b|b|b|c|c|c|c|1|d|d|d|d|d|d
    a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|2|b|b|b|b|c|c|c|c|2|d|d|d|d|d|d|e|e|e|e|e|e
    a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|0|1|b|b|b|b|b|b
    a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|0|2|b|b|b|b|b|b|c|c|c|c|c|c
    I'd rather not do a custom pipeline if possible unless there is something already written.
    thanks in advance.

    Thank you for the quick response.  Would rather stick in biztalk if possible.
    I was able to get something like this to process through no problem.
    a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|1|b|b|b|b
    a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|0
    Just using and unbounded record with the group order type set to sequence. each row could have 0 to hundreds
    of groups.  And I've been able to process files with millions of rows.
    I'm wondering if there is a way to check the integer number in order to tell the group how many records
    there will be?
    Sucks that it is all the same delimiter.

  • Using an array to record button click order

    I am working on a demo of a UI for a handheld device. I am
    trying to make a back button that can track the users actions back
    several steps.
    I started by putting this line of code in my frame 1 actions
    layer:
    var wherefrom:Array = new Array();
    then i placed this follwing code on several different
    buttons:
    on(release){
    wherefrom.push("frame_name1");
    gotoAndStop("frame_name2");
    then on the back button i added this following code:
    on(release){
    gotoAndStop(wherefrom.pop());
    it doesnt seem to be working. I was wondering if this type of
    action is possible using AS2.0? any suggestions would be greatly
    appreciated.

    I believe scene names (and also scenes) only exist at
    authoring time and are converted to frame numbers when the swf is
    compiled (I may be wrong because I don't use them). You might have
    more success if you tried using frame numbers.
    Try using
    wherefrom.push(_currentframe);

Maybe you are looking for