February 5, 2015

Query to show all tables names, see all the objects,create the table into the trigger in sql


Query to show all table names


select table_name from dba_tables


SELECT *FROM TAB;

Query to see all the objects in sql

This is a very simple query to get all the objects in sql. User_Objects is sql system table which include all object information as a records.

select * from USER_OBJECTS;

This is small query but it could be very helpful for you.

Create the table into the trigger using pl sql

To create table into the trigger using pl/sql you can try following code in SQL query editor or in stored procedure.

Create or replace trigger b_br after delete on EMP
declare
n integer;
PRAGMA AUTONOMOUS_TRANSACTION;
begin
dbms_output.put_line('Table Creation in process..');
execute immediate 'create table b_t(b varchar2(10))';
dbms_output.put_line('Table Created..');
end;

Delete from EMP;


Same way you can add more columns in tables with different data types.