Results 1 to 7 of 7

Thread: delete

  1. #1
    Join Date
    Nov 2007
    Posts
    72

    Unanswered: delete

    Hi All,

    i have a table datatable with 2 columns ...now my requirement is that no one should be able to delete data from that table including the owner of that table ..
    i tried creating a trigger on datatable

    create trigger restrict_delete no cascade before delete on datatable for each row mode db2sql

    please help me asap !!

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Check out the REVOKE statement.

    ASAP.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Nov 2007
    Posts
    72
    how can i revoke a rite from the owner of the object

    for example- if i created a table datatable being a user db2inst1 i cant revoke my privileges ..

  4. #4
    Join Date
    Feb 2009
    Posts
    114
    db2inst1 sounds like the default instance owner. Even if you revoke his privileges, he can still get to everything. So why would you do it. Besides, you cannot revoke privileges from yourself. And why would you want to ..!?

  5. #5
    Join Date
    Nov 2007
    Posts
    72
    that's what i know db2inst1 is the default user and i cant revoke his privilege but the requirement is that no one should be able to insert into the table and once a record is inserted it should be deleted .
    how do i achieve it ?

  6. #6
    Join Date
    Feb 2009
    Posts
    114
    db2inst1 is the instance owner - he can do anything whether you grant explicit privileges to him or not, and there is no way around it

  7. #7
    Join Date
    Nov 2007
    Posts
    72
    well i have been able to achieve it this is possible you can create a trigger on that table so that even the db2inst1 cant delete anything ...but if db2inst1 deletes the trigger then he can delete it directly
    here is the trigger
    CREATE TRIGGER DEL_TRIGGER
    BEFORE DELETE ON LOGTABLE
    FOR EACH ROW
    SIGNAL SQLSTATE '42832'

Posting Permissions

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