Tuesday, March 06, 2007

PLSQL:Can we CREATE a VIEW FROM a non-existed TABLE?

Yes.BY FORCE VIEW.

CREATE VIEW tmp_view AS SELECT * FROM empwer
--ORA-00942: table or view does not exist ( as empwer table does not exist )
CREATE FORCE VIEW tmp_view AS SELECT * FROM empwer
--Create view, executed in 0.375 sec. ( Force view created )
SELECT * FROM tmp_view
--ORA-04063: view "SCOTT.TMP_VIEW" has errors ( As there is no underlying table )
CREATE TABLE empwer AS SELECT * FROM emp
--CREATE TABLE empwer AS SELECT * FROM emp ( Underlying table created )
SELECT * FROM tmp_view
--Results Coming ( Now data is coming through view )

-----CleanUp-------
DROP TABLE empwer
DROP VIEW tmp_emp

---: I am not responsible for any damages happened from the suggestion of my blog :---
Reach me at : m.a.hasim@inbox.com

Labels:

0 Comments:

Post a Comment

<< Home