Need to know how rules work?

Started by Andre Lopesabout 16 years ago1 messagesgeneral
Jump to latest
#1Andre Lopes
lopes80andre@gmail.com

Hi,

I have created this table:

[quote]
CREATE OR REPLACE VIEW "am_newsletter_distritos" AS
select * from atm_newsletter_distritos;

CREATE OR REPLACE RULE "ins_am_newsletter_distritos" AS
ON INSERT TO "am_newsletter_distritos"
DO INSTEAD
(insert into atm_newsletter_distritos (email, id_distrito) values
(new.email, new.id_distrito));

CREATE OR REPLACE RULE "upd_am_newsletter_distritos" AS
ON DELETE TO "am_newsletter_distritos"
DO INSTEAD
(delete from atm_newsletter_distritos where email = old.email);
[/quote]

With these delete rule I can delete using on WHERE clause other field that
"email"?

Best Regards,