Showing posts with label granting privileges. Show all posts
Showing posts with label granting privileges. Show all posts

Thursday, August 20, 2009

Database questions

Which system tables contain information about privileges granted and privileges obtained ?

USER_TAB_PRIVS_MADE, USER_TAB_PRIVS_RECD are the tables which contains the above asked information .

What command is used to create a table by copying the structure of another table ?

CREATE TABLE .. AS SELECT command
Explanation:
To copy only the structure, the WHERE clause of the SELECT command should contain a FALSE statement as in the following.

CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;
If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to
the new table.

Difference between stored procedure and Trigger :

Procedures can be called explicitely where as Triggers are automatically invoked when the action defined in Trigger is executed.

Triggers can also be enabled and Disabled.

Information related to stored procedures can be seen in USER_SOURCE and USER_OBJECTS(Current User) tables.
Where As
Information related to Triggers can be found in USER_SOURCE AND USER_TRIGGER(Current User) tables.