Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts

Friday, July 17, 2009

ansi sql : between syntax

select emp_id from emptable where emp_id BETWEEN 5 and 10;

This will list
5
6
7
8
9
10

because the range on BETWEEN clause is inclusive of the test values on databases using ANSI SQL.

Thursday, June 11, 2009

Database User Access information

To look up what role/access you have in an Oracle database we can use this query -

select * from dba_role_privs where grantee = 'userid';

Table structure of dba_role_privs:
Column Name    ID    Data Type
GRANTEE 1 VARCHAR2 (30 Byte)
GRANTED_ROLE 2 VARCHAR2 (30 Byte) -- Roles defined specifically for the db
ADMIN_OPTION 3 VARCHAR2 (3 Byte)
DEFAULT_ROLE 4 VARCHAR2 (3 Byte)


If there's no entry for the user-id in this table that means user doesn't have access to the database.