The or replace clause allows you to replace a user-defined SQLJ function's definitions using create function.
Changes are in bold.
create [or replace] function [owner_name.]sql_function_name ([ sql_parameter_name sql_datatype [(length)| (precision[, scale ])] [[,sql_parameter_name sql_datatype [(length)| (precision[, scale])]] ...]]) returns sql_datatype [(length)| (precision[, scale])] [modifies sql data] [returns null on null input | called on null input] [deterministic | not deterministic] [exportable] language java parameter style java external name 'java_method_name [([java_datatype[, java_datatype ...]])] '
create function sqlj_testfun (p1 int) returns int language java parameter style java external name 'UDFSample.sample(int)'
create or replace function sqlj_testfun (p1 int,p2 int) returns int language java parameter style java external name 'UDFSample.sample2(int,int)'
If the replaced SQLJ function is called by another function, both functions will be recompiled when called.
If the interface of the replaced function does not match that in the calling function, then the calling function must be replaced, otherwise the calling function raises an error. You can execute sp_depends on the replaced function to check for any calling objects.
If a function is referenced in a computed column or functional index, it cannot be replaced.
Any user who impersonates the function owner through an alias or setuser cannot replace the function.
Changes for replacing a function are in bold.
Granular permissions enabled | With granular permissions enabled, you must have the create function privilege. You must have the create any function privilege to run create function for other users. You must be the function owner to replace the function. |
Granular permissions disabled | With granular permissions disabled, you must be the database owner or have the create function privilege. You must be the function owner to replace the function. |
Changes are in bold.
Event | Audit Option | Command or access audited | Information in extrainfo |
---|---|---|---|
97 | create | create function |
|