NOCOPY and Collection

Hi - I would like to create a package that stores collections with nested tables, functions (or procedures) should provide access to the nested tables.

I met some performance issues and came to the conclusion that memory structures (collections / nested tables) are passed by value (so over and over again copied) rather than spend them.

So I tried whether it is simply possible to transmit a collection via reference instead of create new duplicate memory - this is what I tried:

declare

type t is rendered

(

x number,

y varchar2 (100)

);

type t_tab is table of t;

type tt_tab is table of index t_tab by varchar2 (100);

TT tt_tab;

t_elem t;

t_tab_elem t_tab;

number of N_X;

procedure ttttx (v_index_in in varchar2, n_index_in in number, some t_ret_inout number nocopy) is

Start

t_ret_inout: = tt (v_index_in) (n_index_in) .x;

end;

tttt procedure (v_index_in in varchar2, n_index_in in numbers, t_ret_inout out nocopy t) is

Start

t_ret_inout: = tt (v_index_in) (n_index_in);

end;

ttt procedure (v_index_in in varchar2, t_ret_inout in out nocopy t_tab) is

Start

t_ret_inout: = tt (v_index_in);

end;

Start

TT ('A'): = new t_tab();

TT('A').extend (1);

TT ('A') (1) .x: = 1;

TT ('A') (1) there: = 'asdf ';

TTT ('A', t_tab_elem);

t_tab_elem (1) .x: = 99;

dbms_output.put_line (t_tab_elem (1) .x);

dbms_output.put_line (TT ('A') (1) .x);

THOMAS ('A', 1, t_elem);

t_elem.x: = 100;

dbms_output.put_line (t_elem.x);

dbms_output.put_line (TT ('A') (1) .x);

ttttx ('A', 1, n_x);

N_X: = 101;

dbms_output.put_line (N_X);

dbms_output.put_line (TT ('A') (1) .x);

end;

And unfortunately the result is

99

1

100

1

101

1

... so there is not a single reference, of course, these are all copies - I forgot something?

Thanks in advance

Best regards

Werner

Hi - I would like to create a package that stores collections with nested tables, functions (or procedures) should provide access to the nested tables.

Why? What PROBLEM are you trying to solve?

I met some performance issues and came to the conclusion that memory structures (collections / nested tables) are passed by value (so over and over again copied) rather than spend them.

Yes, they are - which is described in the section of the PL/SQL language about the NOCOPY hint doc:

Setting up of the PL/SQL Applications for performance

By default, OUT and IN OUT parameters are passed by value. The values of a IN OUT settings are copied before the delivery of the subprogramme.

During the execution of the subprogramme, temporary variables to maintain the output parameter values. If the subprogram exits normally, these values are copied to the actual parameters. If the subprogram exits with an unhandled exception, the original settings are unchanged.

When the parameters represent structures of large data such as collections, records and instances of object types, this reproduction slows down execution and uses memory. In particular, this overload applies to each call to a method of the object: temporary copies are made of all attributes, so that any changes made by the method are only apply if the method ends normally.

To avoid this overload, you can specify the NOCOPY trick, which allows the PL/SQL compiler to pass OUT and IN OUT parameters by reference. If the subprogram exits normally, the action is the same as usual. If the subprogramme leaves at the beginning with an exception, the values of OUT and IN OUT parameters (or the attributes of the object) can still change. To use this technique, check that the subroutine handles all exceptions.

The following example requires the compiler to pass IN OUT parameter v_staff by reference to avoid copying the input and output of the subprogramme varray:

Here is an example this quote.

The code you have posted works as expected:

TTT ('A', t_tab_elem);

t_tab_elem (1) .x: = 99;

dbms_output.put_line (t_tab_elem (1) .x);

dbms_output.put_line (TT ('A') (1) .x);

This first line calls the "ttt" procedure that uses only the OUTPUT parameters. Pass you a unitialized collection. This procedure done so that

t_ret_inout: = tt (v_index_in);

This line COPIES the element of the colllection 'tt' to the collection "t_ret_inout". Oracle doesn't use pointers and the "tt" reference is NOT that a parameter so don't have nothing to do with NOCOPY.

Then, you set 99 in the new collection that was returned.

Then you print the 99 of the new collection, and you print the "1" in the collection.

What else do you expect? You have two different collections.

The NOCOPY indicator prevents Oracle copy collections that are passed, be referred by, procedures or functions. As I've just shown the use of 'tt' by the "ttt" procedure is NOT being passed to, be referred by, the procedure.

Tags: Database

Similar Questions

  • Scan and collect several pages to a document with hp8630

    How can I scan, gather and save a document multiple pages in a single pdf document using a HP8630? Thank you.

    Hi @CoachPop,

    I understand you want to know how to scan and collect several documents into one file. I'd love to help you.

    If you use Windows, try the following steps:

    The HP scanning software, select Advanced settings, click the file tab, and then uncheck the box create a separate file for each scanned image, which allows several scans of page save to a file.

    If you are using a Mac, try the following:

    The software overview, once you have the scanned image, select PDF and check combine in one document below.

    In the printing and scanning window, select PDF and check combine in one document below.

    What operating system do you use?

    How to find the Windows Edition and the Version on your computer.

    Mac OS X: how to find which Mac OS X Version is on my computer?

    If you appreciate my efforts, please click on the "Thumbs up" button below. Thank you.

  • Two computers OK, but where are the catalogs and collections?

    I guess I missed something here, but I'm new on this.

    I have an iMac desktop and a Windows 10 laptop. CC of Lightroom installed on both and both work well.

    But I don't think I understand this cloud thing. I assumed that I could create a catalog, collections slideshows etc. on my iMac. Then I could sign and go out with my Windows laptop. Then I

    could sign in Lightroom CC on my laptop and BOOM, there is all the stuff that I created on my iMac on my laptop via the cloud.

    I assumed that all the work that I do was preserved in a cloud of Lightroom, but I now think that I'm wrong. Am I?

    If so, how can I do things on my iMac, and then synchronize with my laptop Windows 10?

    Thank you.

    I assumed that all the work that I do was preserved in a cloud of Lightroom, but I now think that I'm wrong. Am I?

    Your work is usually saved on your local hard drive, unless you use the sync to work with Lightroom Mobile features.

    How do I synchronize Lightroom desktop and mobile application of Lightroom

    The part of the cloud of the cloud makes Adobe refers to the granting of licences where license controls are managed remotely by license Adobe Cloud servers.

    Software installs and runs locally. Œuvre produced by the software is saved locally, unless you choose to use Adobe Cloud storage or use the Lightroom Publishing Services.

    Lightroom catalogs and collections are stored locally.

    synchronization problems between 2 desktops

    Post in the Lightroom forum if you have any other questions.

  • My Lightroom has lost the connection to most of my photos, records and collections. They are still on the computer. It happened, while moving my laptop when it was running. The mouse is moved and it might have changed the configuration. How can I do my wo

    My Lightroom has lost the connection to most of my photos, records and collections. They are still on the computer. It happened, while moving my laptop when it was running. The mouse is moved and it might have changed the configuration. How can I make my Lightroom works properly again?

    I use Lightroom 6.4 on a Pc with Windows 10.

    Has disappeared? Try file-> open the new item, and then select each illustrated catalog until you find the catalog with your photos.

    If this does not work, please post a screenshot of the problem.

  • have 5 LR and CC. The folders are different, some are missing in the CC. And some complete are not available in CC. I'm looking forward to use CC rather than LR5 so how can I make the folders and collections even on each?

    have 5 LR and CC. The folders are different, some are missing in the CC. And some Collections are not available in CC. I'm looking forward to use CC rather than LR5 so how can I make the folders and collections even on each?

    Hi cjohnm,

    You can use the 5 Lightroom Catalog and improve it in Lightroom 6, therefor all folders and collections will be identical in both version.

    Open the Lightroom all holding the key Alt/Opt and select only the 5 Lightroom Catalog and it will switch to it.

    Let us know if that helps.

    Kind regards

    Mohit

  • Sorting images in folders and collections

    Is there a way I can set a default sort for all images in folders and collections? I have several folders and collections who have become sorted differently from overtime, and I want to give them to all the sort exactly the same way, from time to time.

    You're out of luck. The adjustment type is saved with each file. Unfortunately, you must change manually for each individual file.

  • Can I export and collect all the image files in my Muse site?

    Can I export and collect all the image files in my Muse site?

    Hello Peter,.

    Please go to file > export to HTML format and export your site in a folder you want.

    In the same folder, you will be able to see a folder named "Images" that will contain all the images used in the site.

    Kind regards

    Vivek

  • Extractor of POF and Collections, official support?

    Hello

    I like a few others want to use POF extractors to search through collections of objects under.

    JK wrote a great post from back in 2010 (coherence 3.5) (POF extractor and Collections (see again my code) )

    Two years have passed and we are now on the 3.7 consistency. I can't find any official documentation 3.7 on this feature. Can anyone confirm if there is an official way of filtering under collections of objects? Or it's code snip - it still the best way to achieve JK?

    Thank you
    Rich

    Hello

    We just had to implement this in my current project and we to 3.7. We build quite a complex query API on top of our caches and necessary to query collections etc. As far as we can see nothing really changed with built in extractors of POF for awhile.

    JK

  • Click and collect

    I am loooking for click and collect in store option. Payment can be also well pay online or in-store at the time collection

    Hello mankam45,

    If you add Payment Options; as well as credit card processing, your order form you can give the user the ability to use a credit card now or COD.

    When we have done this before that we would mask the transformation of credit card if they click on COD, or show if they click on credit card.

    Hope this helps,

    Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7

  • Catalogs and Collections

    Windows 7 and CS4 Production Premium, LR3, and Acrobat X I just got LR3.3 then this application is new to me. I currently use a non Adobe application for my image database management. My images are primarily associated with the work of genealogy saved as TIFF uncompressed. Right now I have 5716 files in 68 cases. It is organized as follows: the highest level is by family name (6 files). Each of these folders contain 9 other subfolders that represents the content of the image; for example, people, brothers and sisters, family, etc. Among the higher level folders is used to contain images that have many of the family name in the image. In addition to these genealogy records, there are other folders that contain pictures sorted according to certain characteristics, such as travel, scenic, trains, planes, etc. Using the current terms of the request, I maintain a catalog for each subfolder. This is a thumbnail of each image in this folder with the name and the description of IPTC caption 'title '. I make extensive use of IPTC metadata for each image: title, Description, title, keywords, and Instructions. I want to understand the LR3 catalogs and collections, and collections smart before you begin the transition to LR3. Q1: whenever I add a new image to my hard file storage folder, I have to add it manually to the LR catalog? With my current application, when a folder is selected in this application, it searches the folder changes and the new thumbnails are generated for new files. Q2: A smart collection seems built by keywords in the catalog in LR3 and the non-smart collection must be created manually from the LR3 catalog... Fix? Q3: When I create a collection of "key words" can parts of filename structure be included (not placed in metadata keyword) in building criteria? Q4: Thought to use a catalog in LR3 for my genealogy pictures and one for my non-genealogie images. Then use collections (chip or non-smart to determine) for each of my subfolders. His reasonable? Q5: Can I do a search on the catalog via keywords without a defined collection name? It would be a temporary Assembly of images only. Q6: Can I print the catalog, either a collection with the file name and IPTC (e.g., Headline) data under each thumbnail?

    What I wanted was to avoid a two-step process: place the image of the 'original' in a folder from the hard drive, then import in the catalog. I will maintain the architecture of the hard drive for several reason folder

    Well, this is not automatic, but after you put new images in your folder, when you launch lightroom, right - click the folder and "synchronize the folder.  He will review the matter and propose to add anything, there.   So at least you don't have to remember what are the images to add or not; a bit easier than to try to use the import dialog box.

    See you soon!

  • With the help of interpreters and collect with sys datatype in custom folder

    I use the casting and collect functions and the datatype sys.odcivarchar2list sys in a custom in the discoverer admin folder.
    Select
    ...
    ,cast(collect(ppe) as sys.odcivarchar2list) AS "PPE"
    ...
    The SQL is valid, but the new item of PPE is not added to the list of available items in the folder. Is it because the discoverer does not recognize the data type? Is there a solution?

    The goal is to get a list of categories appear in a single column in the form of values separated by commas

    Of
    part ppe
    A1    hat
    A1    gloves
    A1    glasses
    TO
    part  ppe
    A1    hat,gloves,glasses
    I use the cast, to collect and datatype in Toad (RDBMS: 10.2.0.3.0) and SQL * Plus (version 10.1.0.4.2) but not in Discoverer Admin (10.1.2.48.18)

    -Tracy

    Hello

    Discoverer will not be able to cope with the odcivarchar2list data type. You will need to use a PL/SQL function or a group by to generate a list separated by commas in a VARCHAR2 column.

    Rod West

  • Smart Collections using 'Source' and 'Collection '.

    I'm a little confused about this subject.  I want to create a smart collection within a set of sets in the collection.

    Example:

    The TRIPS agreement is a set of collection

    Under the TRIPS Agreement, you have RV

    Under the RV, you have "ButterField Ranch may 2016.

    Under "ButterField Ranch 2016 may" you "All".

    Then under "ButterField Ranch 2016 may" want to create a smart collection that includes only the "color of the label" green collection "All".

    The question is, how - you reference the 'all' within all the other collections without getting all other collections 'All' somewhere else.

    What the question is: How do bosses really work for 'Source'-> 'Collection '.

    The question is, how - you reference the 'all' within all the other collections without getting all other collections 'All' somewhere else.

    You can not.  Smart collection criteria allow you to match the names of the folders, collections, published reports and publish the service (for example, "Flickr").  There's no way to match the name of a collection defined in smart collections (or filters, incidentally).   Others have asked for this feature - please add your vote and detailed opinion, why you want this feature request service in the official Adobe feedback forum: Lightroom: Smart collections lack of criterion for "Collection Set | Community customer Photoshop family .

    To match the names of the sets in the collection, you can use the plugin to any filter.

  • Catalogs and Collections?  Which is the correct way / better to organize a large library of images?

    Hi all

    I decided to spend time in organizing and creating a backup decent system for my personal iibrary of images which is about 500Gig.

    I used CaptureOne for years, but to do research the best software to use for this purpose, decided to jump in the use of Lightroom.

    I am now reasonably confident with the basics of importing and creating catalogs / folders / Collections etc., but there seems to be a slight fracture on how people break there images using these tools.

    Some people recommend that this is done by creating multiple catalogs is to say every year or even by use / event because it prevents LR latecomers under duress of a large portfolio.   Others say to keep catalogs to an absolute minimum and sort all Collections projects instead.

    I am sure that there is no absolute right and wrong and a lot is probably down to personal preferences, but can I ask the community if you would mind throwing some advantages and disadvantages of each method please?

    Many thanks for any help

    John was soon

    Some people recommend that this is done by creating multiple catalogs is to say every year or even by employment

    It is a horrible idea which defeats the entire purpose of the Lightroom library Module. Any who recommend what needs to explain how it is preferable, because it isn't better somehow, in my opinion.

    If you have multiple catalogs, you can not search for your set of photos. You find not all photos with particular metadata, you can find the photos with this metadata in a catalog.

    because this would prevent late LR under the constraint of a major portfolio

    A problem that does not exist. People in this area and other forums report catalogs more 500 000 pictures works well.

    Others say to keep catalogs to an absolute minimum and sort all Collections projects instead.

    Most people I know (including most of the people in this forum I've read) say to keep everything in a single catalog. Use keywords and other metadata, no collections, as your tool main body. Smart Collections are used as a mechanism of research (not a mechanism of "spell"). Regular collections are used to group the pictures together for a specific task, such as the creation of a book, slideshow, web page, etc. (again not a mechanism of "spell".

  • Lightroom for iPad missing photos and collections

    In Lightroom for iPad my collections and photos are missing. I show 23 listed photos and 24 of the 27 GB used. I tried logging out and back in nothing works. In the idea of what may be the problem?

    Hi Brianm,

    Could you please let me know the version of Lightroom installed on the computer?

    Also how many files have synchronize you from desktop to Mobile Lightroom?

    Kind regards

    Tanuj

  • New - edit metadata for many articles and collections

    Hello

    Well, I would like to suggest a feature of dashboard... The options for changing the metadata when several article and/or collection are available select.

    I need apply to the same category to several articles and then I had to change it once each.

    Concerning

    Hi Felipe,.

    I want too, it's on our list of future features!

    Neil

Maybe you are looking for