This procedure creates a PL/SQL wrapper for adding new functions to the catalog and removing wrappers for functions that have been deleted from the catalog.
CREATE_CATALOG Procedure This procedure creates a catalog in the database. The DBMS_CLOUD_FUNCTION.CREATE_CATALOG procedure creates a catalog. A catalog is a set of functions that creates the required infrastructure to execute subroutines. This procedure is overloaded.
CREATE_FUNCTION Procedure This procedure creates functions in a catalog. There are two overloaded DBMS_CLOUD_FUNCTION.CREATE_FUNCTION procedures.
DROP_CATALOG Procedure The DBMS_CLOUD_FUNCTION.DROP_CATALOG procedure drops the catalog and functions created using the catalog. This procedure is overloaded.
DROP_FUNCTION Procedure The DBMS_CLOUD_FUNCTION.DROP_FUNCTION procedure drops the function. This procedure is overloaded.
SYNC_FUNCTIONS Procedure This procedure creates a PL/SQL wrapper for adding new functions to the catalog and removing wrappers for functions that have been deleted from the catalog.
This procedure creates a catalog in the database. The DBMS_CLOUD_FUNCTION.CREATE_CATALOG procedure creates a catalog. A catalog is a set of functions that creates the required infrastructure to execute subroutines. This procedure is overloaded.
Syntax
DBMS_CLOUD_FUNCTION.CREATE_CATALOG (
credential_name IN VARCHAR2,
catalog_name IN VARCHAR2,
service_provider IN VARCHAR2,
cloud_params IN CLOB
);
DBMS_CLOUD_FUNCTION.CREATE_CATALOG (
library_name IN VARCHAR2,
library_listener_url IN VARCHAR2,
library_wallet_dir_name IN VARCHAR2,
library_ssl_server_cert_dn IN VARCHAR2,
library_remote_path IN VARCHAR2
);
Parameters
Parameter
Description
credential_name
Specifies the name of the credential for authentication.
This parameter is mandatory.
service_provider
Specifies the type of the service provider.
This parameter can have OCI or AWS or AZURE or GCP as a parameter value.
This parameter is mandatory.
catalog_name
Specifies the catalog name.
This parameter is mandatory.
cloud_params
Provides parameter to the function. For example, Compartment OCID, Regions and Azure subscription_id.
This parameter is mandatory.
library_name
Specifies the name of the library when creating a remote library.
This parameter is mandatory.
library_listener_url
Specifies the remote location of the library.
The parameter accepts a String value in host_name:port_number format.
For example: EHRPMZ_DBDOMAIN.adb-us-phoenix1.com:16000
This parameter is mandatory.
library_remote_path
Specifies the remote library path.
You must provide the full absolute path to the remote library.
For example:/u01/app/oracle/product/21.0.0.0/client_1/lib/libst_shape.so
This parameter is mandatory.
library_wallet_dir_name
Specifies the directory where the self-signed wallet is stored.
This parameter is mandatory.
library_ssl_server_cert_dn
Specifies the server certificate Distinguished Name (DN).
This parameter is mandatory.
Errors
Error Code
Description
ORA-20000
This error is raised in either of the following conditions:
cloud_params value is missing or incorrect parameter values are passed.
library_name value is not unique when creating a library.
ORA-20001
This error is raised in either of the following conditions:
The credential referenced in the credential_name does not exist.
The Listener specified at the library_listener_url is not reachable when creating a library.
ORA-20002
This error is raised in either of the following conditions:
This error is raised when the catalog already exists.
The specified Server certificate directory is empty when creating a library.
ORA-20009
This error is raised when the service provider doesn't exist.
This procedure creates functions in a catalog. There are two overloaded DBMS_CLOUD_FUNCTION.CREATE_FUNCTION procedures.
CREATE_FUNCTION Syntax
The DBMS_CLOUD_FUNCTION.CREATE_FUNCTION procedure is only supported for cloud functions.
DBMS_CLOUD_FUNCTION.CREATE_FUNCTION (
credential_name IN VARCHAR2,
catalog_name IN VARCHAR2,
function_name IN VARCHAR2,
function_id IN VARCHAR2,
input_args IN CLOB DEFAULT NULL,
return_type IN VARCHAR2 DEFAULT 'CLOB',
response_handler IN VARCHAR2 DEFAULT NULL
);
Response Handler signature
<USER DEFINED TYPE> response_handler_name(function_response in CLOB)RETURNS CLOB;
The return type of this is user defined type or PL/SQL type. The function_response is of JSON with fields.
DBMS_CLOUD_FUNCTION.CREATE_FUNCTION (
library_name IN VARCHAR2,
function_name IN VARCHAR2,
function_id IN VARCHAR2 DEFAULT NULL,
plsql_params IN CLOB DEFAULT NULL,
external_params IN CLOB DEFAULT NULL,
api_type IN VARCHAR2 DEFAULT 'FUNCTION',
with_context IN BOOLEAN DEFAULT FALSE,
return_type IN VARCHAR2 DEFAULT NULL
);
CREATE_FUNCTION Parameters
Parameter
Description
library_name
Specifies the remote library name.
This parameter is mandatory.
function_name
Specifies the PL/SQL function name.
This parameter is mandatory.
function_id
The function_id parameter value
refers to the external procedures
(extproc).
If the value for function_id is not
provided, the value in the function_name is
used.
plsql_params
Specifies the key value JSON pair accepting the
parameters for the PL/SQL wrapper.
The values must be provided in the
"var_name":"modetype, datatype" format.
var_name : is the name of
the variable. This parameter is mandatory.
modetype : specifies the
variable mode. The variable mode can be one of the
following:
IN
OUT
IN OUT
datatype : specifies the
variable datatype. This parameter is mandatory.
The default value for plsql_params is NULL.
external_params
Specifies the parameters that need to be provided to
the external C function.
If value is not provided for
external_params, the PL/SQL parameters are
used.
api_type
Specifies the type of API (function or
procedure).
The default value for api_type is function.
with_context
Specifies that a context pointer is passed to the
external procedure. This context is used by the external C
library for connecting back to the database.
The default value for with_context is FALSE.
return_type
Specifies the return type of the function
created.
The DBMS_CLOUD_FUNCTION.DROP_FUNCTION procedure drops the function. This procedure is overloaded.
Syntax
The DBMS_CLOUD_FUNCTION.DROP_FUNCTION procedure is only supported for cloud functions.
DBMS_CLOUD_FUNCTION.DROP_FUNCTION (
catalog_name IN VARCHAR2,
function_name IN VARCHAR2
);
DBMS_CLOUD_FUNCTION.DROP_FUNCTION (
library_name IN VARCHAR2,
function_name IN VARCHAR2
);
This procedure creates a PL/SQL wrapper for adding new functions to the catalog and removing wrappers for functions that have been deleted from the catalog.
Syntax
DBMS_CLOUD_FUNCTION.SYNC_FUNCTIONS (
catalog_name IN VARCHAR2,
refresh_rate IN VARCHAR2 DEFAULT 'DAILY'
);
Parameters
Parameter
Description
catalog_name
Specifies the catalog name.
This parameter is mandatory.
refresh_rate
Specifies the refresh rate of the function.
refresh_rate can accept the following values:
HOURLY
DAILY
WEEKLY
MONTHLY
The default value for this parameter is DAILY.
Errors
Error Code
Description
ORA-20003
This error is raised when the specified catalog does not exist.
ORA-20004
This error is raised when an invalid value is passed for the refresh_rate parameter.
Example:
BEGIN
DBMS_CLOUD_FUNCTION.SYNC_FUNCTIONS (
catalog_name => 'OCI_DEMO_CATALOG'
);
END;
/