Monday, August 16, 2010
Oracle 11g: Clauses For View
===>SQL Queries: WITH CHECK OPTION[make sure that the DML operations performed stay in the domain of the view]
create or replace view empvu20
as
select *
from employees
where department_id = 20
WITH CHECK OPTION CONSTRAINT empvu20_ck;
select * from empvu20;
Results :
create or replace view succeeded.
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------------------- -------------------- --------------------
201 Michael Hartstein MHARTSTE 888.122 17-FEB-96 MK_MAN 3000 100 20
202 Pat Fay PFAY 603.123 17-AUG-97 MK_REP 6000 201 20
===>SQL Queries: WITH READ ONLY[No DML Operation can be done through the view.]
create or replace view empvu10
(employee_number,employee_name,job_title)
as
select employee_id,
last_name,
job_id
from employees
where department_id = 10
WITH READ ONLY;
SELECT * FROM empvu10;
Results:
create or replace view succeeded.
EMPLOYEE_NUMBER EMPLOYEE_NAME JOB_TITLE
---------------------- ------------------------- ----------
200 Whalen AD_ASST
1 rows selected
create or replace view empvu20
as
select *
from employees
where department_id = 20
WITH CHECK OPTION CONSTRAINT empvu20_ck;
select * from empvu20;
Results :
create or replace view succeeded.
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
---------------------- -------------------- --------------------
201 Michael Hartstein MHARTSTE 888.122 17-FEB-96 MK_MAN 3000 100 20
202 Pat Fay PFAY 603.123 17-AUG-97 MK_REP 6000 201 20
===>SQL Queries: WITH READ ONLY[No DML Operation can be done through the view.]
create or replace view empvu10
(employee_number,employee_name,job_title)
as
select employee_id,
last_name,
job_id
from employees
where department_id = 10
WITH READ ONLY;
SELECT * FROM empvu10;
Results:
create or replace view succeeded.
EMPLOYEE_NUMBER EMPLOYEE_NAME JOB_TITLE
---------------------- ------------------------- ----------
200 Whalen AD_ASST
1 rows selected
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment