If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > delete

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-21-09, 08:53
oracle10gsingh oracle10gsingh is offline
Registered User
 
Join Date: Nov 2007
Posts: 72
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 !!
Reply With Quote
  #2 (permalink)  
Old 04-21-09, 09:06
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Check out the REVOKE statement.

ASAP.
Reply With Quote
  #3 (permalink)  
Old 04-21-09, 09:11
oracle10gsingh oracle10gsingh is offline
Registered User
 
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 ..
Reply With Quote
  #4 (permalink)  
Old 04-21-09, 09:56
db2dummy1 db2dummy1 is offline
Registered User
 
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 ..!?
Reply With Quote
  #5 (permalink)  
Old 04-21-09, 11:05
oracle10gsingh oracle10gsingh is offline
Registered User
 
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 ?
Reply With Quote
  #6 (permalink)  
Old 04-21-09, 11:07
db2dummy1 db2dummy1 is offline
Registered User
 
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
Reply With Quote
  #7 (permalink)  
Old 04-22-09, 00:15
oracle10gsingh oracle10gsingh is offline
Registered User
 
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'
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On