16.6 SET_DATABASE_CREDENTIAL Procedure

This procedure updates database credential properties for a web credential.

If a web credential references a database credential, then it does not store secrets itself - that is done by the database credential. See DBMS_CREDENTIAL for more information.

Clears all existing client IDs, client secrets, all tokens, and the "Valid For URL" attribute. If database credentials for HTTP requests are not supported on the database, and the credential did not reference a database credential before, this procedure raises an error.

Syntax

APEX_CREDENTIAL.SET_DATABASE_CREDENTIAL (
    p_credential_static_id      IN VARCHAR2,
    p_db_credential_name        IN VARCHAR2,
    p_db_credential_is_instance IN BOOLEAN DEFAULT FALSE )

Parameters

Parameter Description
p_credential_static_id The credential static ID.
p_db_credential_name Name of the database credential to be referenced.
p_db_credential_is_instance Whether the database credential was made available at the Oracle APEX instance level (all workspaces). This parameter can only be used when instance credentials are enabled for the APEX instance using the INSTANCE_DBMS_CREDENTIAL_ENABLED instance parameter.

Example

The following example changes the referenced database credential to USE_THIS_DB_CREDENTIAL.

BEGIN
    -- set the workspace
    apex_util.set_workspace(p_workspace => 'MY_WORKSPACE'); 

    -- change the referenced database credential
    apex_credential.set_database_credential (
        p_credential_static_id => 'OAUTH_LOGIN',
        p_db_credential_name   => 'USE_THIS_DB_CREDENTIAL' );
END;

See Also:

DBMS_CREDENTIAL in Oracle Database PL/SQL Packages and Types Reference