Function return value. Whereas Procedure does not return value. |
You can call function in SQL query. If function has DML (insert,update,delete) statements you can not call that function from SQL query. You cannot call a procedure in SQL query. |
CREATE OR REPLACE FUNCTION function_name (argument IN | OUT | IN OUT data_type) RETURN data_type IS BEGIN SQL statement1 statement2 RETURN value; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line(‘ERROR - ’||SQLERRM); END; |
CREATE OR REPLACE PROCEDURE procedure_name (argument IN | OUT | IN OUT data_type) IS BEGIN SQL statement1 statement2 EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line(‘ERROR - ’||SQLERRM); END; |
Difference between procedure and function
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment