Sep 4
Sep 4
desc v1;
select count (*) from test; create or replace view v1 as select * from test;
desc v1;
desc v1;
-----------------------
=============================================================================
drop table test;
create table test as select * from employees;
OBJECT_NAME
--------------------------------------------------------------------------------
STATUS
-------
V1
INVALID
--simple
--complex
simple view is made from a single table and dml operations can be performed through
view.
complex view is made from single or multiple table and dml operations cant be
performed through view directly
example:
given
create view v1 as
select * from employees where salary> (select salary from employees where
last_name='x');--complex view
====================================================================
Q: what is force view?
you want to create a view before your table
drop view v1;
drop table test;
desc test
create view v1 as select * from test;--error
create force view v1 as select * from test;--should create with compilation error
desc v1 --invalid
select obejct_name,status from user_objects
where object_type='VIEW' and object_name like '%V1%';
create table test as select * from employees;
desc v1 --valid
=========================================================================
if we use force keyword we can also create empty view. and then we can update the
views with data. Without force we cannot create empty view. Is it correct mam?
we can create empty view but it cant be used until you create the related table
in case its your project requirement so being a programmer u have option to create
a force view later when table will be created , it would automatically associate
with it�
Trim function eliminates beginning and ending matched charcaters from the given
string.�select 'Hi'||' � This is demo class � '||'Goodday'from dual;�
result: Hi � This is demo class Goodday�select 'Hi'||trim(' ' from ' � This is demo
class � ')||'Goodday'from dual��result: HiThis is demo classGoodday�note:�
trim is used to eliminate the given character from begin and end of the
string��select 'Hi'||trim('s' from 'ss � ss � This is demo class � sssss
s')||'Goodday'from dual�
select 'Hi'||trim('s' from 'ss ��ss ��This is demo class ��sssss s')||'Goodday'
from dual