Explain what Is The Difference Between Create Or Replace Function And Drop Function Commands?

Category: QuestionsExplain what Is The Difference Between Create Or Replace Function And Drop Function Commands?
Editor">Editor Staff asked 2 years ago

Explain what Is The Difference Between Create Or Replace Function And Drop Function Commands?

2 Answers
Editor">Editor Staff answered 2 years ago

The CREATE OR REPLACE FUNCTION command creates the function if it does not exist and replaces it with the new version if it already exists. The DROP FUNCTION command deletes the function altogether from the database. Any privilege assigned on the function remains the same when the CREATE OR REPLACE FUNCTION command is used; however, in the case of the DROP FUNCTION command, all the privileges are revoked.

Editor">Editor Staff answered 2 years ago

The CREATE OR REPLACE FUNCTION command creates the function if it does not exist and replaces it with the new version if it already exists. The DROP FUNCTION command deletes the function altogether from the database. Any privilege assigned on the function remains the same when the CREATE OR REPLACE FUNCTION command is used; however, in the case of the DROP FUNCTION command, all the privileges are revoked.