Force View

What is Force View. Why Oracle Give Facility to create force view? What is the use of force View

Questions by nitin_kumat   answers by nitin_kumat

Showing Answers 1 - 9 of 9 Answers

DevPro

  • Mar 26th, 2007
 


Force View does forces the creation of a View even when the View will be invalid. NoForce Is the default.


Code
  1.  

  2.         CREATE FORCE VIEW

  3.         <view_name>

  4.                 AS

  5.                 <select statement>

  6.                         ;

  7.                         //-- assuming the table xyz does not exist

  8.  

  9.         CREATE FORCE VIEW view_force AS

  10.         SELECT * FROM xyz;

  11.         -- ignore the error message

  12.         col object_name format a30

  13.         SELECT object_name, STATUS

  14.         FROM user_objects

  15.         WHERE object_type = 'VIEW';

  16.  

A view can be created even if the defining query of the view cannot be executed, as long as the CREATE VIEW command has no syntax errors. We call such a view a view with errors. For example, if a view refers to a non-existent table or an invalid column of an existing table, or if the owner of the view does not have the required privileges, then the view can still be created and entered into the data dictionary. You can only create a view with errors by using the FORCE option of the CREATE VIEW command: CREATE FORCE VIEW AS ...;When a view is created with errors, Oracle returns a message and leaves the status of the view as INVALID. If conditions later change so that the query of an invalid view can be executed, then the view can be recompiled and become valid. Oracle dynamically compiles the invalid view if you attempt to use it

Radha

  • Jul 14th, 2011
 

Force view: This view is created for the table which is not there in the database.
we an create it as
create force view as select statement......;
Here the view will be valid when we create it. But we can't call the view until we create that table in
the database...

  Was this answer useful?  Yes

sanjay

  • Sep 27th, 2011
 

Force keyword is used to create a view even if table does not exists.

Code
  1. SQL> CREATE OR REPLACE force VIEW forceview

  2.   2  AS

  3.   3  SELECT * FROM table1

  4.   4  ;

  5.  

  6. Warning: VIEW created WITH compilation errors.

  7.  

  Was this answer useful?  Yes

mohan

  • Oct 14th, 2011
 

If we create a view without having base table, that view called as forced view. it will create with compile error. it will be in invalid till base table create.

  Was this answer useful?  Yes

sonam kanungo

  • Oct 14th, 2011
 

As per my knowledge when view is created without base table.then the view is called as forced view.

in this type of view is created with compilation error.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions