proc_role

Description

Returns information about whether the user has been granted a specified role.

NoteSybase supports—and recommends—that you use has_role instead of proc_role. You need not, however, convert your existing uses of proc_role to has_role.

Syntax

proc_role("role_name")

Parameters

role_name

is the name of a system or user-defined role.

Examples

Example 1

Creates a procedure to check if the user is a System Administrator:

create procedure sa_check as 
if (proc_role("sa_role") > 0) 
begin 
    print "You are a System Administrator." 
    return(1) 
end

Example 2

Checks that the user has been granted the System Security Officer role:

select proc_role("sso_role")

Example 3

Checks that the user has been granted the Operator role:

select proc_role("oper_role")

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute proc_role.

See also

Commands alter role, create role, drop role, grant, set, revoke

Documentation Transact-SQL Users Guide

Functions mut_excl_roles, role_contain, role_id, role_name, show_role