Reputation: 19854
As the title says, is it possible to return nothing from a PL/SQL function?
My function is as follows, and I am getting errors when I leave out the return:
create or replace
FUNCTION DeleteAttributes
(code IN varchar2)
CURSOR c_attributes = SELECT ...
BEGIN
FOR attribute_record IN c_attributes
LOOP
...
END LOOP;
END;
Upvotes: 11
Views: 51540
Reputation: 43533
By definition, a function returns a value, so you must have a RETURN statement. Have a look at the syntax definition for a function in the Oracle documentation. RETURN is not an option.
I'm not even sure why you would want to do this.
Upvotes: 4
Reputation: 27496
Oracle PL/SQL functions must have a return. If you declare your subprogram as a procedure, then it won't give you errors when it is lacking a return (procedures can't have a return).
create or replace
PROCEDURE DeleteAttributes
(code IN varchar2)
CURSOR c_attributes = SELECT ...
BEGIN
FOR attribute_record IN c_attributes
LOOP
...
END LOOP;
END;
Upvotes: 19