Find centralized, trusted content and collaborate around the technologies you use most. Connect and share knowledge within a single location that is structured and easy to search. In my opinion you don't need this exception really. It is too much overhead.
Here you are actively ignoring the exception the procedure will return successfully but most of the time if you're doing a SELECT INTO you want it to fail if it doesn't return a row, consider:. Here I want my function to fail if it is called with an empno that doesn't exist in the EMP table. In general, the only exceptions you should catch are the expected exceptions i.
But we still need to answer the question of "why is an exception thrown in the case where a SELECT has no data to be retrieved". I believe this is done because it's a common situation which might otherwise be overlooked.
Writing code as though it always expects to find data is a common thing to do, and if we were supposed to put in error checks such as.
It is not the database's job to decide for you that a missing row is not an error, and just set the value to null. If no row is return then these functions will return a NULL. Should it press on with NULL in the variable? Making it an exception forces you to be explicit about it. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website.
We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies.
If it does not find one, then the error message is thrown to the screen. Jump to: navigation , search. ORA No data found What causes this error? Patrick Wolf Patrick Wolf 1 1 silver badge 3 3 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.
0コメント