adding all entries from one collection to another?

Hello

my database is a 11g

I have a function (in a box) than returnes a collection.

I want to call the function multiple times and the caller must combine all entries selected in a single collection (new?):

create or replace package my_test is
  procedure public_proc;
end my_test;

create or replace package body my_test is

cursor test_data(selected_type varchar2) is
  select (1+ABS(MOD(dbms_random.random,100000))) as id, selected_type||level as my_value from dual connect by level<5;

type my_type is table of test_data%row_type;

function private_function(selected_type varchar2) return  my_type is
  v_my_type my_type := my_type();
begin
  open  test_data(selected_type=> selected_type);
  fetch  test_data bulk collect into  v_my_type;
  close  test_data;
  return  v_my_type;
end  private_function;

procedure public_proc is
  v_my_type_a my_type := my_type();
  v_my_type_b my_type := my_type();
  v_my_type_ab my_type := my_type();
begin
  v_my_type_a := private_function(selected_type=>'A');
  v_my_type_b := private_function(selected_type=>'B');
  -- simplest solution to combine  v_my_type_a and  v_my_type_b to  v_my_type_ab, possible without explicit loop?
for i in  v_my_type_ab.first..v_my_type_ab.last loop
    dbms_output.put_line('id: '||v_my_type_ab(i).id||', value:'||v_my_type_ab(i).my_value);
end loop;
end public_proc;
end my_test;

desired output (x instead of random number):

id:x, value:A1
id:x, value:A2
id:x, value:A3
id:x, value:A4
id:x, value:B1
id:x, value:B2
id:x, value:B3
id:x, value:B4

Good bye

DPT

I can also do a big collect in against a collection of nested type?

OK – what a trick question?

You ask if you can do what the code you first published already does?

Hmmm - well, I'll say YES - since your code is already doing it.

What type of collection, exactly, do you think that you have agreed with this line?

type my_type is % row_type test_data table;

Of course, 'row_type' is not valid; It is % ROWTYPE.

If you are unsure what type of collection which is then I suggest that you only consider "with the help of the Collections of PL/SQL and Records" in the language PL/SQL doc

http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm

He explained each of the collection types, explain how to choose one that suits and examples of their use.

DECLARE

cursor emp_data (my_job emp.job%type) is select *.

from emp where job = my_job;

type my_emp_data is table of the emp_data % rowtype;

my_emp_data v1.

my_emp_data v2.

my_emp_data v3;

BEGIN

Open emp_data ("REGISTRAR");

extraction emp_data bulk collect in v1;

close emp_data;

Open emp_data ("SELLER");

extraction emp_data bulk collect in v2;

close emp_data;

v3: = v1 v2 of MULTISET UNION;

for me in v3.first... loop v3. Last

dbms_output.put_line (v3 (i) .ename |) ' - ' || V3 (i) .job);

end loop;

END;

/

SMITH - CLERK

ADAMS - CLERK

JAMES - CLERK

MILLER - CLERK

ALLEN - SELLER

WARD - SELLER

MARTIN - SELLER

TURNER - SELLER

Also note that I do NOT use a query to combine collections:

v3: = v1 v2 of MULTISET UNION;

Tags: Database

Similar Questions

  • How to move photos from one Collection to another Collection

    Some, while the rear I hung some pictures from one Collection to another Collection.

    Later, I noticed that I had lost the ability to edit images moved.

    Please explain how can I move photos between Collections without causing problems?

    Cliff

    However, I can't figure out how to move photos from a private Collection to another more appropriate called Collection. I had thought that drag would do the trick. But I was wrong.

    Well, I think it's the right way to do it. Why do you think it's wrong? What is going on? Describe in detail or show a screenshot. State of the edited, complete error messages, Word for Word.

  • ADMITTED that Cookies exceptions list does not keep the entries from one session to another.

    YES, I searched the KB for a response... no joy. I want to manage my cookies by adding a few sites I want to allow cookies for, with all the other sites being rejected and me be prompted whenever a site wants to dnld a cookie. I think I understand all of the available settings, but I can't bet FF to keep the list of allowed websites from one session to another, and sometimes FF keeps their same immediately after I save them. I've never had a problem with FF3, but now I'm having this problem with FF4.

    You can't keep cookies if you run Firefox in private browsing mode.

    Private - browsing using Firefox without saving history all cookies are session cookies that expire if this session is over, so sites don't remember you.

  • Moving from one Collection to another PC

    I use Windows 7 and 6 LR.  I am trying to create a slideshow, but I was told that my graphics card is not enough to see a preview or play them as the photo is just a black square showing only the outline and the title.  I then tried exporting at the thought of video that I might be able to do what I want ultimately to make the creation of a video without the consultation on my PC, but that only accidents of LR.

    I used some photos in my laptop and the overview or the game works very well there.  So here's my question now.  Is there a way to export a Collection of photos of a USB key, so I can import it into my laptop to create the slide show there.  I spent a lot of time to organize photos in the collection in the order that I want to play.  I'm worried that export and import all photos will then have to be organised once more.  Export a collection will keep their sequence, or if not the photos can be tagged with a sequence.  BTW, my slide show has had hundreds of photos.

    As you can imagine, I would be VERY grateful for anyone's help.

    With the active Collection in Lightroom, select all the photos in the grid. On the file menu, choose 'Export in the catalogue' to create a catalog with these images. Check 'Export negative files' and 'include available previews. You can export to an external drive, and you will be able to run this directly from this drive on another machine that involved Lightroom.

  • How replicates all records from one table to another table without using expdp, impdp

    Hi I have two database in a database, that I have a table called t1 and another base data, I have the second table .so, my first table have records, that I need to transfer all records second T2 without use of expdp and impdp in every 5 min... what I do

    ??

    The best solution for this scenario is to use Oracle Golden Gate

    However, it requires a license, and you must pay for it.

    If this is not possible, you can create a job scheduler that uses a link DB in order to reproduce the recordings of the target database, but it will take the entire table to the target database and then INSERT AS SELECT truncate the data of the entire table every time that the job is running (because you can't follow only the records that have been changed or modified).

    In addition, read here on the replication of data using materialized views.

  • Updated all fields from one table to another

    I have two identical paintings; a old and new with the same structure. that the name of the table and the non-primary key data are different. Is there a quick way to update the old table with a new. I am currently using view inline.

    Update (fa1 select a.field1, a.field2 SA2, b.field1 b1, b.field2 from table1 f2 an inner join table2 b on (a.key, b.key =))
    Define fb1 = fa1, fa2 = fb2

    It's boring to write when none of the columns is a lot. It is the same with a merge statement.

    Any other quick method? I can't just let it drop or truncate the old table for lack of RI. Is my oracle 10.2.0.3.0

    Published by: user10256802 on January 14, 2009 07:23

    Published by: user10256802 on January 14, 2009 08:14

    It's boring to write when none of the columns is a lot. It is the same with a merge statement.

    No, you need to specify all the columns that you want the update.

    Otherwise, how do you know Oracle?

  • I want to copy all objects from one user to another. Help, please

    HII Experts... I have a problem here. Please give me solution for this...
    I use the Oracle 11 g on my windows XP system.
    I created a new user named 'a little'

    I want to copy all objects in the user scott in some users... Please help me

    Please explain to me in detail

    Thank you

    Hello

    Alternatively, you can proceed as follows.

    owner of file = exp_scott.dmp system/password@db exp = scott

    IMP system/password@db file = exp_scott.dmp fromuser = scott touser = some

    Concerning

  • We can move customization from one instance to another

    Hello

    As we pass DFFs Menus, functions, from one instance to another.

    Can move personalization in all forms from one instance to another.

    Thank you.

    Yes - pl see MOS Doc 395117.1, the section titled "customizations moving between Instances.

  • How can I move all my files from the user from one user to another on my pc?

    original title: moving files

    How can I move all my files from the user from one user to another on my pc?

    Log an administrator account. Open your folder 'user '. Select all the files, copy them, and paste them into the other folder 'user '.

  • Move a file to the muse from one computer to another that I will lose all related is pdf! How to solve it?

    Move a file to the muse from one computer to another that I will lose all related is pdf! How to solve it?

    Hello.

    Please try following steps to recreate a link to the PDF files.

    1. move and place the PDF file all missing in the any folder to the new computer.

    2 open the Control Panel file Muse and hit open assets of Windows > assets

    3. right click on a missing PDF file and choose repeat the link.

    4. Select the correct file to recreate a link and it will connect all the missing files in the folder.

    Let me know if you were talking about something else.

    Concerning

    Vivek

  • transfer of all, except the os from one computer to another

    want to transfer everything except the os from one computer to another

    Marce,

    I would like to get an external hard drive - the best of Seagate and Western Digital for about $100. I have a 320 GB Seagate and it's much more that I need. Can I save more than one computer at a time. It's basically a huge flash drive, and you can buy them both at the Wal-Mart or Target or Office Max, Office Depot, etc...

    This option is also better in the long run too - for data transfer in addition to save your documents in one place safe.

    If you feel this isn't for you, then you can move gradually using a flash drive (available at Wal-Mart, Target,...) or burn your data on CD and move it over that way.

    I hope this helps.

    -GT

  • Transfer programs and files from one computer to another

    My old computer is an HP ME edition. I transferred programs and files to a HP with Vista Home Premium. Will the old programs and files, my computer run more slowly, and can I remove the old ME programs and files without interfearing with Vista OS?  Thank you

    First of all, you can not transfer programs from one computer to another - well, you can try, but it almost certainly won't work because the programs must be installled to make sure that ALL the files and registry entries are added correctly and created.  Delete, nothing like you have transferred because it will be of no use and just take place.

    As far that range from data, you can transfer data and should not affect the performance of your system (unless you have a LOT of files - and I mean a LOT).  Move them to the appropriate folders in your user profile to make them easier to find (and backup).

    Certainly, you can delete the old program files and data that you have transferred without causing any problem for Vista.  Just be careful that you ONLY delete these files and do not delete Vista files accidentally while you do.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • How to transfer the contents of my Itunes from one PC to another?

    Hello

    I tried several options that I found on the web, but no seem to work and my playlist are all empty?

    I have the usual content in Itunes, music, games, memos, tones...

    I would like to use Itunes as I did on my old computer to my new computer...

    Thank you

    Migrate a library iTunes from one computer to another

    These are two approaches that work normally to move an existing library to a new computer.

    Method 1

    1. Save the library with this trick of the user.
    2. Remove the old computer if you no longer wish to access content protected on it.
    3. Restore the backup to your new computer by using the same tool used to back it up.
    4. Keep your current backup in the future.

    Method 2

    Connect the two computers on the same network. Share your folder from the old computer and copy the file whole iTunes library in the folder on the new. Yet once, remove the old computer so is no longer necessary.

    These two methods should give the new computer, a clone of the library work which was on the former. What about iTunes is it is still the 'home' for your devices library you should not have problems with iTunes will erase and reload.

    I recommend method 1 because it establishes a current backup for your library.

    Note If you have iOS devices and that you have not reached your contacts and calendar all in all items, then you need to create a dummy entry in your new profile and iTunes expected to merge existing data from the device.

    If your media folder has been separated in the main folder of iTunes, you may need to do some preparatory work to make it easier to move. See make a library of portable split.

    If you are in the unfortunate position where you're able to access your original library or a backup and then see recover your iTunes from your iPod or an iOS device to get tips on how to configure your devices with a new library with the maximum preservation of data.

    TT2

  • I can't move files from one folder to another on Windows Vista.

    Hello

    I can't move files from one folder to another in windows Vista.
    It is quite frustrating.
    I am an administrator of the account.
    I get an error saying that I don't have permission to do the action.
    It is said: Destination folder access denied. You need permission to perform this action. Then the buttons 'Try Again' and 'Cancel '.
    Help, please!
    Here is a link to an image of the error I get when I try to move a file:
    Thank you
    Jeremy

    Explorer

    Explorer (explorer.exe) is the program that is the start menu and taskbar, windows folder and the office (which is a folder window).

     

    To see if a fix is available

    In Control Panel (and select Classic discovered in the left pane) select reports on the problems and Solutions (problem of type in the START search box), go to historical problem, right-click of your error and choose check for the Solution.

    You can also right-click and choose Details for more information. Post these details here. The name of the Module fault is important information.

    If the problem affects Panel press the Windows key + R and type wercon (or type it at a command prompt).

     

    Close the browser and start a command prompt

    • Close Windows Explorer
    • Start - All Programs - Accessories - right on command prompt and choose run as administrator.
    • Click Start. Ctrl + Shift + Right-click on an empty spot (just above the power of buttons is one place) then Exit Explorer.
    • Press Ctrl + Alt + Delete then Task Manager.
    • Control all processes to explore are closed. On the process tab select explore and right-click and choose end process, repeat if more of an Explorer in the list.

    Then to restart the Explorer after trying all of the following

    • Press Ctrl + Alt + Delete and choose Task Manager
    • In the Task Manager, click the file menu and then click new task (run) and enter explorer
     

    If you cannot start the Explorer at all

    • Press Ctrl + Alt + Delete and choose Task Manager
    • Under the processes tab, click Show processes from all users to elevate to administrator
    • In the Task Manager, click the file menu and then click new task (run) and type cmd
    • Other things you can try typing

      Explorer
      Explorer c:\
      Explorer/e, c:\
      wercon
      control
      Iexplore
      Rstrui

    If you cannot start a folder window you can use the Browse button in the new task dialog. Don't forget that you must right click and choose Open rather than double-clicking.

     

    Reregister the shell registry entries

    It is important that each order is accepted. If the command fails it means the file is damaged and must be repaired.

    Close the Explorer like above and then type at the command prompt (or copy and paste by clicking in the command prompt window and choose Paste).

    regsvr32 /i shell32
    regsvr32 /i urlmon.dll
    regsvr32 RPCRT4.dll
    regsvr32 PROPSYS.dll
    regsvr32 MSCTF.dll
    regsvr32 cscui.dll
    regsvr32 rsaenh.dll
    regsvr32 timedate.cpl
    regsvr32 ATL DLL
    regsvr32 OLEACC.dll
    regsvr32 actxprxy.dll
    regsvr32 USERENV.dll
    regsvr32 msshsq.dll
    regsvr32 NaturalLanguage6.dll


    regsvr32 thumbcache.dll
    regsvr32 WINTRUST.dll
    regsvr32 MMDevAPI.DLL
    regsvr32 audioses.dll
    regsvr32 audioeng.dll
    regsvr32 ExplorerFrame.dll
    regsvr32 msi.dll
    regsvr32 FirewallAPI.dll
    regsvr32 netshell.dll
    regsvr32 pnidui.dll
    regsvr32 QUtil.dll
    regsvr32 c:\windows\system32\wpdshserviceobj.dll
    regsvr32 WINHTTP.dll
    regsvr32 C:\windows\system32\qagent.dll
    regsvr32 C:\windows\system32\portabledeviceapi.dll
    regsvr32 wbemprox.dll
    regsvr32 wbemsvc.dll
    regsvr32 fastprox.dll
    regsvr32 imapi2.dll
    regsvr32 wshext.dll
    regsvr32 gameux.dll
    regsvr32 msxml6.dll
    regsvr32 vbscript.dll
    regsvr32 jscript.dll
    regsvr32 wshext.dll
    regsvr32 wshom.ocx
    regsvr32 wshcon.dll
    regsvr32 scrrun.dll

     

    Delete the folder and the settings of the Menu

    This will remove the settings are saved for each file that you visit. Also the order of the start menu.

    Close the Explorer like above and then type at the command prompt (or copy and paste by clicking in the command prompt window and choose Paste).

    Reg delete "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell" /f

    Reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams" /f

    Reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2" /f

    Reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder" /f

    Delete the thumbnail and icon Caches

    Close the Explorer like above and then type at the command prompt (or copy and paste by clicking in the command prompt window and choose Paste).

    attrib - r s h '% userprofile%\AppData\Local\*.db '.

    del "% userprofile%\AppData\Local\*.db".

    Disable thumbnails and previews

    Damaged documents and particularly corrupt pictures or videos, can cause Explorer crash all trying to generate a thumbnail or an overview. This miniature and previews active option off.

    If you can start the Explorer, previews is Union on the command - folder and Search Options - framework of tasks use classic Windows foldersbar.

    Thumbnails are organized on the command bar - folder and Search Options - view tab - and check under Advanced settings - always show icons, never thumbnails and uncheck Show icon file in the pictures.

    If you cannot start the Explorer close Explorer as above and then type at the command prompt (or copy and paste by clicking in the command prompt window and choose Paste).

    Tracking Add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" v "IconsOnly" /t Reg_DWord /d 00000001 f

    Tracking Add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" v "ShowPreviewHandlers" /t Reg_DWord /d 00000000 f

    Tracking Add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" v "ShowTypeOverlay" /t Reg_DWord /d 00000000 f

    Turn around after testing the Explorer.

    Tracking Add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" v "IconsOnly" /t Reg_DWord /d 00000000 f

    Tracking Add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" v "ShowPreviewHandlers" /t Reg_DWord /d 00000001 f

    Tracking Add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" v "ShowTypeOverlay" /t Reg_DWord /d 00000001 f

     

    A boot is a way to explore

    It can be caused by a shell extension.

    Explorer (explorer.exe) is the program that is the start menu and taskbar, windows folder and the office (which is a folder window).

    The Explorer is built on addin programs called Extensions of Shell. The standard is provided by Microsoft, but programs add their own.

    • Download Autoruns http://technet.microsoft.com/en-us/sysinternals/bb963902.aspx
    • Close Windows Explorer
    • Start Autoruns by right-clicking and choose run as administrator
    • Click on the menu Options - Filter Options and check hide Microsoft entries and disable include empty locations
    • Go to the Explorer tab and uncheck everything to the left.
    • Click Start. Ctrl + Shift + Right-click on an empty spot (just above the power of buttons is one place) then Exit Explorer.
    • Press Ctrl + Alt + Delete and choose Task Manager.  Control all processes to explore are closed. On the process tab select explore and right-click and choose end process, repeat if more of an Explorer in the list.
    • Click the file menu and then click new task (run) and enter explorer

    If this can help, reactivate ½ at a time to identify those who. If this does not help, restart AutoRuns and go to the all tab and uncheck everything that it and restart. If this can help, reactivate ½ at a time to identify those who.

    Run Microsoft Fixit

    Microsoft has a range of automatic programs to solve common problems. To see problems explore

    http://support.Microsoft.com/mats/windows_file_and_folder_diag/en-us

    For the visit of the list the most comprehensive

    http://support.Microsoft.com/FixIt/en-us

    When you choose to download, choose the option to run on another computer. You can then save it to your hard drive. Open the folder, open the folder fix this laptop and run Run Fix It. It will contain all 27 FixIt.

    Recycle Bin
     
    If the problem is the trash bin remove the storage folders. It will be automatically re-created next time you delete a file or open the Recycle Bin. It will remove the trash and the files it contains for all users.
     
    Close the Explorer like above and then type at the command prompt (or copy and paste by clicking in the command prompt window and choose Paste).
     
    RD C:\$RECYCLE. BIN/s/q
     
    then repeat for each drive to change the drive letter, for example
     
    d:\$recycle Rd. BIN/s/q
     
    e:\$recycle Rd. BIN/s/q
     
     
    If the Office does not start
     
    This will create a new empty by user and common desktop computer. This will allow to test if a file on your desktop to start the Explorer.
     
    Close the Explorer like above and then type at the command prompt (or copy and paste by clicking in the command prompt window and choose Paste).
     
    MD "% userprofile%\DesktopTest".
     
    Add reg "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" / v/t desktop REG_EXPAND_SZ /d "% USERPROFILE%\DesktopTest" /f
     
    MD "% public%\desktopTest".
     
    Tracking Add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" v "Common Desktop" REG_EXPAND_SZ /d "% Public%\DesktopTest" t f
     
    To restore default after having tested if begins to explore.
     
    Set ExpFix1 = % user
     
    Set ExpFix2 = % profile
     
    reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" / v/t desktop REG_EXPAND_SZ /d "% ". ' ExpFix1 ExpFix2%% \Desktop "/f
     
    Set ExpFix1 = % Pub
     
    Set ExpFix2 = % lic

     
    reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Common Desktop" /t REG_EXPAND_SZ /d "% ". ' ExpFix1 ExpFix2%% \Desktop "/f
     
    You will need to disconnect then.
  • Creative suite disk size varies from one computer to another?

    Size of the Creative Suite 6 Master Collection varies widely from one computer to another?

    Between 10.5 and 16.3 GB

    Why?

    They are all professional PC Windows 7.

    I need to save space.

    The Master Collection DVD.

    Or the installation file downloaded

    Download Creative Suite 6 applications

Maybe you are looking for

  • Install Windows 7 on the Satellite M100

    I have the Satellite M100-JG2 (PSMA0C-JG200E). I would like to install Windows 7. The Toshiba does not list the compatible M100. The Microsoft Windows 7 Upgrade Advisor points on certain issues, but I don't know how it's easy to overcome them. I read

  • How can I control a .vi another State machine?

    I've written a VI which is an event focused on the state machine.  Events are operator actions that take place on closing buttons on the front panel.  Each event features one or more state names on the queue of the State.  A state machine then takes

  • User by adding lines to the form if necessary

    Currently, I am working on the development of an effective way for users to enter data in forms of data. We have a data form that removes the missing values.Based on the need the user should enter data into an account that can be deleted. If the acco

  • Tuning sql (where order clauses)

    HelloThis request is really slow, because it calls the function f to each line (table1 and table2 may have more than 10000 lines) SELECT * FROM table1 t1 inner join tabl2 t2.............. WHERE where_clause_1 AND where_clause_2 AND f(t1.a, t2.a) = 'Y

  • Error "the device is not ready" to the Windows command prompt when you access a key USB from VMware

    The host and guest are running Win 7.  Version of VMware is 11.1.3.The guest computer, Windows Explorer displays the USB and I can open its files, etc.However, when I use the Windows command prompt to access the USB of the client, I get error "the de