Re: how to prevent unwanted deletion

From: srivenu <srivenu_at_hotmail.com>
Date: 27 Feb 2002 23:28:01 -0800
Message-ID: <1a68177.0202272328.570e404f_at_posting.google.com>


You can also use a view but you have to create the view with CHECK OPTION. EXAMPLE : lets say you have the following table with the following columns and data

CITIZEN

NAME           AGE
aaa             20
bbb             40
ccc             70

Now create a view v_citizen like this
CREATE VIEW v_citizen as

            SELECT *
              FROM citizen
             WHERE age<=60
              WITH CHECK OPTION;

Now you cannot insert, delete or update any rows in the CITIZEN table using the V_CITIZEN view where AGE>60
If you don't use the CHECK OPTION, you will be able to insert,update or delete rows from the CITIZEN table using the V_CITIZEN view even if the age>60 Received on Thu Feb 28 2002 - 08:28:01 CET

Original text of this message