22.31 IS_REMOTE_SQL_AUTH_VALID Function

This function checks whether the current authentication credentials are correct for the given REST Enabled SQL instance.

Syntax

function IS_REMOTE_SQL_AUTH_VALID (
    p_server_static_id  IN    VARCHAR2 )
    RETURN BOOLEAN;

Parameters

Table 22-29 IS_REMOTE_SQL_AUTH_VALID Function Parameters

Parameter Description
p_server_static_id Static ID of the REST enabled SQL instance.

Returns

Returns true, when credentials are correct, false otherwise.

Example

The following example requires a REST enabled SQL instance created as My Remote SQL. It uses credentials stored as SCOTT_Credentials.

begin
    apex_credentials.set_session_credentials(
        p_application_id    => {application-id},
        p_credential_name   => 'SCOTT_Credentials',
        p_username          => 'SCOTT',
        p_password          => '****' );
    if apex_exec.check_rest_enabled_sql_auth(
        p_server_static_id  => 'My_Remote_SQL' )
    then
        sys.dbms_output.put_line( 'credentials are correct!');
    else 
        sys.dbms_output.put_line( 'credentials are NOT correct!');
    end if;
end;