Will the order of elements stored in pl.sql table retains

Hello Friends,
I am having a record type and the for each element of record , i am having corresponding pl.sql table type .
If i am storing the values into the records from a query and also the individual elements in the pl.sql table type will the order of data is stored as it is . ..
example...
in a record type the data is stored as ( name1 , age1 , salary1) , (name2, age2, salary2)
if i store in corresponding pl sql table type name1 , name2
age1, age2
salary1, salary2
can i relate the index of record type with that of pl/sql table type ..
pls advice
thanks/kumar

Kumar,
Yes, the order of elements will be the same.
Any specific reason why you would want to create a collection for each individual attribute of the record ?
You can as well declare another variable of the same record and initialize it.
A few other suggestions for your code :
1) The 2nd FOR loop can be modified to accommodate the query of the first cursor there-by eliminating one extra iteration.
SELECT MINC.FAMID,
                     MINC.MEMBNO,
                     MEMB.AGE,
                     SALARYX,
                     SALARYBX,
                     NONFARMX,
                     NONFRMBX,
                     FARMINCX,
                     FRMINCBX,
                     CU_CODE
                FROM MINC, MEMB, FMLY
               WHERE MINC.FAMID = MEMB.FAMID
                 AND MINC.MEMBNO = MEMB.MEMBNO
                 AND MINC.FAMID = FMLY.FAMID
                 AND MEMB.FAMID = FMLY.FAMID
               ORDER BY MINC.FAMID2) The collections can be alternately initialized as follows :
   v_member_rec(v_member_rec.last).FAMID := j.FAMID;
   max_earnings_tab(max_earnings_tab.last) := v_max_earnings;The tried the below example for confirmation ...
declare
type emp_rec is record
(name emp.ename%TYPE,
  dept emp.edept%TYPE,
  sal  emp.esal%TYPE
TYPE emp_rec_tab is table of emp_rec;
ert emp_rec_tab := emp_rec_tab();
TYPE ename_tab is table of varchar2(20);
ent  ename_tab := ename_tab();
TYPE edept_tab is table of number;
edt  edept_tab := edept_tab();
begin
for i in (select * from emp)
loop
     ert.extend;
     ent.extend;
     edt.extend;
     ert(ert.last).name := i.ename;
     ert(ert.last).dept := i.edept;
     ert(ert.last).sal := i.esal;
     ent(ent.last) := i.ename;
     edt(edt.last) := i.edept;
end loop;
for i in 1..ert.count
loop
     dbms_output.put_line(ert(i).name||','||ent(i));
     dbms_output.put_line(ert(i).dept||','||edt(i));
     dbms_output.put_line('');
end loop;
end;

Similar Messages

  • How can i change the order of  elements in a JList ?

    Hi,
    i would like to know if it is possible to change the order of elements in a JList ? Maybe i could use drag and drop to do this ?
    Thanks for answering.

    The simplest way is probably to implement ur own listmodel and then supply the listitems in the order u want. Example:
    class MyListModel
              extends AbstractListModel
              implements ContactListListener {
    public int getSize() {
    return listitemcount;
    public Object getElementAt(int index) {
    //here u return the item for the index at the list
    //if u for example have an array of strings
    //which u wanna have listed in reversed order (reversed to
    //the order in the array, u could do
         return myarray[getSize()-index];
    }

  • Reverse the order of elements in an array

    how would i go about Reverse the order of elements in an array??

    I link to the javadocs can't be too bad. [url
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Coll
    >
    ections.html#reverse(java.util.List)]Collections.rever
    se(List)Of course I fortell the next question, but I wantan
    Array not a List? So I provide the next link:[url
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arr
    ys.html#asList(T...)]Arrays.asList(T...)Yeah but then you have to worry about the next
    question which is more of a statement: "I can't use
    Arrays".
    Then I would as them: How would you do it in real life? Of course they could think a real world way of doing it. In that case, I'll give them an real life example.
    Assumed List
    1 2 3 4 5 6 7 8 9 10 11 12 13
    Switch the first and the last elements
    13 2 3 4 5 6 7 8 9 10 11 12 1
    Then the second and second to the last
    13 12 3 4 5 6 7 8 9 10 11 2 1
    And repeat until your half way.
    13 12 10 4 5 6 7 8 9 3 2 1
    13 12 10 9 5 6 7 8 4 3 2 1
    13 12 10 9 8 6 7 5 4 3 2 1
    13 12 10 9 8 7 6 5 4 3 2 1
    Done.

  • Will Vector keep the order of elements?

    I would like to quickly add lines of a file into a vector to get the size. I then create an array using that declaring that number of elements, then read each vector element into the array. I thought I read somewhere that a Vector may swap the order of the elements?

    I thought I read
    somewhere that a Vector may swap the order of the
    elements?Well, if you did read that somewhere it might be true. If you write some serious code you cannot buy what people just say. You have to look into it for yourself and ESTABLISH what goes with your chosen data-structure.
    PS. My advice to everybody is to look into this stuff and convince yourself you're doing the right thing.

  • How to run a SQL statement which is stored inside an SQL Table

    Hello,
    If anyone please help me with the following problem I would be forever grateful
    I have an SQL statement which is stored inside a certain SQL table, I want to use that SQL statement inside my PL/SQL procedure.
    Was thinking of a simple solution of obtaining the SQL statement into an array and then execute it, yet how could I do so exactly with PL/SQL? I've only started playing around with PL/SQL in the last few days.
    Thanks in advance!
    This is how it looks like more or less:
    Displaying result for:
    SELECT TRIM(OBJ_VALU_TXT)
    FROM   OBJ_VALU_DOC
    WHERE  OBJECT_TYPE  = 'FLD'
      AND  OBJECT_CODE  = 15443
      AND  OBJ_VALU_CD  = 'ACR'
    ORDER BYDOC_SEQ_NO
    00001                                                            
    SELECT
    VALUE(MAX(RECEIPT_NO) + 1, :OUT-COMP-FACTOR)
    FROM RECEIPT
    WHERE (RECEIPT_NO BETWEEN
    :OUT-COMP-FACTOR AND :OUT-TO-NUMBER) OR
    (RECEIPT_NO > :OUT-COMP-FACTOR AND
    :OUT-TO-NUMBER = 0)

    Here's a demo of your requirement.
    create table t ( col1 varchar2(200));
    table created
    insert into t values('select * from dual');
    1 row inserted
    declare
    v_col varchar2(200);
    v_val varchar2(200);
    begin
    select col1 into v_col from t;
    execute immediate v_col into v_val;
    dbms_output.put_line(v_val);
    end;
    X
    Using into clause, you can use as many variables as required. But the basic approach reamins the same.
    But storing SQL in DB is not an efficient design.
    Ishan

  • Reverse the order of elements in array?

    Hi All,
    i have elements of string[] aray = {one,two,three};i want the elements needs to be in reverse order..
    ex : {three,two,one};how can we do this...
    plz help on this...with example..
    thanks in advance..
    jags.

    Melanie_Green wrote:
    Eric-Fistons wrote:
    int j = 0;
    for (int i = array.length - 1; i >= 0; i--) {
    newArray[j] = array;
    j++;
    Simplified
    int j = 0;
    for (int i = array.length; i > 0; i--){
    newArray[j++] = array;
    }Aka bored, Mel
    package forums;
    import java.util.Arrays;
    class ArrayReverserator
      public static void main(String[] args) {
        try {
          System.out.println(Arrays.toString(reverse(new Object[]{1,2,3})));
        } catch (Exception e) {
          e.printStackTrace();
      public static Object[] reverse(Object[] a) {
        Object[] result = new Object[a.length];
        for ( int i=a.length-1,j=0; i>=0; --i ) {
          result[j++] = a;
    return result;
    I also am bored...
    <tut-tut>for i=a.length; i>0; == you're slipping</tut-tut>
    IMHO, java.util.Arrays could stand to have a reverse... it is, after all, just special case of sort... by index decending.
    Cheers. Keith.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • The order of elements in an array.

    Hi
    I have an array whose array.length is 3.
    I need to add a new element at the the first position in the array.
    For example the existing values in the array are
    1,2,3.
    Now I need to add 10 in the first position so that the array looks like : 10,1,2,3.
    Is there any Java API that accomplishes this.
    Any help is highly appreciated.
    Thanks in advance.

    You can use the new appendToBeginning method of the CrazyMadeUp Class. It's available in version 1.6 (codename Monkey) and above. Unfortunately it only works with Objects though.
    public static Object[] appendToBeginning(Object[] originalArray, Object[] addToStart) {
      Object[] tempArray = new Object[originalArray.length + addToStart.length];
      System.arraycopy(originalArray, 0, tempArray, addToStart.length, originalArray.length);
      for (int i = 0; i < addToStart.length; i++) tempArray[i] = addToStart;
    return tempArray;

  • What will the order of the calls for the constructors

    class TempP
         int k,l;
         TempP(){this(2,3);System.out.println(" In temp's  constructor");}
         TempP(int k, int l){this.k=k;this.l=l;}
    public class Temp
         int i,j;
         Temp(){this(4,5);}
         Temp(int i,int j){this.i=i;this.j=j;}
         public static void main(String[] a)
              Temp t=new Temp();
    }

    Since class TempP is never instantiated, its constructors will never be called.
    In your main method, you instantiate using the default constructor which then calls the constructor which takes two int's as arguments.
    Mark

  • How to find the list of unused stored procedures in SQL Server 2005?

    Hi,
    I need to find out the list of stored procedures which are not in use.
    I found there is something called "sys.dm_exec_procedure_stats " for SQL server 2008.
    Can you please suggest your ides here to do the same job for SQL server 2005.
    Many Thanks.

    In SQL 2005 there is, sort of. This is query lists the last execution
    time for all SQL modules in a database:
       SELECT object_name(m.object_id), MAX(qs.last_execution_time)
       FROM   sys.sql_modules m
       LEFT   JOIN (sys.dm_exec_query_stats qs
                    CROSS APPLY sys.dm_exec_sql_text (qs.sql_handle) st) 
              ON m.object_id = st.objectid
             AND st.dbid = db_id()
       GROUP  BY object_name(m.object_id)
    But there are tons of caveats. The starting point of this query is
    the dynamic management view dm_exec_query_stats, and the contents is
    per *query plan*. If a stored procedure contains several queries, 
    there are more than one entry for the procedure in dm_exec_query_stats.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Get the Last Value of Status Field from SQL TABLE using SQL 2008

    I have a table with Fields such as
    UploadstartTime, UploadEndtime, STATUS From TBLA.
    The STATUS Field, has values =7 and 11 are failed and 12 is SUCCESS. I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get STATUS For that record. How can I do that using 1 SQL Query?
    My current code is: The issue is
    select
      TBLNAME
    MaxUploadstarttime
    =
    max(UploadStartTime),
    MaxUploadEndtime
    =
    max(UpLoadEndTime),
         Status=max(status)
    from  DB.DBO.LOGTABLE
    p1

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You failed! Temporal
    data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> I have a table with Fields such as <<
    Fields are not columns! There is no generic status in RDBMS. Putting “tbl-” in a table name is called tibbling and we make fun of people who do it (Google Phil Factor's humor columns. If you were polite is this what you wanted to post? 
    CREATE TABLE Something_Uploads
    (upload_source_name CHAR(15) NOT NULL,
     upload_start_timestamp DATETIME2(0) NOT NULL,
     PRIMARY KEY (upload_source_name, upload_start_timestamp),
     upload_end_timestamp DATETIME2(0),
     CHECK(upload_start_timestamp < upload_end_timestamp),
     upload_status INTEGER NOT NULL 
       CHECK (upload_status IN (7,11,12, ..))
    >> I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get upload_status For that record [sic]. How can I do that using 1 SQL Query?  <<
    Since you told us nothing and gave no sample data, want to correct this postign? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to get the incoming filename and store it to sql table using biztalk server 2013

    HI,
    1)I need to get the incoming EDI filename which is received and save the filename in to the database.
    2)How can i get the EDI Duplicate filename if i set the do not allow duplicate under validation tab in X12 agreement settings in biztalk admin console. In this case since the duplicate file will not come in to orchestration. In this case how
    can i acheive this.
    Thanks,
    Vijayan
    vijayan

    For both cases, the filename can be found on the FILE.ReceivedFileName Context Property.  You can access this Property in a Pipeline Component or Orchestration and take any action you want, such as apply to a database.
    The value is accessed by: MyReceivedMessage(FILE.ReceivedFileName)
    In the case of a duplicate EDI Interchange, you would use the Failed Message Routing feature to capture the error message with either an Orchestration or Send Port.

  • Customizing the order of input tag variables?

    How do you change the order of elements inside input tags?
    Example :
    <input value="A" name="B" type="checkbox" />
    Instead of...
    <input name="B" type="checkbox" value="A" />
    etc.. (and will a code formatting fix all past instances?)

    You're a stubborn one, aren't you?
    The question, still quoted below by the way, was "*How* do
    you change the
    order of..." and not "*Does* changing the order of affect..."
    I didn't ask if it would make a difference in the output. I
    asked how I can
    have DW automatically re-order the elements inside the tag.
    Turns out I
    can't, so the point is now moot.
    And before you follow up by telling me it doesn't matter what
    the order is
    again like a broken record : it might not to you but it does
    to me. Some of
    these tags are 300 chrs long if you include CSS,
    javascripting and other
    optional attributes. So if I'm in the code view and I'm
    looking for VALUE
    and not ID -- or, as is the case, if I'm passing this code
    onto other
    programmers who are coding via text only, then I (and them)
    appreciate
    knowing if a tag will potentially be found at the beginning,
    middle or end
    of a 300-chr input string.
    "xtra" <[email protected]> wrote in message
    news:ekid9s$j2n$[email protected]..
    > Yes, it did. You asked about changing the order of the
    elements. And I
    > answered that you don't have to for them to work.
    >
    > Good luck.
    >
    >
    > "R. Jay" <[email protected]> wrote in message
    > news:ekia6h$fjf$[email protected]..
    >> Thanks, but that wasn't the question. :(
    >>
    >> "xtra" <[email protected]> wrote in message
    >> news:ekhple$pbi$[email protected]..
    >>> The order of the attributes doesn't matter.
    >>>
    >>>> "R. Jay" <[email protected]> wrote in
    message
    >>>> news:ekfqjn$efq$[email protected]..
    >>>>> How do you change the order of elements
    inside input tags?
    >>>>>
    >>>>> Example :
    >>>>> <input value="A" name="B"
    type="checkbox" />
    >>>>>
    >>>>> Instead of...
    >>>>>
    >>>>> <input name="B" type="checkbox"
    value="A" />
    >>>>>
    >>>>> etc.. (and will a code formatting fix
    all past instances?)

  • How do I change the order of phone numbers in a contact?

    When I enter phone numbers for a contact on the iPhone, they seem to be stuck in the order they were entered. Is there any way to change the order using the phone interface? I sync with Yahoo Address Book. Will the order be preserved if I change the order there?

    Ditto! I am having the same problem. Anyone?

  • Error while releasing credit block for the order

    Hi all,
    I am getting follwing error while releasing credit block for the order in VKM1
    Incorrect index structure for table IVBEP1
    Text
    Incorrect index structure for table IVBEP1
    Diagnosis
    Internal error.
    Procedure
    Repeat the transaction.
    If the error occurs and you have a CRM System connected to your SAP R/3 System, the document may have been archived in the CRM System.
    If the error occurs again, inform your system administrator. If the error cannot be corrected, call the SAP Hotline directly. Describe which steps preceeded the error.
    But we are not transfering any orders to CRM.The order can be only seen in R/3
    Please assist
    Regards
    Mano

    Hi
    KIndly check the oss note 505876 in may help you
    Regards
    Damu

  • Express Document:Update was terminated while processing the Order via VA02.

    Hi,
        User was trying to process order for orderlines say for Eg POSNR 20 to 400 for a particular order,He ended up with Express document :Update was terminated error.When i Checked in SM13 for the update termination errors,I got the following error.
    VI: 200 Item status (document &, item &) is missing.
    I checked the order (POSNR 20 to 400 ) in VBUP  table and the entries were missing for this order (Posnr 20 to 400 ).
    Appreciate you'r Inputs.
    Thanks
    Rakesh.

    Hi,
    Can you please send the detail message in express document.
    Apps

Maybe you are looking for