Read Inconsistency?
Riddle me this: Can an object exist in all_objects before it is created?
Well no, of course not.
I was under the assumption that if you create a table with a select-statement, a CTAS – Create Table As Select – that the select was executed prior to the creation of the table. Read Consistency dictates that the result set returned by a Select statement, returns the values as of that particular moment in time.
To demonstrate this Tom Kyte has an example similar to this:
SQL> var rc refcursor<br />SQL> create table t<br /> 2 as<br /> 3 select *<br /> 4 from dual<br /> 5 /<br /><br />Table created.<br /><br />SQL> exec open :rc for select * from t<br /><br />PL/SQL procedure successfully completed.<br /><br />SQL> delete from t<br /> 2 /<br /><br />1 row deleted.<br /><br />SQL> commit<br /> 2 /<br /><br />Commit complete.<br /><br />SQL> print<br /><br />D<br />-<br />X<br /><br />SQL><br />
The shortest possible script to demonstrate Read Consistency. The result you see after the Delete followed by a Commit, are returned by the Ref Cursor, which was executed prior to the delete.
Odd or at least Remarkable?
Isn’t this odd then?
SQL> drop table t purge<br /> 2 /<br /><br />Table dropped.<br /><br />SQL> select owner, object_name<br /> 2 from all_objects<br /> 3 where owner = 'ALEX'<br /> 4 and object_name = 'T'<br /> 5 /<br /><br />no rows selected<br /><br />SQL> create table t<br /> 2 as<br /> 3 select *<br /> 4 from all_objects<br /> 5 /<br /><br />Table created.<br /><br />SQL> select owner, object_name<br /> 2 from t<br /> 3 where owner = 'ALEX'<br /> 4 and object_name = 'T'<br /> 5 /<br /><br />OWNER OBJECT_NAME<br />------------------------------ -----------<br />ALEX T<br /><br />SQL><br />
How is it possible that an entry is alread present in the newly created Table T, which should be a copy of ALL_OBJECTS? Apparently, when you create a table, an entry in the datadictionary is created prior to executing the Select-statement…. strange, don’t you think?
That goes to show it, the datadictionary is "special".
Dear Sunil,
I took the liberty of removing your phone numbers from the blog for privacy matters.
To answer your question I do not know what GUI is used with Oracle 11i. Maybe this blog helps to answer your question: http://technology.amis.nl/blog/?p=169
Alex