Friday, 13 October 2017

How can we drop a function in SQL?

Oracle PL/SQL – DROP FUNCTION Statement


The DROP FUNCTION statement drops a standalone stored function from the database.


DROP function example


Here first we will create function get_current_month. Then we will DROP it using DROP FUNCTION statement.

--Creating function
CREATE OR REPLACE FUNCTION get_current_month
RETURN VARCHAR2 IS
curr_month VARCHAR2(10);
BEGIN
 SELECT to_char(sysdate, 'MONTH') INTO curr_month FROM dual;
 return curr_month;
END get_current_month;
/

FUNCTION GET_CURRENT_MONTH compiled


Now Drop the function.


DROP FUNCTION GET_CURRENT_MONTH;

FUNCTION GET_CURRENT_MONTH dropped.

No comments:

Post a Comment

Popular Posts