Home » RDBMS Server » Server Administration » Query/Insert in a view
Query/Insert in a view [message #371691] Sun, 26 November 2000 23:40 Go to next message
sunil gupta
Messages: 11
Registered: September 2000
Junior Member
Can anybody help me with this :
Lets say I create a view v_emp as select * from emp where deptno >10. Then while querying I get only records where deptno is greater than 10 but at the same time I can insert in view records having deptno equal to 10. So how do I prevent users from inserting record with deptno=10.

thanx in advance.
Sunil
Re: Query/Insert in a view [message #371692 is a reply to message #371691] Mon, 27 November 2000 04:05 Go to previous message
Prem
Messages: 79
Registered: August 1998
Member
sunil,

Use the WITH CHECK OPTION in the create view statement. Your view statement should look like

create view v_emp as
select * from emp where deptno >10
WITH CHECK OPTION;

This will prevent the user from entering a record for department 10. Oracle will return an error 01402 when this is attempted.

hth

Prem :)
Previous Topic: Collection to ref cursor
Next Topic: How to store date and time?
Goto Forum:
  


Current Time: Sun Dec 22 16:47:14 CST 2024