Answer Posted / 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 |
Post New Answer View All Answers
What is the difference between a primary key and a unique key?
How can we debug in PL/SQL?
How many developers work on postgresql?
i have a column which may contain this kind of value: 123*67_80,12*8889_5,34*8_874 ,12*7_7 (can contain space before a comma, and this string length can be anything) now i want to split this value into two column like: column1: 123*67,12*8889,34*8,12*7 column2: 80,5,874,7 use function for this
Explain sql data types?
What is output spooling in sql*plus?
Is trigger a stored procedure?
who introduced sql?
what does it mean to have quoted_identifier on? What are the implications of having it off? : Sql dba
Which one is better subquery or joins?
Explain the purpose of %type and %rowtype data types?
How to sort the rows in sql.
explain commit and rollback in mysql : sql dba
How do I run a program in pl sql?
What is gpt format?