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.
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.
| SQLState | Error Code | Error Text | Description |
|---|---|---|---|
| 22023 | SR014 | Function any_grants needs a string as argument 1, not an arg of type [type] |
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.