Skip to content
Advertisement

PL/SQL No data found even there should be?

I’m currently learning PL/SQL atm and I have run into an issue with one of my homework questions.

In the below code, I’m getting user input for a province and isolating select results using said province in the declaration of the cursor and trying to run the visitsandtotal procedure but all I’m getting is no data found, why?

user prompt

Procedure

Error

Advertisement

Answer

I cannot comment due to less number of reputation.

NO_DATA_FOUND error comes from the procedure where you have where clause and group by..

and if no records with parameter “userinput” leads to the exception.

I would suggest to change the procedure as we certainly don’t need the group by custname as the custname is part of where clause;

But for whatever reason if you insists to keep the group by clause, you have to handle NO_DATA_FOUND exception explicitly in the procedure visitsandtotal

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement