S
Swetha Shetty

Posted on 20th April 2024|48 views

0
votes

Postgresql Drop Function

What is Drop function in PostgreSQL?

Answers
P
sri kanth

Posted on 20th April 2024

  • Sometimes when you define a user-defined function or any function which is no more required than we use this drop function to drop the redundant functions from the library.
  • Once you drop a function, then it cannot be retained. It should be recreated again in PostgreSQL DBMS.

 

Syntax:

Drop Function function_name;

 

 function_name =function the user wishes to drop.

 

For example:

DROP FUNCTION power(integer, integer);               #removes the power function

DROP FUNCTION my_details;                      #removes functions without arguments also

 

  • For example: let us assume that we create a function: 

CREATE FUNCTION add(number,number);

Now, after using that function when you wish to drop that function, we use the command. 

DROP FUNCTION add(number,number);

 

  • Cascade:

This function will drop objects that depend on that function.

  • Restrict:

 This function is by default. It refuses the function to drop any objects that depend on that function.

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos