Re: View not dynamic

From: Graham Miller <lgmiller_at_elmrd.u-net.com>
Date: Thu, 08 Jul 1999 18:03:27 GMT
Message-ID: <3788e633.7176018_at_news.u-net.com>


Hello,

It sounds as though you don't have all the database constrainsts required to enforce your requirements.  

Also, i suggest that you always add the 'with check option' clause to any view that you will update (insert) through. This clause ensures that any rows created / modified will match the 'where' clause of the view. Otherwise it is possible to create records that you cannot retrieve.

i.e.

>CREATE view qv_degree as
> select * from degree.degree_data
> where faculty_code IN
> (select faculty from degree.degree_security
> where userid = user)

with check option;

graham

On Thu, 08 Jul 1999 17:01:32 GMT, rclow_at_my-deja.com wrote:

>I created a view based on two tables, one is the base table with the
>information, one is a security table that tells me what faculty the
>person belongs to and restricts the rows returned to that faculty. I can
>update records thru this view and see them, but it chokes when I insert
>a record thru the view. It gets added to the base table, but I can never
>see it thru the view.
>I used the following code:
>drop view qv_degree;
>CREATE view qv_degree as
> select * from degree.degree_data
> where faculty_code IN
> (select faculty from degree.degree_security
> where userid = user);
>COMMIT WORK;
>grant select on qv_degree to degree_update;
>
>Any idea why?
>grant update on qv_degree to degree_update;
>grant insert on qv_degree to degree_update;
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Received on Thu Jul 08 1999 - 20:03:27 CEST

Original text of this message