If I have a PL SQL procedure like this:
Create Or Replace Procedure get_age (first_name varchar(40), last_name varchar(50))
Begin
Select age
From Person
Where first = first_name AND last = last_name;
End;
It is not guaranteed that the user will pass in a value for the first_name and last_name variable.
How do I account for this in the Procedure above since I do not want the first_name or last_name in the Where clause of my query if either one of those variables do not have a value.
selectin a procedure would have to have anintoor it has to be used to open a cursor. If you are just retrieving a value, you'd want a function not a procedure. If either parameter is optional, you could get multiple rows so what would you want to happen?