DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Db schema level triggers

  1. #1
    Join Date
    Mar 2022
    Posts
    1

    Db schema level triggers

    Hi, we are facing a problem with data amount, so it would be a nice solution in testing env just to limit data with db schema level triggers...
    So querying a table would return only first 100 rows.
    This is enough with smoke tests.

    I guess this might be a schema level trigger in test user .... or is this possible ? It would affect to every table automatically which would be nice.

  2. #2
    Join Date
    Mar 2022
    Posts
    1
    The following statement creates a trigger for the EMP table:

    CREATE 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: ' || ld.sal);
    dbms_output.put(' New salary: ' || :new.sal);
    dbms_output.put_line(' Difference ' || sal_diff);
    END;
    /
    If you enter a SQL statement such as

    UPDATE emp SET sal = sal + 500.00 WHERE deptno = 10

Posting Permissions

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


Click Here to Expand Forum to Full Width