Home » RDBMS Server » Performance Tuning » forced view
forced view [message #122543] Tue, 07 June 2005 03:49 Go to next message
ramvenky
Messages: 5
Registered: May 2005
Junior Member
I had an interview last week.The Interviewer asked what is forced view.but I don't know what it is?.Please tell about forced view
Re: forced view [message #122546 is a reply to message #122543] Tue, 07 June 2005 03:59 Go to previous messageGo to next message
girish.rohini
Messages: 744
Registered: April 2005
Location: Delhi (India)
Senior Member
Force is a keyword. It Forces The Creation Of A View Even When The View Will Be Invalid. NoForce Is The Default

eg: -- assuming the table xyz does not exist

CREATE FORCE VIEW view_force AS
SELECT * FROM xyz;

Its a feature in 10g
Re: forced view [message #122629 is a reply to message #122543] Tue, 07 June 2005 12:15 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Quote:

Its a feature in 10g

and below. I think it even was there in 7.3

hth
Re: forced view [message #122632 is a reply to message #122543] Tue, 07 June 2005 12:24 Go to previous messageGo to next message
smartin
Messages: 1803
Registered: March 2005
Location: Jacksonville, Florida
Senior Member
It has always seemed a tad strange to me that you have to force the creation of a view, if that view will be invalid, yet you don't have to force the creation of a procedure.
Re: forced view [message #122684 is a reply to message #122543] Wed, 08 June 2005 00:20 Go to previous message
nabeelkhan
Messages: 73
Registered: May 2005
Location: Kuwait
Member

Work's in 9iR2 and 10gR1

use FORCE if you want to create the view regardless of whether the view's base tables or the referenced object types exist or the owner of the schema containing the view has privileges on them.

These conditions must be true before any SELECT, INSERT, UPDATE, or DELETE statements can be issued against the view

If the view definition contains any constraints, CREATE VIEW ... FORCE will fail if the base table does not exist or the referenced object type does not exist. CREATE VIEW ... FORCE will also fail if the view definition names a constraint that does not exist. (Enhencements on 10g)

scott@9ir2>select * from v$version;

BANNER                                                                          
----------------------------------------------------------------                
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production                      
PL/SQL Release 9.2.0.1.0 - Production                                           
CORE	9.2.0.1.0	Production                                                       
TNS for Compaq Tru64 UNIX: Version 9.2.0.1.0 - Production                       
NLSRTL Version 9.2.0.1.0 - Production                                           

scott@9ir2>desc xyz
ERROR:
ORA-04043: object xyz does not exist 


scott@9ir2>CREATE FORCE VIEW view_force AS SELECT * FROM xyz;

Warning: View created with compilation errors.

scott@9ir2>select VIEW_NAME, TEXT from user_views where VIEW_NAME = 'VIEW_FORCE';

VIEW_NAME                                                                       
------------------------------                                                  
TEXT                                                                            
--------------------------------------------------------------------------------
VIEW_FORCE                                                                      
SELECT * FROM xyz                                                               
                                                                                

scott@9ir2>select * from view_force;
select * from view_force
              *
ERROR at line 1:
ORA-04063: view "SCOTT.VIEW_FORCE" has errors 


scott@9ir2>drop view view_force;

View dropped.

scott@9ir2>select VIEW_NAME, TEXT from user_views where VIEW_NAME = 'VIEW_FORCE';

no rows selected
Previous Topic: URGENT:-Performance Tuning.
Next Topic: select large amount of data
Goto Forum:
  


Current Time: Fri Sep 25 02:31:11 CDT 2020