Keep the order of the elements stored in the table pl.sql

Hello friends,

I'm having a type registration and for each item in the folder, I'll have the corresponding table of pl.sql type.

If I store the values in the records in a query and also the individual elements in the table of pl.sql type will be of the order of the data is stored as it is. ..

for example...

in a record type, the data is stored as (name1, years1, salary1), (name2, age2, salary2)

If I store in correspondent pl sql table type name1, name2
years1, age2
salary1, salary2

I can identify the index of the record type with that of type pl/sql table...

pls advice

Thank you/kumar

Kumar,

Yes, the order of the elements will be the same.

No specific reason why you want to create a collection for each attribute of the record?
You can also declare another variable of the same file and initialize it.

Some other suggestions for your code:

(1) FOR 2nd loop can be changed to accommodate the request of the first slider he - by eliminating an 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.FAMID

(2) the collections can alternatively be initialized as follows:

   v_member_rec(v_member_rec.last).FAMID := j.FAMID;
   max_earnings_tab(max_earnings_tab.last) := v_max_earnings;

The I tried the example for confirmation below...

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;

Tags: Database

Similar Questions

  • How to keep the tables in mode fixed?

    Don't know about you but I'm not used to the fact that available in many 3.5.3. moves horizontally and vertically. It distracts me a lot, especially with the touchpad on my Macbook Pro. Is there a way to get rid of this automatic void of white on the sides and bottom. If the table is small, there is no need to make "wobbly", don't you think?

    Someone at - it an idea?

    Hi BassPlaya,

    I think that what you are wanting to do is to reduce the size of the painting that arrays of numbers are sitting on.

    As I know there is no way to do. You can drag the table upwards and to the left, but do not stop when the yellow guides appear or hide you the first lines/colomns and be unable to view/edit the.

    I found this problem bothers me is no longer on the Mac-I set my scroll automatically.

    Quinn

  • How to read the table of SQL: ActiveRecord

    We try to write a script here to interrogate a database that maintains an inventory of our servers and automatically increment the server name to the next available number in the string.  We are able to query the database, but the output seems to be encrypted as it is not readable.  I think I need to convert it somehow to make it useful.  Someone knows how can I do this?  I'm kinda new to javascript, so it's all new to me.

    Here's the script we have got so far.

    var preservername = resultVMName;

    function zeroPad (num, count)

    {

    var numZeropad = num + ";

    while(numZeropad.Length < Count) {}

    numZeropad = '0' + numZeropad;

    }

    Return numZeropad;

    }

    var query = "SELECT MAX (ServerName) FROM servers WHERE servername as ' % ' + preservername + ' % ' limit 1';"

    System.log ("Executing query" + query + "on the database" + database.name);

    resultRecordsOut = database.readCustomQuery (query);

    System.log(resultRecordsOut[0]);

    var maxserver = resultRecordsOut [0] m:System.NET.SocketAddress.ToString ();

    System.log ("It's the value of maxserver" + maxserver);

    var prenumber = maxserver.substring (0.10);

    var number = parseInt (maxserver.substring (10,13));

    var newnumbers = zeroPad (numbers + 1, 2);

    var newname = prenumber + newnumbers;

    System.log (NewName);

    OK... so I think that the last piece of the puzzle, here it is!  The value of each column is stored as a property inside the table, therefore, I think that you need to do is something like this:

    resultRecordsOut = database.readCustomQuery (query);

    resultLastRecord = resultRecordsOut [resultRecordsOut.length - 1];

    System.log (resultLastRecord.getProperty ("MAX (ServerName)");)


    This can get you where you need to be, more or less.

  • XML data in the table using sql/plsql

    Hi experts,

    Could you please help with the following requirement. I have the tags xml (.xml on a server file) below. I need to access this file and read the XML and insert into the db table using sql and plsql. Is it possible with the cdata below? And there is a nested this table.

    Could someone please guide me if you have a sample code file and xml.

    <? XML version = "1.0" encoding = "UTF-8"? >

    < generation_date > <! [CDATA [17/11/2015]] > < / generation_date >

    < generated_by > <! [CDATA [Admin Admin]] > < / generated_by >

    < year > <! [CDATA [2015]] > < / year >

    < month > <! [CDATA [01]] > < / month >

    < author >

    < author > <! [CDATA [user author]] > < / author > < author_initial > <! [CDATA [user]] > < / author_firstname > < author_country > <! [CDATA [author]] > < / author_lastname >

    < author_email > <! [CDATA [[email protected]]] > < / author_email >

    < author_data_01 > <! [CDATA []] > < / author_data_01 >

    < author_data_02 > <! [CDATA []] > < / author_data_02 >

    < items >

    < article_item >

    < article_id > <! [CDATA [123456]] > < / article_id >

    < publication > <! [CDATA [Al Bayan]] > < / publication >

    < section > <! [CDATA [Local]] > < / section >

    < issue_date > <! [CDATA [11/11/2015]] > < / issue_date >

    < page > <! [CDATA [2]] > < / print this page >

    < article_title > <! [CDATA [title.]] > < / article_title > < number_of_words > <! [CDATA [165]] > < / number_of_words >

    < original_price > <! [CDATA [200]] > < / original_price >

    < original_price_currency > <! [CDATA [DEA]] > < / original_price_currency >

    < price > <! [CDATA [250]] > < / price >

    < price_currency > <! [CDATA [DEA]] > < / price_currency >

    < / article_item >

    < / articles >

    < total_amount > <! [CDATA [250]] > < / total_amount >

    < total_amount_currency > <! [CDATA [DEA]] > < / total_amount_currency >

    < / author >

    < / xml >

    Thanks in advance,

    Suman

    XMLTABLE using...

    SQL > ed
    A written file afiedt.buf

    1 with t (xml) as (select xmltype ('))
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    [[12 [email protected]]] >
    13
    14
    15
    16
    17
    18
    19


    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33 ") of the double)"
    34-

    35 end of sample data
    36-
    37 - assumptions:
    (38 - a) XML may have several tags
    (39 - b) each may contain more
    40-
    41 select x.gen_by, x.gen_date, x.mn, x.yr
    42, y.author, y.auth_fn, y.auth_ln, y.auth_cnt, y.auth_em, y.auth_d1, y.auth_d2

    43, z.id, z.pub, z.sec, z.iss_dt, z.pg, z.art_ttl, z.num_wrds, z.oprice, z.ocurr, z.price, z.curr
    44 t
    45, xmltable ('/ authxml')
    from $ 46 t.xml
    path of 47 columns gen_date varchar2 (10) '. / generation_date'
    48, path of varchar2 (15) of gen_by '. / generated_by'
    49, path of varchar2 (4) year '. "/ year"
    50 varchar2 (2) mn road '. "/ month"
    51, path of xmltype authors '.'
    52                 ) x
    53, xmltable ('/ authxml/authors ')
    from $ 54 x.authors
    author of 55 path of varchar2 columns (15) '. / author'
    56, path of varchar2 (10) of auth_fn '. / author_firstname'
    57, path of varchar2 (10) of auth_ln '. / author_lastname'
    58 road of VARCHAR2 (3) auth_cnt '. / author_country'
    59 road of varchar2 (20) of auth_em '. / author_email'
    60 road of varchar2 (5) of auth_d1 '. / author_data_01'
    61, path of varchar2 (5) of auth_d2 '. / author_data_02'
    62, path of xmltype articles '. / Articles'
    63                 ) y
    64, xmltable ('/ Articles/article_item ')
    from $ 65 y.articles
    path id 66 number columns '. / article_id'
    67, path of varchar2 (10) pub '. ' / publication.
    68 road of varchar2 (10) dry '. / section'
    69, path of varchar2 (10) of iss_dt '. / issue_date'
    70 road of VARCHAR2 (3) pg '. "/ print this page"
    71, path of varchar2 (20) of art_ttl '. / article_title'
    72, path of varchar2 (5) of num_wrds '. / number_of_words'
    73, path of varchar2 (5) of oprice '. / original_price'
    74 road to VARCHAR2 (3) ocurr '. / original_price_currency'
    75, path of varchar2 (5) price '. "/ price"
    76, path of VARCHAR2 (3) curr '. / price_currency'
    77*                ) z
    SQL > /.

    GEN_DATE GEN_BY YEAR MN AUTHOR AUTH_FN AUTH_LN AUT AUTH_EM AUTH_ AUTH_ ID PUB DRY ISS_DT PG ART_TTL NUM_W OPRIC HEARTS PRICE OCU
    ---------- --------------- ---- -- --------------- ---------- ---------- --- -------------------- ----- ----- ---------- ---------- ---------- ---------- --- -------------------- ----- ----- --- ----- ---
    17/11/2015 Admin Admin 2015 01 user author user author [email protected] 123456 UAE Al Bayan Local 11/11/2015 2 is the title.   165 200 AED AED 250

    Of course, you'll want to change the types of data, etc. as needed.

    I assumed that the XML can contain several "" sections and that each section can contain several entries.

    Thus the XMLTABLE aliasing as 'x' gives information of XML, and supplies the data associated with the XMLTABLE with alias 'y' which gets the multiple authors, which itself section of the XMLTABLE with alias 'z' for each of the article_item.

    CDATA stuff are handled automatically by SQLX (XML functionality integrated into Oracle's SQL)

  • Count when the boolean function is true / complete the table

    Hi all

    I think that this is a task fairly easy, but for some reason, I can't get it to work.

    The problem is explained below:

    I have 3 slider that gives either 0,1,2. I have a button "next" which is actually a Boolean button. Every time I click on the 'next' button, I want the values of the scabbard 3 (0,1,2) to go into a table. The array index is decided by how many times I clicked on the button "next". Basically if I click Next the first time, the values should go to the 0th row, when I clicked on the second time, he should go to the first line, etc... This should continue to happen until I click on the button stop, when it should display the table populated with its index corresponding to me.

    I tried to use a program for a Boolean County who continually keeps count how many times I pressed the next button. But this loop continues indefinitely. Otherwise, it starts from 0. I don't know how to do it well.

    The program is presented here with comments.

    Help, please

    Gayatri

    You should really use a structure of the event.  Keep the table in a shift register and simply use table build to y to add whenever the next value change event will occur.  Have another event for the stop button.

  • want to remove the table in 10g

    Hi all;

    I was 1 million inserting dummy records in the table.

    Unfortunately, closed session without commit or rollback.

    > > now, I want to delete the table

    SQL > drop table petra.ycx;

    drop table petra.ycx

    *

    ERROR on line 1:

    ORA-00054: resource busy and acquire with NOWAIT specified

    SQL > select count (*) in the petra.ycx;

    COUNT (*)

    ----------

    2

    SQL > select a.sid, a.serial # session $ v a, v$ locked_object b, c dba_objects

    2 where b.object_id = c.object_id

    3 and a.sid = b.session_id and OBJECT_NAME = 'YCX. "

    SID, SERIAL #.

    ---------- ----------

    11 159

    SQL > alter system kill session 11 159;

    alter system kill session 11 159

    *

    ERROR on line 1:

    ORA-00026: missing or not valid session ID

    The command is

    alter system kill session '159,11';
    

    Justin

  • How to remove the Tables of HFM Application in SQL

    Hi gurus

    1. how to remove the HFM Application Tables in SQL?
    Its manual removal but each application having 120-150 tables? How to do this in one fell swoop?

    I deleted some applications using the workspace / shared services, but still its display under HFM under the Tables of SQL Server.

    Please help me

    concerning
    Smilee

    Hi Smilee,

    1. If the application opens in the web management interface, go to Taskflows management module and make sure that no taskflows exist yet for this application. Remove any existing taskflows.

    2. If demand exists in Shared Services, right-click on the demand for Shared Services and try to remove the application from here

    3. stop Hyperion Shared Services and all the Windows of financial management processes and backups of the relational database of the two patterns.

    4. check the relational database of Hyperion Shared Services repository, in the "ces_apps" table and make sure that there are no lines containing the appname "EXAMPLE." If the line still exists you should enlist the help of Oracle Global Support software to clean Hyperion Shared Services before proceeding.

    5. it is possible to remove all content removed from the relational database of financial management application. Must be very careful when handling manually tables database that permanent damage can be done at the application and other applications if the wrong content is removed.

    (a) first remove all tables, indexes, sequences, and the package objects that begin with the name of the application
    (b) remove all tables starting HSV_appname_xxxxxx
    (c) remove all rows in tables referring to demand HSX_CLUSTER_xxxxx.
    (d) delete all the HSV_ACTIVITY_KILL_USERS, HSV_ACTIVITY_NO_ACCESS, HSV_ACTIVITY_SESSIONS and HSV_ACTIVITY_USERS and HSV_USERS_ON_SYSTEM lines that refer to the name of the application.
    (d) remove the line containing the name of the application from the HSX_DATASOURCES table.

    6. the next time that all Hyperion services are restarted, the application must be removed safely from Windows client.

    You can contact your DBA to write a query on how to remove it.

    Hope this helps,

    Thank you
    Charles Babu J

  • How do you keep the organizer of a mixture of the order of the photos when loading off the memory card?

    @How do you keep the organizer of a mixture of the order of the photos when loading off the memory card?

    It sounds like you are using Photoshop Elements, and Photoshop Elements forum would be better answered that.

    Photoshop Elements

    Gene

  • Keep the build order when replacing image?

    Hi guys this problem has plagued me for a while.

    I create a video model in Keynote. The intro slide has a video file (locked) followed by an (unlocked) image and finally another video file (locked). The three of them follow a specific build order with delays, which in turn creates the complete animation.

    I want that the user don't just replace this the Middle image on the slide with one of their choice.

    The problem is, once replace it user order image, positioning of the image and delay in construction are lost. Unfortunately I don't think users are sophisticated enough to follow instructions on how to set the build order, then replace the timing delay, the image needs.

    Is there anyway someone (with a limited understanding of Keynote) can replace the Middle image without compromising the build order?

    Thank you!

    Use an image placeholder:

    • Add a picture to the slide in the format (vertical or horizontal)
    • position and size according to the needs
    • Add a formatting required (picture frame, shadow, etc.)
    • Select the image then: Inspector > Format > advanced > define as media placeholder

    users drag and drop any image on the support of the place that adopts the formatting of the placeholder and keep the animation settings

  • How can I remove the sort of conversations from windows livemail, but keep the chronological order?

    How can I remove the sort of conversations from windows livemail, but keep the chronological order?  The standard options do not seem to understand my Inbox of sort by chronological order of!

    On the view tab, select Conversations > Off. Then click on display a line below the list of messages. Right-click on a column heading to select the column, drag a column header to reorder the columns, and click on a column heading to sort by that field.

    Windows Live Mail has its own support at the Windows Live Solution Centerforums. Please address any other question you may have on one of the forums on the right side of this page.

    Noel

  • keep the value of the element after &amp; LOGOUT_URL.  It is called

    Hello

    I need to keep the value of the item when I click on logout url.

    When logout is called, it takes me to page 1 but I need the P1_SCHEMA element to keep its value before closing your session

    is this possible?

    Apex 4.2

    database EE 11.2

    Thank you.

    I did the following to solve my need.

    -creation page 102

    -changed the navigation bar of the input parameters to "redirect to page 102.

    -created the process of loading page 102 to create the coockies as follows

    Start

    owa_util.mime_header ("text/html", FALSE ");

    (owa_cookie). Send

    name-online "SCHID_COOKIE."

    value => '& SCHID.',

    expires => it sysdate + 1);

    apex_application.g_unrecoverable_error: = true;

    owa_util. REDIRECT_URL ('& LOGOUT_URL.');

    exception: when other then null;

    end;

    --

    Page 102 creates the coockies Ant sets the value of the application element, then of going to & logout_url. automatically

    -createn on the process of loading the page 1 (default home page) as follows the coockies value

    DECLARE

    cookie OWA_COOKIE.cookie;

    BEGIN

    cookie: = OWA_COOKIE.get ('SCHID_COOKIE');

    If cookie.vals.First IS not NULL then

    : SCHID: = cookie.vals (1);

    end if;

    END;

    now, I have a question... I have to owa_cookie.remove () somewhere?

    Thank you!

  • Hi, I have adobe (downloaded) 12 for windows pc elements 7, but want to transfer on mac (not not keeping the pc). How?, please.

    Hi, I have adobe (downloaded) 12 for windows pc elements 7, but want to transfer on mac (not not keeping the pc). How?, please.

    Download the Mac version and use your serial number to acrivate it.  As long as your license is mulriplatform it should work.

    PES 10, 11, 12 - http://helpx.adobe.com/photoshop-elements/kb/photoshop-elements-10-11-downloads.html

    PE 10, 11, 12 - http://helpx.adobe.com/premiere-elements/kb/premiere-elements-10-11-downloads.html

  • cannot uncheck "Keep the Proportions" in PS Elements 10 for Mac

    I use Adobe Photoshop Elements 10 for Mac (Lion running). I want to set the resolution of the image without changing the size of the image.

    When I go to Image-> resize-> size of the Image, the height, the width and the proportion is subject to the constraints set. The "Keep the Proportions" box is checked. I can't uncheck. By clicking on the icon of the chain doesn't help either. The image is a JPEG image. Anyone know what I should do to be able to raise the constraint proportions? Thanks in advance for your advice!

    The answer: check the resampling.

  • How to keep the alignment of a group logo based on four elements?

    I created and aligned a logo based on four letters. Subsequently I've grouped. The alignment is correct. But if I copy the Group and place it in a different location, alignment falls slightly out of place. What should I do to keep the aligned group?

    Thank you for answer

    Angelika

    I see two things that could cause this.

    First of all is to line up on the starting grid. If enabled for a letter, but not others, you may see changes in the vertical postioning of this letter of treation to others. If applied to all you letters could find, you cannot position the logo vertically accurate spot you want. More likely, however, you would see one or several letters go in excess at least executives were very deep.

    Second is text wrapping. If the letters are individual images, they would be individually affected by the text applied to another object wrapping. You could overcome this by turning on "Ignore the text of not dress" for images of logo in the text frame options.

    Other things you could do: convert the text to outlines text. When you convert to outines you have editable text, and it is not subject to the skin or the complications of grid planning.

    Or create the logo in a second document and export to PDF, then place the PDF file. It will behave like a picture. If you need be able to easily modify the logo, save it in a separate ID doc and place the page of the .indd. The original update will update the copy placed.

  • I would like to know if there is any way I can remove the 32-bit and keep the 64-bit without harming my computer

    I ran windows 7 installation on my computer using DVD who had 32 and 64-bit data and for that I currently have 32-bit and 64-bit installed in my computer. So I would like to know if there is any way I can remove the 32 bit and keep the 64 bits without harming my computer or stored data because now both bits is eating space on my C drive/partition!

    OT:

    Windows

    Why do you think you have "32-bit and 64-bit" versions of Windows 7 installed?

    If you installed the 64-bit version (which you will need if your computer has more than 4 GB of RAM and you want to use all of this RAM), you can see a few references to 32-bit architecture.  The 64 bit version of Windows needs these files in order to run software that is designed for 32-bit architecture.

    Perhaps the most obvious instance is the presence of the following two directories:

    C:\Program Files and C:\Program Files (x 86).  It is normal for both of these directories present in a 64-bit system.

    Maybe this will help--> 32-bit and 64-bit Windows: frequently asked questions

Maybe you are looking for