Wednesday 4 September 2019

SQL Interview Questions Part -4

Assume there is view with name as EMP_V so what are all the objects can be created with same Name.


Below are the objects which we can't create with existed object Name.


  1.   create or replace synonym emp_v for emp  --Not allowed
  2.  create table emp_v (id integer); --Not Allowed
  3.  create materialized view emp_v  as select * from emp; --Not Allowed
  4.   create sequence emp_v --Not Allowed
  5. CREATE OR REPLACE PACKAGE EMP_V IS PROCEDURE P1; END;   --Not Allowed
  6. CREATE OR REPLACE PROCEDURE EMP_V IS BEGIN   NULL; END;  -- Not Allowed


Below are the objects which we can create with existed object Name.
  1. create or replace public synonym emp_v for emp  --allowed
  2. create index emp_v on emp(mgr); --Allowed