Reg: Max no of triggers on a Table

All,
Could you please clarify me on, How many triggers we can apply on a table. As far as i know, there is no limit from 11g on wards, but not sure, before 11g it was only 12 ( 12 types of triggers).  Could you please provide me a link where i can check this in the oracle documentation.
Thanks

"Since you can define separate triggers on  different columns the only limiting factor will be based on the number of columns in the table."
How the trigger will be limiting based on the no of columns in a table.
Just a heads up for you and others that think there are shortcuts to learning.
You aren't going to learn if you are unwilling to read the documentation or to try things for yourself.
It is very easy to do both of those things so when people won't do them it gives the impression that they are lazy and just want other people to do their work for them.
In an interview is is VERY easy to tell when you have one of those people in front of you.
A simple web search for 'oracle 11g creating trigger' lists this link to the PL/SQL Langauge Reference as the second result
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/triggers.htm#BABCIBBJ
At the top of that link is a list of the topics covered with a link to each of them. One of those topics is 'Creating Triggers':
Creating Triggers
To create a trigger, use the CREATE TRIGGER statement. By default, a trigger is created in enabled state. To create a trigger in disabled state, use the DISABLE clause of the CREATE TRIGGER statement. For information about trigger states, see Overview of Triggers.
When using the CREATE TRIGGER statement with an interactive tool, such as SQL*Plus or Enterprise Manager, put a single slash (/) on the last line, as in Example 9-1, which creates a simple trigger for the emp table.
Example 9-1 CREATE TRIGGER Statement
CREATE OR REPLACE TRIGGER Print_salary_changes  BEFORE DELETE OR INSERT OR UPDATE ON emp
   FOR EACH ROW
   WHEN (NEW.EMPNO > 0)
   DECLARE  sal_diff number;
   BEGIN
  sal_diff  := :NEW.SAL  - :OLD.SAL;
   dbms_output.put('Old salary: ' || :OLD.sal);
   dbms_output.put('  New salary: ' || :NEW.sal);
   dbms_output.put_line('  Difference ' || sal_diff);
   END;
Did you notice this line?
WHEN (NEW.EMPNO > 0)
So create a new trigger by changong the name of the trigger to Print_salary_changes1 but use this line
WHEN (NEW.EMPNO < 0)
Now do it again with a new name and use this line
WHEN (NEW.EMPNO = 0)
How many triggers are there now?
Keep going as long as you like using a new name and a new line:
WHEN (NEW.EMPNO IS NULL)
WHEN (NEW.EMPNO = 11)
WHEN (NEW.EMPNO = 22)
WHEN (NEW.EMPNO = 33)
WHEN (NEW.EMPNO = 44)
How many triggers do you have now for just this one column?
Keep going and let us know when Oracle gives you the exception 'TOO MANY TRIGGERS'.

Similar Messages

  • How to write two triggers on same table how it works?

    Hello sir..
    I have to write two triggers on same table for auditing different columns of different pages (may be different modules).
    I will have an audit table in which i will insert data such as (user_id,module_id,column_name,old_col_val,new_col_ val,timestamp)
    Now different users from different pages will update the data on same table may be same columns!
    If we write directly, we will not be able to know which column is updated from different pages.
    My question is how can we control the triggers to raise based on the pages

    A trigger is executed whenever the table is inserted / updated / deleted (depend on trigger definition). It won't know what 'page' caused the operation. You can prepare a trigger for one page.
    In order to fulfill your need, you need some way to tell the trigger where you are. There are many ways to accomplish this. Some possible methods are (please check the documents for detail)
    DBMS_SESSION.SET_IDENTIFIER
    DBMS_APPLICATION_INFO.SET_MODULEFor example, you can call DBMS_SESSION.SET_IDENTIFIER to set an ID from your page, and then call sys_context to read the ID back:
    In Page:
    exec dbms_session.set_identifier('Page1');
    ...In Trigger
    pageid  := sys_context('USERENV', 'CLIENT_IDENTIFIER') ;
    ...Note that if you use a connection pool, you may need to properly reset the session information before return, in order to avoid messing up the session information when the connection is used next time.

  • Two triggers on same table

    Hi Friend.
    I have to write two triggers on same table for auditing different columns of different users(may be different modules).
    I will have an audit table in which i will insert data such as (user_id,module_id,column_name,old_col_val,new_col_val,timestamp)
    Now different users from different modules will update the data on same table may be same columns from different front end forms!
    If we write directly, we will not be able to know which column is updated by which user.
    My question is in this case how can we control the triggers to raise differently?

    You can use WHEN clause to fire a trigger only when some condition is true - you can check an user also,
    look at simple example:
    - suposse we have two users US1 and US2:
    C:\>sqlplus sys as sysdba
    SQL*Plus: Release 10.2.0.1.0 - Production on Pn Gru 6 13:14:22 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> create user us1 identified by us1;
    User created.
    SQL> create user us2 identified by us2;
    User created.
    SQL> grant connect, resource to us1, us2;
    Grant succeeded.
    SQL> grant create public synonym to us1, us2;
    Grant succeeded.and suposse we have a table with three columns + audit table:
    SQL> connect us1
    Enter password:
    Connected.
    SQL> create table tab123(
      2  col1 number,
      3  col2 number,
      4  col3 number);
    Table created.
    SQL> create table audit_tab123(
      2  username varchar2(100),
      3  col1 number,
      4  col2 number,
      5  col3 number );
    Table created.
    SQL>  grant select, update, insert on tab123 to us2;
    Grant succeeded.
    SQL>  grant select, update, insert on audit_tab123 to us2;
    Grant succeeded.
    SQL> create public synonym tab123 for tab123;
    Synonym created.
    SQL> insert into tab123 values( 1, 1, 1 );
    1 row created.
    SQL> commit;
    Commit complete.We want a trigger that is fired only by user US1 and only after update of COL1 and COL2
    (COL3 is ignored):
    SQL> connect us1/us1
    Connected.
    SQL> CREATE OR REPLACE TRIGGER Trig_123_US1
      2  AFTER UPDATE OF col1, col2 ON tab123
      3  FOR EACH ROW
      4  WHEN ( user = 'US1' )
      5  BEGIN
      6    INSERT INTO audit_tab123( username, col1, col2 )
      7    VALUES( user, :new.col1, :new.col2 );
      8 END;
    SQL> /
    Trigger created.And we want a second trigger that is fired only by user US2 and only after update of COL2 and COL3
    (COL1 is ignored):
    SQL> connect us1/us1
    Connected.
    SQL> CREATE OR REPLACE TRIGGER Trig_123_US2
      2  AFTER UPDATE OF col2, col3 ON tab123
      3  FOR EACH ROW
      4  WHEN ( user = 'US2' )
      5  BEGIN
      6    INSERT INTO audit_tab123( username, col2, col3 )
      7    VALUES( user, :new.col2, :new.col3 );
      8  END;
      9  /
    Trigger created.and now let test our triggers:
    SQL> connect us1/us1
    Connected.
    SQL> update tab123 set col1 = 22;
    1 row updated.
    SQL> update tab123 set col2 = 22;
    1 row updated.
    SQL> update tab123 set col3 = 22;
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select * from audit_tab123;
    USERNAME         COL1       COL2       COL3
    US1                22          1
    US1                22         22
    SQL> connect us2/us2
    Connected.
    SQL> update tab123 set col1 = 333;
    1 row updated.
    SQL> update tab123 set col2 = 333;
    1 row updated.
    SQL> update tab123 set col3 = 333;
    1 row updated.
    SQL> commit
      2  ;
    Commit complete.
    SQL> select * from us1.audit_tab123;
    USERNAME         COL1       COL2       COL3
    US1                22          1
    US1                22         22
    US2                          333         22
    US2                          333        333As you see, each trigger is fired only once, first triger only for user US1 and columns COL1 and COL2,
    and second trigger only for user US2 and only after update of COL2 and COL3.
    I hope this will help.

  • Max no of feilds a database table can have?

    Hi all,
            Can some body tell me Max no of feilds a database table can have?
    Thanks a lot - Chandan

    Hi Chandan,
          You can refer the below link ( check the sub heading constraints).
    http://help.sap.com/saphelp_47x200/helpdata/en/cf/21eb6e446011d189700000e8322d00/content.htm
    Regards,
    Siva.

  • Query about min and max and middle row of a table

    suppose i have table emp and field
    v_date date;
    which has data in time stamp
    time
    10:20
    10:25
    10:30
    10:32
    10:33
    10:35
    10:36
    10:38
    I need only min time and max time and two record between min and max

    I need only min time and max time and two record between min and max Like this?
    SQL> create table t (id number);
    Table created.
    SQL>
    SQL> insert into t values (1020);
    1 row created.
    SQL> insert into t values (1025);
    1 row created.
    SQL> insert into t values (1030);
    1 row created.
    SQL> insert into t values (1032);
    1 row created.
    SQL> insert into t values (1033);
    1 row created.
    SQL> insert into t values (1035);
    1 row created.
    SQL> insert into t values (1036);
    1 row created.
    SQL> insert into t values (1038);
    1 row created.
    SQL>
    SQL> commit;
    Commit complete.
    SQL>
    SQL> select * from t;
         ID
       1020
       1025
       1030
       1032
       1033
       1035
       1036
       1038
    8 rows selected.
    SQL>
    SQL>
    SQL> select decode(rownum, 1, min_val, 4, max_val, next_val) your_data from (
      2  select first_value (id) over (partition by 'a' order by 'a') min_val,
      3         last_value (id) over (partition by 'a' order by 'a')  max_val,
      4         id,
      5         lead(id) over (partition by 'a' order by id) next_val
      6   from t
      7  order by id
      8   )
      9  where min_val <> next_val and max_val <> next_val
    10  and rownum <= 4;
    YOUR_DATA
         1020
         1030
         1032
         1038
    SQL>

  • Reg: Max length of internal table field(GUI_UPLOAD)

    Hi All,
    In my internal table there is a field for long text(free text/string), when i using GUI_UPLOAD the field max char is 255, so i couldnt get the full text, eventhough i declared that particular long text as string. Can any one tell me how to get the free text.
    And i am uploading data from presentation server, not from app server.
    Thanks in advance.
    Arun
    Edited by: arun on Mar 18, 2010 7:01 AM

    You have to cook your own logic. But what is the reason for not sorting the table?
    If you do not want to disturb the main intrenal table, you can move the contents into a temporary internal table, and sort it by descending order. The first record would have the maximum value.
    here is a logic to find the maximum value.
    loop at itab.
    if itab-value > v_max.
    v_max = itab-value.
    endif.
    endlop.
    V_max would have the maximum value at the end lo the loop.
    Regards,
    Ravi

  • Max no of coumns in a table

    Hi,
    What is the maximum number of columns in a Table.
    Many Thanks,

    Hi,
    For Oracle 9iR2 or 10gR1, it's 1000 columns max : http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_73a.htm#2153106
    Nicolas.
    For 8.1.7 too, it's thousand columns max for one table.
    Message was edited by:
    Nicolas Gasparotto

  • Howto limit max. count of rows in a TABLES-based import-parameter?

    Hello all,
    I have created a web service based on a custom function module in SAP. Beside others this function module provides one TABLES input parameter, which is set to "optional". Now I want to publish the web service with this parameter optionally as well, but also allow it for max. 10 tmes (meaning max. 10 rows for this import table).
    I have found an entry for min and max settings in SE80 for this web service, but unfortunately these both fields are read-only, so I can't set the maxOccurs here.
    Any ideas how I can solve this problem?
    Thanks in advance for your help!
    Kind regards, Matthias
    Edited by: Matthias F. Brandstetter on Oct 21, 2010 10:32 AM

    Hi,
    It is not possible to change SAP generated service. Better you create new service in ESR and assign correct maxOccurs and then create proxy of this service in backend where you can also map ESR service to FM.
    To minimize effort you can copy same wsdl and then change wsdl and import in ESR as new service.
    Regards,
    Gourav

  • Geneartion of max srlno +1 for a given table and a column

    Dear friends,
    I am trying to write a function which will accept a table name and a column name (must be numeric) of that table, calculate the maximum value of the column name as under...
    The funtion compiles fantastic but on execution it gives a lot of error. I admit to be a newbie writing dynamic sql, and hence needs help on that ....Below what I wrote...
    create or replace function get_newsrl(TabNm user_tab_columns.TABLE_NAME%TYPE,ColNm user_tab_columns.COLUMN_NAME%TYPE) return number is
    NewSrl number;
    Begin
         NewSrl:=0;
         dbms_output.put_line(TabNm);
         dbms_output.put_line(ColNm);
         Begin
              Execute Immediate
              'Begin
              'select max(' || ColNm ||') into NewSrl from ' ||TabNm||' Using '||ColNm||','||TabNm||';';
              ||'end;';
         end;     
         NewSrl:=NewSrl+1;
    Return NewSrl;
    End;

    SQL> create or replace function get_newsrl(TabNm Varchar2, ColNm Varchar2) return number is
      2  NewSrl number;
      3  Begin
      4  /*
      5  NewSrl:=0;
      6  dbms_output.put_line(TabNm);
      7  dbms_output.put_line(ColNm);
      8  */
      9  Execute Immediate
     10  'select max(' || ColNm ||') into NewSrl from ' ||TabNm;
     11  NewSrl:=NewSrl+1;
     12  Return NewSrl;
     13  Exception
     14  When OTHERS
     15  then return (- SQLCODE);
     16  End;
     17  /
    Ôóíêöèÿ ñîçäàíà.
    SQL> select get_newsrl('EMP', 'EMPNO') from dual;
    GET_NEWSRL('EMP','EMPNO')
                          905
    SQL>

  • Change max entents of  DR$TEXT_INDEX$I table to UNLIMITED

    I am using Oracle 11.2.0.2. I have a context index whose DR$TEXT_INDEX$I tables is giving ORA-01631: max # extents (200) reached in table DR$TEXT_INDEX$I .
    What is the easiest way to change DR$TEXT_INDEX$I value to unlimited. The table is under dictionary base tablespace.
    Thanks for you help.

    I changed storage preference of the index and recreated the index.

  • Optimized query to find Min and max of a col in a table

    I have a table doc_boe_rec with record count 12375934
    the primary key columns are (boe_rec_id,psd_serial_num).
    No other ndexes are present on this table.
    I want an optimized query which will give both the results :
    1.Min boe_rec_id (boe_rec_id from 1st record)
    2.Max boe_rec_id from this table with rows limited to a value say 5000.
    i.e (boe_rec_id from 5000th column value from table )
    Thanks
    Manoj

    1.Min boe_rec_id (boe_rec_id from 1st record)It is confusing for me. The min value for the first, hmmm...
    2.Max boe_rec_id from this table with rows limited to a value say 5000.Not more clear...
    Please details your requirements.
    Nicolas.

  • Reg. max of a character field :)

    HI all,
    I wanna find the maximum value of a character type field of a database table...but as u know...select max(f1)...syntax is applicable on numeric type..
    Pleas assist me..
    <b>Have ur points..</b>
    Regards,

    Hi,
    Try this way.
    XXX = '000'.              
    SELECT * FROM T100        
      WHERE SPRSL = 'D' AND   
            ARBGB = '00'.     
      CHECK: T100-MSGNR > XXX.
      XXX = T100-MSGNR.       
    ENDSELECT.                
    or
    SELECT MAX( MSGNR ) FROM T100 INTO XXX 
    WHERE SPRSL = 'D' AND                
           ARBGB = '00'.      

  • Maximum no. of triggers on a table?

    Hi,
    what is the maximum no. of triggers on a single table.
    Thanks,
    Rup

    12Really ?
    SQL> create table mytable (id number(4))
      2  /
    Tabel is aangemaakt.
    SQL> create trigger mytrigger_1 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_2 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_3 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_4 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_5 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_6 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_7 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_8 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_9 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_10 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_11 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_12 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> create trigger mytrigger_13 before insert on mytable begin null; end;
      2  /
    Trigger is aangemaakt.
    SQL> select count(*) from user_triggers where table_name = 'MYTABLE'
      2  /
                                  COUNT(*)
                                        13
    1 rij is geselecteerd.Regards,
    Rob.

  • Process triggered before update table filled

    Hello,
    We have a program that
    - calls one FM (RSSM_SDL_INFOPACKAGE_DIALOG) that gives direct access to a specific infopackage (via program parameters) that is uploading an ODS when executed
    - secondly calls another FM (BP_EVENT_RAISE) that triggers an event that activates the ODS (and some other processes afterwards).
    The problem is: The event is triggered when the infopackage is left - and the infopackage might be left before the update table is filled. So the activating process might start before the filling of the update table has been done (monitor status not green).
    How can this issue be solved keeping in mind that the end-user should only execute one transaction (the one that's execute the program).
    Kind regards,
    Johnny

    Hi Simon,
    Can you provide me with information of how to build in this loop. Please check the relevant part of our program:
      CALL FUNCTION 'RSSM_SDL_INFOPACKAGE_DIALOG'
        EXPORTING
          SOURCE.......
    IMPORTING
    EXCEPTIONS
       error                  = 1
       OTHERS                 = 2.
      IF sy-subrc <> 0.
      PERFORM log_nogo.
        MESSAGE e001(00) WITH 'FM Error: Infopackage error message succesfully logged'.
      ELSE.
        IF NOT p_evtid IS INITIAL.
          PERFORM raise_event
               USING p_evtid
            CHANGING ret_code.
          IF ret_code <> 0.
            MESSAGE e002(zbps) WITH 'Error raising event '
                                   p_evtid.
          ELSE.
            MESSAGE s002(zbps) WITH 'Event'
                                  p_evtid
                                  ' successfully' ' raised'.
          ENDIF.
        ENDIF.
      ENDIF.
    Thanks,
    Johnny

  • Reg:How to delete the column in table control also from database table.

    Hi Experts,
    Once again thank u all for giving the responses.
    one more doubt is how to delete the columns of table control and also the record shold delete from ztable.
    With Regards,
    Saroja.P.

    Hi,
    If you want to delete the rows in the table control and simultaneously delete it from the database table, then you can implement a 'DELETE' functionality specific to your table control. Have a MARK field (you will find that in the screen attributes of the table control -> give a name for the MARK field, you will find an additional MARK column at the beginning of your table control). You can check whatever rows you want to delete from the table control, call the delete module.
    "This portion of code inside the LOOP...ENDLOOP.
    IF sy-ucomm eq 'F_DELETE'.
       gt_itab2-check = mark.  " Store the MARK field status into your internal table's correspoding field 'check'
      MODIFY gt_itab INDEX tabcontrol-current_line.
    ENDIF.
    iF sy-ucomm eq 'DELETE1'.
      DELETE gt_itab WHERE check eq 'X'. "Your internal table does not have rows that you want to delete
    ENDIF.
    Now you can modify your database table using the MODIFY statement.
    MODIFY ZDB FROM TABLE gt_itab.

Maybe you are looking for

  • How to change the legend value in graph OBIEE

    I have 2 columns A and B are measure columns. How can I change "A" and "B" in the legend of my vertical bar graph to "LIA" and "ASSET", without changing the A,B name in my subject area. Thanks for any help! Edited by: user6388889 on Nov 18, 2012 5:46

  • Assigning Transaction Code to each field in a report

    Hi, I have a query report which displays for example Purchase Order, Material etc Now via abap i want to assign a transaction code to both fields so when the the query runs and if the user double clicks Purchase Order it goes to ME23N if the user dou

  • Weird bug?  Transparent background is black instead of checkerboard in RGB mode

    If I try to make a new RGB document with the Background Contents set to Transparent the canvas is filled with black instead of the checkboard pattern.  However over in the Layers window the little icon for the layer shows it as transparent with the c

  • Vertical Mapping in 3.0.1

    I'm trying to do a vertical mapping and am getting the following exception: java.lang.ClassCastException at kodo.jdbc.meta.ClassMapping.resolve(ClassMapping.java:952) at kodo.jdbc.meta.VerticalClassMapping.resolve(VerticalClassMapping.java:300) at ko

  • 10.0.2 update breaks AIR publish settings option

    Since updating to 10.0.2, I have been unable to access the AIR settings (File -> AIR Settings) for my FLA file which is published as AIR 1.5. I get an JavaScript error pop up about "Apollo_OpenSettingsDialog.jsfl" every time I click on the menu optio