![]() ![]() The clean up code would execute and do the right thing if you exit the loop - but not so if you just stopped calling this function. An exception that can be caught, but if it isn't - everything is still OK. An exception that is raised - but does not cause failure. In other words - one of those strange non-reproducible bugs that only happens when it rains on a Tuesday after midnight but before 8am.Įnter NO_DATA_NEEDED - an exception that doesn't behave like any other exception. So, you would have an error that would "sometimes happen" and "sometimes not happen". In all likelihood - if there was one or more records - you would leave a file handle open - and if you called this function over and over, you would leak an open file each time and eventually run out of file handles. What happens - what happens if there was zero records in /tmp/foo.dat to read? one record? More than one record? Select * from table(pipelined_function( '/tmp/foo.dat' )) where rownum = 1 However, if you call it from a query such as: It works perfectly - if you read all records from the file. What if you have a pipelined function that does something like:Ĭ) when no more data, close file and return But it is something we've needed, probably knew we needed, just never thought about it. Don't google for it - you won't find much about it yet. Don't go searching for it in the documentation (it will be there in the next dot release - but it isn't there yet), you won't find it. If you ever write a pipelined function - there is a good chance you need to be aware of it. But in looking a little deeper, I discovered what it was. At first I thought that is was a typo – they really meant NO_DATA_FOUND – since I hadn’t heard of or read about that exception. ![]() Recently on, I was asked a question about the pre-defined exception NO_DATA_NEEDED. I'll be writing about this in Oracle Magazine shortly as part of the asktom column - but thought I'd mention it here too. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |