Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2004
    Posts
    3

    Unanswered: output trigger thats on server

    Hello I just was wondering if there is a way that I can view the code of an exsisting trigger that is being used on one of my tables. Someone else wrote this trigger and I just need to see how it was written. Any help would be great!

    Thank you

    Dave

  2. #2
    Join Date
    Apr 2004
    Posts
    246
    select * from user_triggers;
    Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.

  3. #3
    Join Date
    Oct 2004
    Posts
    3
    But does that output the code that was used to create the trigger?

  4. #4
    Join Date
    Apr 2004
    Posts
    246
    did you try it yet?
    Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.

  5. #5
    Join Date
    Oct 2004
    Posts
    3
    yea i tried it....it showed the names of the triggers but not the code that was used.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,296
    DBA_SOURCE

    PHP Code:
    select text 
    from dba_source 
    where 
      owner 
    'SchemaName'
      
    and name 'ObjectName'
    order by line
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  7. #7
    Join Date
    Apr 2004
    Posts
    246
    <pre>
    SQL> desc user_triggers
    Name Null? Type
    ----------------------------- -------- --------------------
    TRIGGER_NAME VARCHAR2(30)
    TRIGGER_TYPE VARCHAR2(16)
    TRIGGERING_EVENT VARCHAR2(227)
    TABLE_OWNER VARCHAR2(30)
    BASE_OBJECT_TYPE VARCHAR2(16)
    TABLE_NAME VARCHAR2(30)
    COLUMN_NAME VARCHAR2(4000)
    REFERENCING_NAMES VARCHAR2(128)
    WHEN_CLAUSE VARCHAR2(4000)
    STATUS VARCHAR2(8)
    DESCRIPTION VARCHAR2(4000)
    ACTION_TYPE VARCHAR2(11)
    TRIGGER_BODY LONG
    </pre>

    trigger_name - s/b obvious
    description - contains before/after ins/upd/del on tab, referencing..., for each row
    when_clause - s/b obvious
    trigger_body - DID YOU LOOK AT IT!!!!?????!!!!
    Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.

  8. #8
    Join Date
    Apr 2004
    Posts
    246
    dba_source doesn't contain triggers (at least not up to v9)
    Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.

  9. #9
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    To see the entire trigger body, issue the following command

    set long 32767

    Then issue the select TRIGGER_TYPE,TRIGGERING_EVENT,trigger_body
    from user_triggers
    where table_name = 'MY_TABLE';

    This will show the body of all the triggers on your table.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  10. #10
    Join Date
    Jul 2003
    Posts
    2,296
    Quote Originally Posted by shoblock
    dba_source doesn't contain triggers (at least not up to v9)
    doh! I was thinking of packages and such.
    thanks for the correction
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •