How To Find Out Table Name At Database Level Trigger

Table Name
How do I will come to know the name of table on which currently DML statement is fired ?
e. g. My current user is SCOTT. So Scott should realize the event of DML Statement fired. Hence my question is how the trigger on User Level is to be written & how to catch the event & table name on which the statement is being executed.
Suppose my table is as follows
Table Name : EMP
EMPNO number
ENAME varchar2(10)
JOB varchar2(9)
MGR number
HIREDATE date
SAL number
COMM number
DEPTNO number
Bcd number
Brcd number
Rec_id number
Scn_no number
Sequences for above table
1. EMP_REC_ID - minimum value is 1 increment by 1 & max value is unlimited
2. EMP_SCN_NO - minimum value is 1 increment by 1 & max value is unlimited
I have written a trigger as follows :
CREATE OR REPLACE TRIGGER UPD_EMP_REC_SCN BEFORE INSERT OR UPDATE OR DELETE ON EMP REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW
DECLARE
BEGIN
IF (INSERTING) THEN
SELECT EMP_REC_ID.NEXTVAL INTO :NEW.REC_ID FROM DUAL;
ELSIF (UPDATING) THEN
SELECT EMP_SCN_NO.NEXTVAL INTO :NEW.SCN_NO FROM DUAL;
ELSIF (DELETING) THEN
INSERT INTO DELETED_ROWS (TAB_NAME, BCD, BRCD, REC_ID)
VALUES (‘EMP’, :OLD.BCD, :OLD.BRCD, :OLD.REC_ID);
END IF;
END;
Hence My problem is
If my database user contains 800 tables then I have to write down 800 triggers (i.e. for each table).
I want to write only one trigger at database level so that I can dynamically take actions, for this I need table name and the event on which the dml event has taken place.
Any help in this matter will be greatly appreceiated.
Regards
Vikrant

You cannot write a single trigger that applies to multiple tables. If you need a trigger for every table, you will need to generate 800 triggers.
Rather than manually generating 800 triggers, you might write a code generator that generates triggers for each of the tables by querying the data dictionary (i.e. DBA_TABLES, DBA_TAB_COLS, etc).
Justin

Similar Messages

  • How to find out table name for the field in the webUI

    Hi.
    I am in CRM2007.
    So i go to the transaction code    BSP_WD_CMPWB
    In that i provide the component name as CRM_UI_FRAME.
    I press the Test button.
    So, it opend the WebUI.
    I want how to find out table of the particular input field?
    I mean from which table the data is retrived how to find out?
    When i enter some thing in the input field how to find out in which table that data is stored?
    By pressing F2 on the input field it opend View and Component Name.
    I want find out table of that particular field. How to find it?
    If anybody know about this explain it with Screen shorts if possible.
    Thank You.
    Krishna. B.

    hi
    goto tx genil_model_browser. Suppose you want to find fields reated to your order header eg sold to name. In component set write all and press F8. Then goto access object and in access object click on node BTAdminH. Click on attribute structure. Here you will find structure and attributes. If you click relationship then you will see all the relationship wrt btadminh. open any r/s that you require. and click on other object and attribute. You will get to know the structure.
    Best regards
    Pankaj kumar

  • How to find out query name using Elements of the query builder.

    Hi SDNers,
    how to find out query name using Elements of the query .
    thanks,
    satyaa

    Hi,
    For having a look at the relation between BEx tables,check the link below:
    http://wiki.sdn.sap.com/wiki/display/BI/ExploretherelationbetweenBEx+Tables
    -Vikram

  • How to find out Db name of perticular web application in sharepoint 2010

    how to find out Db name of perticular web application in sharepoint 2010 to take a backup from sql

    1.  Open the SharePoint 2010 Central Admin application.
    2.  On the SharePoint central administration website, click Application Management.
    3.  In the Databases section, click Manage Content Databases.
    4.  On the Manage Content Databases page, select a web application by clicking the Web Applications drop-down list and choosing a web application.
    5.  Can notice the  available database names for the webapplication. ******************************************************************************************
    Please remember to mark your question as answered &Vote helpful, if this solves/helps your problem
    s p kumar

  • How to find out server name in reports9i

    hi all
    how to find out server name in reports9i
    i need the report server name to call a report
    thanks
    Edited by: vikas singhal on Nov 5, 2008 1:02 AM

    You do not need to do anything, if your Report server is on the same machine as the Forms server (which is usually the case) you simply use the url as
    /reports/rwservlet?report=myreport' and the server will automatically use the default report server.
    then you simply use
    web.show_document('/reports/rwservlet?userid=scott/tiger@orcl&report=myreport&desformat=htmlcss&desname=test.html'Tony
    Try it now
    Edited by: Tony Garabedian on Nov 5, 2008 2:00 PM

  • HOW TO  FIND OUT TABLE DESCRIPTION FROM JDBC?

    HOW WILL FIND OUT TABLE DESCRIPTION FROM JDBC?

    Have a look at ResultSetMetaData
    getColumnCount()
    getColumnName(int)
    getColumnTypeName(int)
    getColumnDisplaySize(int)
    ***Annie***

  • How to find out  Locks on the database objects

    how to find out Locks on the database objects

    The following notes should be helpful:
    Note: 200590.1 - bde_session_locks.sql - Locks for given Session ID
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=200590.1
    Note: 1039273.6 - SCRIPT: VIEWING LOCKS ON OBJECTS HELD BY SPECIFIC USER
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=1039273.6
    You can also search Metalink, there are many notes/scripts published there which would be also helpful.

  • How to find out the name of a table?

    Hi
    How can I find out the name of a table which doesn't have a record history?
    Regards
    Rahman

    No direct way to know the tables. What you will find on the ABout this page link are the View Object (similar to record sets), Entity objects, controller and Application module. Generally EO is based on a table or the VO can be based on the query which you can find the corresponding xml file. But a button action might be calling a method in AM or CO which in turn call some wrapper method to interact with database. So nothing straight forward. You will have to analyze the all page related code objects.
    They are specific to OA framework and if you are not aware about them, better go through the initial chapters of OAF dev guide.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to find out program name to the corresponding output type of invoice..

    hi ALL,
    I want to findout program name to my output type.
    For one invoice functional peoples are configured. Here i know the outtype. But i don't know the program name .
    Can any body please tell me how to find out the program name for the output type..?

    Hi,
    Goto NACE t-code
    Select Billing (V3)
    Press 'Output Types' Button
    In the next screen select the corresponding output type you want.
    Then press 'Processing Routines' in the left pane. You can see the program name
    Cheers,
    Kothand

  • How to Find out the Name of the Table in Data Sources

    Hi All,
    How Can i find out the table names used in data Sources.
    For EX. Suppose I want to find out the table Names  in R3 Used In GL Data Source 0FI_GL_4.
    Thanks in Advance.
    Vaibhav A

    Hi,
    Usefull link:
    https://wiki.sdn.sap.com/wiki/display/BI/BW%20SD%20MM%20FI%20DATASOURCES
    Regards.

  • How to find out query name in customer exit for variables

    We use the same customer exit variable in different queries. In the customer exit we want to find out, which query has called the customer exit. With the technical query name we want to read a master data table entry.
    e.g. If we come from query ZG1_TEST1 we want to use selection sel1
    Query name  |  selection
    ZG1_TEST1   |  sel1
    ZG1_TEST2   |  sel2  
    How can we find out the query name in the customer exit for variables?
    Thanks for your help,
    Evi

    Hi Evi,
    check out the structure I_S_RKB1D in your exit. It contains the query.
    Siggi

  • Find out table name

    Hi All, how do we find out the table name for selfservice screen which were developed using OAF, i mean to ask suppose we have screen in apps Iexpense ,is there any way to find out the table name for that screen on which its based. thanks
    Thanks

    Hi,
    You can find the page details (UI componeents and bc4j objects) in the page Tab.
    --Prasanna                                                                                                                                                                                                           

  • How to find out the names which have overlapping times

    Hello:
    I've a table which contains some names and their calling time period. I need to find out which of those names have overlapping time period.
    Name|StartTime|EndTime
    A|26/3/2011 12:33:16 PM|26/3/2011 12:40:10 PM
    A|26/3/2011 12:41:28 PM|26/3/2011 12:43:19 PM
    A|26/3/2011 12:42:28 PM|26/3/2011 12:47:50 PM
    B|26/3/2011 10:22:28 PM|26/3/2011 10:50:10 PM
    B|26/3/2011 10:49:28 PM|26/3/2011 10:53:50 PM
    B|26/3/2011 10:50:28 PM|26/3/2011 10:59:50 PM
    B|26/3/2011 10:59:58 PM|26/3/2011 11:10:50 PM
    C|26/3/2011 11:05:58 PM|26/3/2011 11:10:50 PM
    C|26/3/2011 11:40:58 PM|26/3/2011 11:50:50 PM
    I need those names which have multiple calls and one call starts before the end of another call. If anyone have four calls and two of those overlapped (A has two overlapping and B has three overlapping), that name should also come into my list like below:
    Name|Overlapping_Count
    A|1
    B|2
    Can anyone help me please?
    Thanks/Razin

    Thans for pointing out the error in my post. It seems, being rather busy in this period, I'm starting to wear out as I missed the fact the overlaps would be returned twice. :(
    I had in mind a more general case where as single row overlaps with more than one other row.
    The OP's data contained one to one overlaps only and it seems no generalized approach was needed.
    with
    the_data as
    (select 'A' name,to_date('26/03/2011 12:33:16','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:40:10','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'A' name,to_date('26/03/2011 12:41:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:43:19','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'A' name,to_date('26/03/2011 12:42:20','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:42:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'A' name,to_date('26/03/2011 12:42:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:47:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'B' name,to_date('26/03/2011 10:22:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:50:10','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'B' name,to_date('26/03/2011 10:49:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:53:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'B' name,to_date('26/03/2011 10:50:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:59:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'B' name,to_date('26/03/2011 10:59:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:10:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'C' name,to_date('26/03/2011 11:05:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:10:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'C' name,to_date('26/03/2011 11:40:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:50:50','dd/mm/yyyy hh24:mi:ss') end_time from dual
    select name,count(distinct overlap) overlapping_count
      from (select x.name,to_char(greatest(x.start_time,y.start_time),'yyyymmddhh24miss')||'|'||to_char(least(x.end_time,y.end_time),'yyyymmddhh24miss') overlap
              from the_data x,the_data y
             where x.name = y.name
               and greatest(x.start_time,y.start_time) < least(x.end_time,y.end_time)
               and x.start_time != y.start_time
               and x.end_time != y.end_time
    group by name
    order by name
    with
    the_data as
    (select 'A' name,to_date('26/03/2011 12:33:16','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:40:10','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'A' name,to_date('26/03/2011 12:41:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:43:19','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'A' name,to_date('26/03/2011 12:42:20','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:42:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'A' name,to_date('26/03/2011 12:42:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 12:47:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'B' name,to_date('26/03/2011 10:22:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:50:10','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'B' name,to_date('26/03/2011 10:49:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:53:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'B' name,to_date('26/03/2011 10:50:28','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 10:59:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'B' name,to_date('26/03/2011 10:59:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:10:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'C' name,to_date('26/03/2011 11:05:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:10:50','dd/mm/yyyy hh24:mi:ss') end_time from dual union all
    select 'C' name,to_date('26/03/2011 11:40:58','dd/mm/yyyy hh24:mi:ss') start_time,to_date('26/03/2011 11:50:50','dd/mm/yyyy hh24:mi:ss') end_time from dual
    t as
    (select name,
            case when max(end_time) over(partition by name order by start_time,end_time rows between unbounded preceding and 1 preceding) > start_time
                 then 0
                 else 1
            end start_of_group
      from  the_data
    select  name,
            count(*) overlapping_count
      from  t
    where start_of_group = 0
    group by name
    order by nameRegards
    Etbin

  • How to find the tables name in R3 datasource

    I am looking to find out the tables were used for that Datasources(0m_cc0_9). Pls let me know the steps to find out thsi.
    Thanks
    Taj

    Hi Tamkris
    1. First go to help.sap.com and simply search for the datasource. You would come to a page where detailed description of the datasource is given.Just note that SAP sometimes plays spoilsport and for few Datassources it doesnt give the table names. But in your case for 0CO_OM_CCA_9, details are given.
    2. If in some cases table names are not given, simply go to rsa3. open another session ST05. Activate the trace.In Rsa3, enter the datasource name. And then run extraction. Go to ST05 switch off the trace and then view the log.
    In the log, all tables that are hit are shown
    3. And if all this doesnt help, start debugging the datasource. TYpically these would be function module based. So dig in!
    Hope this info helps
    Prakash
    Assigning points is a way of saying thanks on SDN!

  • How to find out class name

    Hi folks,
    Can anybody help me, I got stuck on this problem.
    I need to find out the className of the class, which is specified
    by ordinary filename.
    In other words:
    User gives me filename (something.class) and I need to find out
    classname (I just need to create an instance of this class)
    Thanks a lot.
    sgtPepper

    This will read the class name from a class file.
    * @author Ian Schneider
    public class JavaClassName {
        public static void main(String[] args) throws Exception {
            DataInputStream din = new DataInputStream(new FileInputStream(args[0]));
            int cafebabe = din.readInt();
            if (cafebabe != 0xcafebabe)
                throw new Exception("Not class file");
            din.skip(4);
            int cnt = din.readShort() - 1;
            Object[] info = new Object[cnt];
            for (int i = 0; i < cnt; i++) {
                int b = din.readByte();
                switch (b) {
                    case 1:
                        info[i] = din.readUTF(); break;
                    case 3: case 4: case 9: case 10: case 11: case 12:
                        din.skip(4); break;
                    case 5: case 6:
                        i++;
                        din.skip(8); break;
                    case 7: case 8:
                        info[i] = Short.valueOf(din.readShort()); break;
                    default:
                        assert false;
            din.skip(2);
            int off = din.readShort();
            Number ptr = (Number) info[off - 1];
            System.out.println(info[ptr.intValue() - 1]);
            din.close();
    }

Maybe you are looking for

  • When opening a new window, any clicks within the new window click through to the original window so you can't scroll or save from the new window.

    Anytime that a new window is opened (such as when sending an email message or opening a pdf) I am unable to click on the new window. I can't click send or click on the scroll bars of the new window. If I attempt to click on the window it clicks on wh

  • How do I save a Mac book on a PC?

    I bought a Mac-formatted book from the iTunes Store, installed Windows 8.1 Note, converted and opened the book.  How do I save the book in my directory for easy access?  I don't want to have to go back into iTunes, find it, convert it, and open it ev

  • Importing Album- backwards

    Whenever I import an album off of iTunes, the songs are uploaded into my library in the reverse order, therefore when I burn it into a disc, all the songs are backwards! It irritates me and I was wondering if there was any way to change/fix this with

  • Can I deploy the same ear one different OS

    Hi,           I created 1 ear file on NT and deployed using WebLogic 6.1 SP2 on NT. It           works fine. I want to deploy it on other OS (I don't have WebLogic on other           OS installed yet). Can it work?           Thanks.           C Zhang

  • Lenovo G480 lcd darker on right side.

    Dear All,  Greetings Some days ago my laptop's screen got a bit darker on right side. Now its more dark & it looks like different. Its pixels also show different colour. On an external monitor gives a perfect picture. But LCD has problem. Please help