Home » SQL & PL/SQL » SQL & PL/SQL » Does force view option works in oracle 11g? (oracle 11G)
Does force view option works in oracle 11g? [message #471304] Fri, 13 August 2010 04:50 Go to next message
harinixyz
Messages: 1
Registered: August 2010
Junior Member
when i am trying to excute below query.. it says ORA-00942: table or view does not exist.

create or replace force view v2 as
select * from employee;
Re: Does force view option works in oracle 11g? [message #471305 is a reply to message #471304] Fri, 13 August 2010 04:55 Go to previous messageGo to next message
Littlefoot
Messages: 21826
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Table EMPLOYEE is not available to user that is trying to create a view. Owner should grant certain privileges to you.

[Updated on: Fri, 13 August 2010 04:55]

Report message to a moderator

Re: Does force view option works in oracle 11g? [message #471307 is a reply to message #471305] Fri, 13 August 2010 05:00 Go to previous messageGo to next message
cookiemonster
Messages: 13967
Registered: September 2008
Location: Rainy Manchester
Senior Member
LF - that shouldn't matter with force, that's the whole point.
Sounds like oracle bug - have a look on my oracle support.
Re: Does force view option works in oracle 11g? [message #471308 is a reply to message #471307] Fri, 13 August 2010 05:04 Go to previous messageGo to next message
Its_me_ved
Messages: 979
Registered: October 2009
Location: India
Senior Member
If I am not wrong, with FORCE option you can create a view if base table does not exist.

Regards
Ved
Re: Does force view option works in oracle 11g? [message #471309 is a reply to message #471308] Fri, 13 August 2010 05:08 Go to previous messageGo to next message
cookiemonster
Messages: 13967
Registered: September 2008
Location: Rainy Manchester
Senior Member
You're not wrong.
It works on my 11g instance:
SQL*Plus: Release 11.1.0.7.0 - Production on Fri Aug 13 11:06:06 2010

Copyright (c) 1982, 2008, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.1.0.7.0 - 64bit Production

SQL> create or replace force view testview
  2  as select * from none_existant_table;

Warning: View created with compilation errors.

SQL>


@harinixyz - what exact version of 11g are you using?

It must be an oracle bug though.
Re: Does force view option works in oracle 11g? [message #471310 is a reply to message #471307] Fri, 13 August 2010 05:08 Go to previous messageGo to next message
ashoka_bl
Messages: 398
Registered: November 2006
Location: Bangalore
Senior Member

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
"CORE	11.2.0.1.0	Production"
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production


I am able to create the view, but When I give a Select It would fail

SQL> create or replace force view check123 as select * from checks;

Warning: View created with compilation errors.

SQL> show errors;
No errors.
SQL> select * from check123;
select * from check123
              *
ERROR at line 1:
ORA-04063: view "PATOJUV_RMS01.CHECK123" has errors


SQL> select * from v$version;

BANNER
-------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

SQL> 


It worked....
Re: Does force view option works in oracle 11g? [message #471314 is a reply to message #471310] Fri, 13 August 2010 05:19 Go to previous messageGo to next message
Its_me_ved
Messages: 979
Registered: October 2009
Location: India
Senior Member
Though the view was created it was marked as invalid. So you cant access unless the table is created.

You can check the status in USER_OBJECTS.

Also, want to add that to create a view you need to have the sufficient privilege

Oracle documentation says:
Quote:

FORCE

Specify FORCE if you want to create the view regardless of whether the base tables of the view 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.



Regards
Ved

[Updated on: Fri, 13 August 2010 05:30]

Report message to a moderator

Re: Does force view option works in oracle 11g? [message #471328 is a reply to message #471314] Fri, 13 August 2010 07:23 Go to previous messageGo to next message
ashoka_bl
Messages: 398
Registered: November 2006
Location: Bangalore
Senior Member

@harinixyz , Could you let us know whether you able to execute the View ?
Re: Does force view option works in oracle 11g? [message #471329 is a reply to message #471328] Fri, 13 August 2010 07:26 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
ashoka_bl wrote on Fri, 13 August 2010 14:23
@harinixyz , Could you let us know whether you able to execute the View ?

That's what you get when everyone sends in similar bits of code..
The original post shows very clearly what (s)he tried. (and what does "executing" a view mean?!)
Re: Does force view option works in oracle 11g? [message #471352 is a reply to message #471329] Fri, 13 August 2010 10:32 Go to previous messageGo to next message
Michel Cadot
Messages: 68767
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
The original post shows very clearly what (s)he tried. (and what does "executing" a view mean?!)

Not entirely, "is there any synonym (private or public) for employee?" is one question I ask myself.
"What is the complete Oracle version?" is another one.

Regards
Michel

Re: Does force view option works in oracle 11g? [message #471429 is a reply to message #471352] Sat, 14 August 2010 08:03 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Michel Cadot wrote on Fri, 13 August 2010 17:32
Quote:
The original post shows very clearly what (s)he tried. (and what does "executing" a view mean?!)

Not entirely, "is there any synonym (private or public) for employee?" is one question I ask myself.
"What is the complete Oracle version?" is another one.

... which has nothing to do with showing what the Original Poster tried. My comment to ashoka_bl's reply still stands.
Re: Does force view option works in oracle 11g? [message #471441 is a reply to message #471429] Sat, 14 August 2010 10:40 Go to previous message
Michel Cadot
Messages: 68767
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Well, having a synonym may (or not) give a different error message than not having a table with this name in his schema, this is what I meant.

Regards
Michel
Previous Topic: combine sql output in one row
Next Topic: Parttition on existed table
Goto Forum:
  


Current Time: Fri Aug 22 23:25:56 CDT 2025