Name

__any_grants — Checks a table for grants.

Synopsis

integer __any_grants ( in tablename varchar );
 

Description

The __any_grants() can be used to test whether there are any rights granted (for insert/update/delete) to a table for current SQL account.

Parameters

tablename

The table name to be tested.

Return Types

An integer will be returned to indicate whether the table supplied has any privileges granted (1) or not granted (zero 0) for current SQL user.

Errors

Table 24.1. Errors signalled by

SQLState Error Code Error Text Description
22023 SR014 Function any_grants needs a string as argument 1, not an arg of type [type]  

Examples

Example 24.12. Using the __any_grants() function

This simple example shows testing a grant rights for a table, using the __any_grants() function from ISQL and demo SQL user accout.

$isql localhost:1112 demo demo
-- the demo account owns an Orders table, so it's granted
SQL> select __any_grants ('Demo.demo.Orders');
callret
INTEGER
_______________________________________________________________________________

1

1 Rows. -- 1 msec.

-- but it has no permission to access the table SYS_REPL_ACCOUNTS
SQL> select __any_grants ('DB.DBA.SYS_REPL_ACCOUNTS');
callret
INTEGER
_______________________________________________________________________________

0

1 Rows. -- 5 msec.