Pipeline functions - what happens under the hood?  (10g)

Hi all,
What happens when you call a pipelined function? (As opposed to a plain table-valued function.)
From what I understand, a pipelined function will return rows as they are needed. Let's say I have a really silly example of a pipelined function,
CREATE OR REPLACE PACKAGE BODY TEST_PACKAGE_1
AS
    FUNCTION GET_DATA RETURN JUST_A_TABLE PIPELINED
    IS
    BEGIN
        PIPE ROW (JUST_A_TYPE('HELLO'));
        PIPE ROW (JUST_A_TYPE('WORLD'));
        RETURN;
    END;
END TEST_PACKAGE_1;
/Then let's say I were to SELECT * FROM TABLE(TEST_PACKAGE_1.GET_DATA) WHERE ROWNUM = 1, what happens to the second row? Does the code that returns the second row still get educated? (Obviously it's omitted from the query, but does it still get generated somewhere and just go nowhere?)
If I have a cursor on a PL/SQL block that selects from GET_DATA, will each row only be returned as the cursor references it? In that case, what happens to the rows that don't get selected? If there some resource that need to be closed out (say, just before the return statement), would it still be safe to close it out?
Thanks!
Don

Interesting question, lets try a simple test and see we'll just take your example function and toss in a few dbms_output statements like so:
CREATE OR REPLACE PACKAGE BODY TEST_PACKAGE_1
AS
    FUNCTION GET_DATA RETURN JUST_A_TABLE PIPELINED
    IS   
    BEGIN
        dbms_output.put_line('ONE');
        PIPE ROW (JUST_A_TYPE('HELLO'));       
        dbms_output.put_line('TWO');
        PIPE ROW (JUST_A_TYPE('WORLD'));       
        dbms_output.put_line('THREE');
        RETURN;   
    END;
END TEST_PACKAGE_1;Now not forgetting to enable dbms_output call it three times like so:
SELECT * FROM TABLE(TEST_PACKAGE_1.GET_DATA) WHERE ROWNUM = 1;
SELECT * FROM TABLE(TEST_PACKAGE_1.GET_DATA) WHERE ROWNUM <= 2;
SELECT * FROM TABLE(TEST_PACKAGE_1.GET_DATA) WHERE ROWNUM <= 3;What I saw from my test was that with the first call I got 1 row of data from the pipelined function and only the first dbms_output statement was processed. For the second statement I got 2 rows of data from the function and the first two dbms_output statements were processed. For the final call I again got 2 rows of data from the function and all 3 dbms_output statements were processed.
My environment:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
"CORE     10.2.0.1.0     Production"
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

Similar Messages

  • What happens under the EXP

    Hi to all.
    First I wish you happy New Year, and wish you a lot of a health.
    I have a question about exp process. I am wonder what happens when I start export of my database.
    Recently I started an exp on the database over which I performed stress tests (a lot of transaction, insert, update..). A table(T1) in which are enroll are exported until some time, then started export other tables, but the table T1 are continue to enroll.
    What happen in the concurrent inserts and exports of one table?
    Thanks

    Export will dump the data for a single table as of the point in time it starts exporting that table. Other inserts/updates/deletes after the start of the export will not appear in the export file, due to normal read consistency rules.
    If you are exporting multiple tables, they will each be as of the point in time when export starts processing a given table, unless you specify the CONSISTENT=Y option, in which case all tables are exported as they appeared at the start of the export. This is the only way to get a relationally consistent export.

  • What's under the hood ?

    http://www.anandtech.com/IT/showdoc.aspx?i=2745
    With all these threads on heat, whines, mooooos and so on. The solution is AMD. AMD is already 64 bit too on it's consumer products, let alone enterprise products.

    "Right because the consumer world really has a ton of use for 64bit right now (:rolls eyes:)."
    Ummmmmm, OS X is 64 bit today, but you would have no reason to use what the software engineers and programmers have intended and provided you ? Powermac G5's take advantage of 64 bit and perform well beyond it's predecessor.
    http://www.apple.com/powermac/
    Not to mention Windows will be 64 bit as well. But then again, I'm sure you might enjoy throwing $ 3 grand away every 6 months. Look how many are ready and willing to move their 15.4's for the 17 inch in some of these threads and still expect top dollar for the 15.4.
    "We'll see if that's the case when the AMD 64 x2 (dual-core) mobile comes out. For now, that is the case."
    There's no reason to expect that since AMD's design is superior, that anything different would be the case. It's been like this since 2003. This has to be somewhat disturbing for Intel and Apple.
    "It's been a rough road for the Intel Xeon since AMD introduced the Opteron. AMD's market share is climbing, and in a complete role reversal of years gone by, AMD is reported to have 81.5% of the US retail PC market with Intel sitting at 18.5%. In the server space (lower volume, higher profit) AMD is now sitting at over 14%, up 5% from 2004."

  • What does the open file dialog do 'under the hood' and is there a way to simulate it

    What does the open file dialog do 'under the hood' and is there a way to simulate it?
    I have a bug in my code (that I've posted about before, here) which I can't fix at the moment, but I do have a workaround.
    Briefly, the bug:
    I call a dll from a function node, to initialise and run a spectrometer. If I start up the PC, LabVIEW and run my vi the code runs without complaint, the first call to the dll to initialise the spectrometer doesn;t return an error but the spectrometer is not detected either.
    I've tried various solutions, see the link above, and none work
    The workaround:
    If, at any time before running the code containing the function node I open an 'open file' dialog window, select the dll and click ok/hit enter then everything is fine. When I run the main code the spectrometer is detected.
    I use an express vi to open the file dialog, I specify the start path and file name as constant inputs and just click ok/hit return when the dialog pops up. I don't do anything with the dialog outputs. In fact the vi that contains the open file dialog can be run before the project containing the bug is even open.
    I have to do this everytime I turn the PC on.
    So, either
    1) Can somewone suggest a fix for the original bug?
    2) What is the easiest way to simulate the enter keypress when the open file dialog pops up
    or
    3) Can someone tell me what the open file dialog does under the hood that somehow causes the dll to work and can it be simulated in straight LabVIEW
    I suspect that the dll itself is dodgy ( I have in the past talked to the supplier but not got very far, and I will try again but I would like a quick, temporary solution too). I'm guessing that the file dialog is making some kind of check on the file, and possibly registering its presence with the OS (winXP). I tried using the file/folder exists vi to see if checking the file like that worked but no luck.
    Any help greatly appreciated.
    Dave

    Hi David
    I am very conscious about thread hijacking but this sounded like my issue so I hope you dont mind me asking about your issue. I am hoping that you have a spectrometer from the same vendor as me and its not just me seeing an Error 1097 issue. My spectrometer is from a company called Stellarnet.
    So far I have unable to get it to work with other VIs. There is one condition where I can get it to work but its no good for me.
    Case 1
    I open the VI in a fresh labview environment with no other VIs in memory. The code runs with no issue.
    Case 2
    Labview is not opened. I double click the spectrometer VI in windows explorer.  The VI opens but it fails to run resulting in Error 1097. Personally, I dont see the difference between this and Case 1 above and yet it fails.
    Case 3
    If I already have other VI's in memory and try to load the spectrometer VI and run it fails with Error 1097. This case is the one that most important to me. I have a test executive that will load test VIs dynamically and I can't get this to work. Same problem Error 1097.
    I wanted to share what I have seen with you and to let you know that maybe somebody else has the same issue. I am convinced its the DLL but the vendor dis-agreed saying it was LabVIEW. I couldn't convince him otherwise.
    Thanks in advance
    David

  • What happened to the " street view " function in the maps app in iOS6?

    What happened to the "street view" function in the maps app of iOS6?

    Gary ~ It's now available via a browser:
    Street View for Google Maps web app goes live

  • What happened to the browse function in the iTunes store?

    What happened to the browse function in the iTunes store?

    What do you mean what happened to it ? If you are having problems with the store then what are they ?

  • I'm using the great Firefox 5.o. What happened to the "Bookmark All Tabs" feature that used to be found under Bookmarks? I love Mozilla Firefox!!!! :-)

    I've looked under the Bookmarks heading as well as History. What happened to the extremely useful "Bookmark All Tabs". Loved that feature of Firefox. Thank you!!!!!!

    Right-click '''on''' a Tab to see that menu item or use {Ctrl + Shft + D}.
    In conjunction with the new Firefox button in Firefox 4.0 and with the addition of some new features that added a number of new menu items, many of the older menu items were moved around or only appear under certain conditions. It can be a bit confusing until you get used to the changes, but beyond adding new menu items in the future for new features, I don't think there will be major changes like that for awhile.

  • What happened to the "oldies" option on the drop down menu located on iTunes home page under music ?

    What happened to the "Oldies" option on the drop down menu located on iTunes store home page under music ? I can not find songs in search using artist or song name.
    Thank you,   Martin

    Right click on the file and choose Get Info, go to the Options tab, there's a menu there "Media Kind"

  • What happened to the soft proof function for printing???

    What happened to the soft proof function for printing???

    Edward Sozinho wrote:
    Thanks Jim.  It's no longer located there.  I miss spoke I'm running Lightroom CC now.
    Then you must not be seeing the toolbar. Press the letter T to display the toolbar. I'm using Lightroom CC.

  • HT1947 What happened to the keyboard search function on the remote app?

    What happened to the keyboard search function on the remote app? Was the only thing that really made it useful.

    I am having the same issue. I can see a dimmed keyboard icon on the top right of screen, but cannot access the keyboard to enter information for Apple TV 2. Is anyone else having the same issue and are there any solutions to fix the problem?

  • What happened to the Podcast fast forward 15 sec function in the lock screen? It went away when I upgraded to iOS 7.1.

    What happened to the Podcast fast forward 15 sec function in the lock screen? It went away when I upgraded to iOS 7.1.

    I thought the same thing, until I saw there is a podcast update as well in the app store, that fixes this.

  • What happened to the Initial View options under Document Properties??

    What happened to the Initial View options under Document Properties? I just updated my Reader and it's no longer accessible! SOS.

    Hi kga406,
    Please tell me if you are able to access 'initial view' tab in document properties using Acrobat.
    You can change initial view settings only in Acrobat and can view PDFs in Reader with the same initial view as set.
    Regards,
    Anubha

  • What happened to the Blu-Ray option under the Share menu in FCPX 10.0.6?

    what happened to the Blu-Ray option under the Share menu in FCPX 10.0.6? The Share menu is now buriedn on the Fil menu and there's no Blu-Ray option for burning AVCHD to a Standard DVD for play on a Blu-Ray player.

    Select Add Destination. Blu-ray is in the Destinations preferences.

  • What happened to the search function on ipads?

    what happened to the search function on ipads?

    Ok, I agree it USED TO WORK that way, swiping down from the center. Now swiping down from the center with the newest CRAP iOS 7.0.4, all that happens is the notifications tab pulls down.
    I can see all the options for Spotlight Search in the General Setup, and have all of the search options enabled, but the old way (2 weeks ago) of getting the search pane DOESN'T WORK ANYMORE.
    Anyone have a clue where it went, or how to get it back, or enable it, or anything?  SIRI is clueless too. I say "Open Spotlight Search". She says "You don't seem to have an app named Spotlight Search"
    I can tell SIRI to open one of my 150+ apps WHEN ONLINE, but if I'm flying or out of wi-fi, and want to search my iPad, I need the spotlight search pane!!!

  • Looking under the hood

    my sysadmin geeks here want to know what happens when a swf
    runs the
    getURL() method so i'm trying - unsuccessfully thus far, sad
    to relate -
    to find a site looks "under the hood" of AS a bit and
    explains its
    workings at a deeper lever.
    can anyone point me to any such thing please?

    This may be what he wants to see - and it's an invaluable
    debugging tool:
    http://www.kevinlangdon.com/serviceCapture/
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

Maybe you are looking for

  • IWeb with Google Analytics

    I spent all morning setting up Google Analytics. Looked at dozens of posts here with loads of misinformation. iWeb 09 does work with Google Analytics. Here's what worked for me. They key was to make sure my URL ended with a /. That is, it didn't work

  • Traffic light on the basis of last month

    Hi guys, I have a question about the traffic light in the model Visual Composer. I would like to have a traffic light besids a table or graphic that wil be shown the status ( Green, red, yellow!) on the basis of the last month. In the table or in a g

  • Submit by Email as PDF attachment instead of XML

    We created a form in Adobe LiveCycle Designer and added a "Submit by Email" button. When the user selects the button, an email message starts but the attachment is an XML extension. How can we change that so when the button is selected, the attachmen

  • Keep directory structure for extra files after installation

    I'm working on an AIR project in Flash CS5 that has some additional support files in a folder called "data".  In my publish setting, I included this folder.  When I run a test install of the AIR file, I no longer have a "data" folder in my installati

  • When highlighting and rightclicking a link to open in a new tab, it doesnt open anything. (after latest update)

    ever since the latest update the other day (9.0.1), whenever i highlight a link and right click for options to open link in a new tab i get no response. not sure if this is actually a question. is this a bug? not sure where to look for a fix if there