Evaluate the following SQL statement:
ALTER TABLE hr.emp SET UNUSED (mgr_id);
Which statement is true regarding the effect of the above SQL statement?
A.
Any synonym existing on the EMP table would have to be re-created.
B.
Any constraints defined on the MGR_ID column would be removed by the above command.
C.
Any views created on the EMP table that include the MGR_ID column would have to be dropped and re-created.
D.
Any index created on the MGR_ID column would continue to exist until the DROP UNUSED COLUMNS command is executed.
why is c wrong?
create table tst( s1 number, s2 number);
create view vtst as select s1, s2 from tst;
alter table tst set unused(s1);
select * from vtst;
–ORA-04063: view “OE.VTST” has errors
C.Any views created on the EMP table that include the MGR_ID column would have to be dropped and re-created.
there is no point of drop and recreate the view.we can just
create or replace view vtst as select s2 from tst;
(ignoring unused column)
complementation for studies !!
“would have been discarded and recreated” <= this is not true
Just recreate the "VIEW" it is not necessary to drop.
create table sally as select * from emp;
create or replace view vw1 as select sal, job from sally;
alter table sally set unused (job);
When a column is SET UNUSED it is no longer recovered. But only occupy space and could later be dropped using ALTER TABLE table_name DROP UNUSED COLUMNS;
Correct answer is
B
http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables006.htm#ADMIN11663
Marking Columns Unused
All constraints, indexes, and statistics defined on the column are also removed.
complementation for studies !!
“would have been discarded and recreated” <= this is not true
Just recreate the "VIEW" it is not necessary to drop.