what is 'force view'?
Answers were Sorted based on User's Feedback
Answer / m arun kumar
FORCE
The FORCE option of the CREATE VIEW statement can be used
to create the object even if one of the underlying objects
(i.e. referenced within the view) do not exist.
This can be useful if the views are created before the
underlying objects in creation scripts etc.
/* Try to create a view against a table which does not
exist */
SQL> CREATE OR REPLACE VIEW test_view
2 AS
3 SELECT * FROM non_existent_table;
SELECT * FROM non_existent_table
*
ERROR at line 3:
ORA-00942: table or view does not exist
/* Hence, the view does not exists */
SQL> SELECT * FROM test_view;
SELECT * FROM test_view
*
ERROR at line 1:
ORA-00942: table or view does not exist
/* Specifying FORCE creates the view object (albeit with
errors) */
SQL> CREATE OR REPLACE FORCE VIEW test_view
2 AS
3 SELECT * FROM non_existent_table;
Warning: View created with compilation errors.
/* Trying to SELECT from the view implies it's been created
*/
SQL> SELECT * FROM test_view;
SELECT * FROM test_view
*
ERROR at line 1:
ORA-04063: view "ORAUSER.TEST_VIEW" has errors
/* Creating the missing object then allows us to select
from it */
SQL> CREATE TABLE non_existent_table
2 (
3 a VARCHAR2(10)
4 );
Table created.
SQL> SELECT * FROM test_view;
no rows selected
| Is This Answer Correct ? | 19 Yes | 1 No |
Answer / suresh
the view can be created without base table then the view is
called force view. the view must be crated with force option.
| Is This Answer Correct ? | 16 Yes | 0 No |
Answer / dinesh kumar
Force View creates view even if the base table is not
available.
| Is This Answer Correct ? | 4 Yes | 0 No |
What is the difference between a subquery and a join?
how many tupples can insert in 1 second in sql
What is the left table in sql?
What are stored procedures in mysql?
How to revise and re-run the last sql command?
State the advatage and disadvantage of Cursor's?
What does where 1 1 mean in sql?
From an Employee table, how will you display the record which has a maximum salary?
29 Answers Cap Gemini, Exilant, Synechron,
Which tcp/ip port does sql server run?
what are pl/sql collections?
4 Answers JPMorgan Chase, Oracle,
How can I pass the inner procedure value to outer procedure ?
what are the different type of sql's statements ? : Sql dba
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)