<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Down for the Count &#8211; Multiple Choice Quiz</title>
	<atom:link href="http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/feed/" rel="self" type="application/rss+xml" />
	<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/</link>
	<description>Miscellaneous Random Oracle Topics: Stop, Think, ... Understand</description>
	<lastBuildDate>Thu, 23 May 2013 04:02:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1678</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Thu, 19 Aug 2010 01:11:48 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1678</guid>
		<description><![CDATA[Martin,

Thank you for providing the code again - I was a little confused by the code (in your previous reply) that remained after Wordpress deleted the code between the less than and greater than signs.  This feature has damaged my comments a couple of times also.  &quot;&amp; l t ;&quot; without spaces will be understood as a less than sign, while &quot;&amp; g t ;&quot; without spaces will be understood as greater than.

That code is impressive.  If someone were to create the trigger with the rest of your code, every new table will automatically adopt the security policy - that is something that certainly could be forgotten.

Here is a demonstration of the fine-grain access control code in action:
[code]
SQL&gt; create table t4 as select rownum rn from dual connect by level&lt;=1000;
 
Table created.

SQL&gt; select * from t4;

        RN
----------
         1
         2
         3
...
        97
        98
        99
        RN
----------
       100
 
100 rows selected.
[/code]

A bonus side-effect is that the optimizer mode might change to FIRST_ROWS_100 when the SQL statement is excuted by a normal user, but remain unaffected when run by SYS.  The optimizer mode did not change on 11.2.0.1, but that does not mean the same results will be achieved in older release versions.

[code]
SQL&gt; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,&#039;TYPICAL&#039;));
 
SQL_ID  dvrswdm4s3tuu, child number 0
-------------------------------------
select * from t4
 
Plan hash value: 1934969519
 
----------------------------------------------------------------------------
&#124; Id  &#124; Operation           &#124; Name &#124; Rows  &#124; Bytes &#124; Cost (%CPU)&#124; Time     &#124;
----------------------------------------------------------------------------
&#124;   0 &#124; SELECT STATEMENT    &#124;      &#124;       &#124;       &#124;     2 (100)&#124;          &#124;
&#124;   1 &#124;  VIEW               &#124; T4   &#124;   100 &#124;  1300 &#124;     2   (0)&#124; 00:00:01 &#124;
&#124;*  2 &#124;   COUNT STOPKEY     &#124;      &#124;       &#124;       &#124;            &#124;          &#124;
&#124;   3 &#124;    TABLE ACCESS FULL&#124; T4   &#124;  1000 &#124; 13000 &#124;     2   (0)&#124; 00:00:01 &#124;
----------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter(ROWNUM&lt;101)
 
Note
-----
   - dynamic sampling used for this statement (level=2)
[/code]
 
[code]
SQL&gt; SELECT NAME,VALUE FROM V$SQL_OPTIMIZER_ENV WHERE SQL_ID=&#039;dvrswdm4s3tuu&#039; ORDER BY NAME;
 
NAME                                     VALUE
---------------------------------------- -------------------------
_pga_max_size                            409600 KB
active_instance_count                    1
bitmap_merge_area_size                   1048576
cell_offload_compaction                  ADAPTIVE
cell_offload_plan_display                AUTO
cell_offload_processing                  true
cpu_count                                8
cursor_sharing                           exact
db_file_multiblock_read_count            128
dst_upgrade_insert_conv                  true
hash_area_size                           131072
is_recur_flags                           0
optimizer_capture_sql_plan_baselines     false
optimizer_dynamic_sampling               2
optimizer_features_enable                11.2.0.1
optimizer_index_caching                  0
optimizer_index_cost_adj                 100
optimizer_mode                           all_rows
optimizer_secure_view_merging            true
optimizer_use_invisible_indexes          false
optimizer_use_pending_statistics         false
optimizer_use_sql_plan_baselines         true
parallel_autodop                         0
parallel_ddl_mode                        enabled
parallel_ddldml                          0
parallel_degree                          0
parallel_degree_limit                    65535
parallel_degree_policy                   manual
parallel_dml_mode                        disabled
parallel_execution_enabled               true
parallel_force_local                     false
parallel_max_degree                      16
parallel_min_time_threshold              10
parallel_query_default_dop               0
parallel_query_mode                      enabled
parallel_threads_per_cpu                 2
pga_aggregate_target                     2048000 KB
query_rewrite_enabled                    true
query_rewrite_integrity                  enforced
result_cache_mode                        MANUAL
skip_unusable_indexes                    true
sort_area_retained_size                  0
sort_area_size                           65536
star_transformation_enabled              false
statistics_level                         typical
total_cpu_count                          8
transaction_isolation_level              read_commited
workarea_size_policy                     auto
[/code]

---

I know that this was just a quick demo, but why can&#039;t I create a new user now?  :-)
Continuing immediately after creating the trigger:
[code]
Trigger created.

SQL&gt; CREATE USER TESTUSER IDENTIFIED BY CRASH;
CREATE USER TESTUSER IDENTIFIED BY CRASH
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-28103: adding a policy to an object owned by SYS is not allowed
ORA-06512: at &quot;SYS.DBMS_RLS&quot;, line 20
ORA-06512: at line 3


SQL&gt; DROP TRIGGER DDL_TRIG;

Trigger dropped.

SQL&gt; CREATE USER TESTUSER IDENTIFIED BY CRASH;

User created.
[/code]

There is a way to check the type of object that is being created, so it would be possible to make certain that the policy is only automatically applied to tables that are being created.  For those who decide to try this experiment, please make certain that you drop the trigger after the experiment ends.]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>Thank you for providing the code again &#8211; I was a little confused by the code (in your previous reply) that remained after WordPress deleted the code between the less than and greater than signs.  This feature has damaged my comments a couple of times also.  &#8220;&amp; l t ;&#8221; without spaces will be understood as a less than sign, while &#8220;&amp; g t ;&#8221; without spaces will be understood as greater than.</p>
<p>That code is impressive.  If someone were to create the trigger with the rest of your code, every new table will automatically adopt the security policy &#8211; that is something that certainly could be forgotten.</p>
<p>Here is a demonstration of the fine-grain access control code in action:</p>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; create table t4 as select rownum rn from dual connect by level&lt;=1000;
 
Table created.

SQL&gt; select * from t4;

        RN
----------
         1
         2
         3
...
        97
        98
        99
        RN
----------
       100
 
100 rows selected.
</pre>
<p>A bonus side-effect is that the optimizer mode might change to FIRST_ROWS_100 when the SQL statement is excuted by a normal user, but remain unaffected when run by SYS.  The optimizer mode did not change on 11.2.0.1, but that does not mean the same results will be achieved in older release versions.</p>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'TYPICAL'));
 
SQL_ID  dvrswdm4s3tuu, child number 0
-------------------------------------
select * from t4
 
Plan hash value: 1934969519
 
----------------------------------------------------------------------------
| Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
----------------------------------------------------------------------------
|   0 | SELECT STATEMENT    |      |       |       |     2 (100)|          |
|   1 |  VIEW               | T4   |   100 |  1300 |     2   (0)| 00:00:01 |
|*  2 |   COUNT STOPKEY     |      |       |       |            |          |
|   3 |    TABLE ACCESS FULL| T4   |  1000 | 13000 |     2   (0)| 00:00:01 |
----------------------------------------------------------------------------
 
Predicate Information (identified by operation id):
---------------------------------------------------
   2 - filter(ROWNUM&lt;101)
 
Note
-----
   - dynamic sampling used for this statement (level=2)
</pre>
<pre class="brush: plain; title: ; notranslate">
SQL&gt; SELECT NAME,VALUE FROM V$SQL_OPTIMIZER_ENV WHERE SQL_ID='dvrswdm4s3tuu' ORDER BY NAME;
 
NAME                                     VALUE
---------------------------------------- -------------------------
_pga_max_size                            409600 KB
active_instance_count                    1
bitmap_merge_area_size                   1048576
cell_offload_compaction                  ADAPTIVE
cell_offload_plan_display                AUTO
cell_offload_processing                  true
cpu_count                                8
cursor_sharing                           exact
db_file_multiblock_read_count            128
dst_upgrade_insert_conv                  true
hash_area_size                           131072
is_recur_flags                           0
optimizer_capture_sql_plan_baselines     false
optimizer_dynamic_sampling               2
optimizer_features_enable                11.2.0.1
optimizer_index_caching                  0
optimizer_index_cost_adj                 100
optimizer_mode                           all_rows
optimizer_secure_view_merging            true
optimizer_use_invisible_indexes          false
optimizer_use_pending_statistics         false
optimizer_use_sql_plan_baselines         true
parallel_autodop                         0
parallel_ddl_mode                        enabled
parallel_ddldml                          0
parallel_degree                          0
parallel_degree_limit                    65535
parallel_degree_policy                   manual
parallel_dml_mode                        disabled
parallel_execution_enabled               true
parallel_force_local                     false
parallel_max_degree                      16
parallel_min_time_threshold              10
parallel_query_default_dop               0
parallel_query_mode                      enabled
parallel_threads_per_cpu                 2
pga_aggregate_target                     2048000 KB
query_rewrite_enabled                    true
query_rewrite_integrity                  enforced
result_cache_mode                        MANUAL
skip_unusable_indexes                    true
sort_area_retained_size                  0
sort_area_size                           65536
star_transformation_enabled              false
statistics_level                         typical
total_cpu_count                          8
transaction_isolation_level              read_commited
workarea_size_policy                     auto
</pre>
<p>&#8212;</p>
<p>I know that this was just a quick demo, but why can&#8217;t I create a new user now?  <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Continuing immediately after creating the trigger:</p>
<pre class="brush: plain; title: ; notranslate">
Trigger created.

SQL&gt; CREATE USER TESTUSER IDENTIFIED BY CRASH;
CREATE USER TESTUSER IDENTIFIED BY CRASH
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-28103: adding a policy to an object owned by SYS is not allowed
ORA-06512: at &quot;SYS.DBMS_RLS&quot;, line 20
ORA-06512: at line 3


SQL&gt; DROP TRIGGER DDL_TRIG;

Trigger dropped.

SQL&gt; CREATE USER TESTUSER IDENTIFIED BY CRASH;

User created.
</pre>
<p>There is a way to check the type of object that is being created, so it would be possible to make certain that the policy is only automatically applied to tables that are being created.  For those who decide to try this experiment, please make certain that you drop the trigger after the experiment ends.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Berger</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1677</link>
		<dc:creator><![CDATA[Martin Berger]]></dc:creator>
		<pubDate>Wed, 18 Aug 2010 07:40:33 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1677</guid>
		<description><![CDATA[something went wrong during copy/paste.
there is a problem with &#039;return rownum &quot;less than&quot; 101&#039;.
here the correct code: (executed as sys before the rest of the testcase)

[code]
CREATE OR REPLACE PACKAGE my_select_package AS
FUNCTION my_select_rownum (p_schema in varchar2,
                      p_object in varchar2 ) return varchar2;
END my_select_package;
/

CREATE OR REPLACE PACKAGE BODY my_select_package AS
function my_select_rownum( p_schema in varchar2,
                                p_object in varchar2 ) return varchar2
as
PRAGMA AUTONOMOUS_TRANSACTION;
begin
return &#039; rownum &lt; 101&#039;;
end;
END my_select_package;
/

CREATE OR REPLACE TRIGGER ddl_trig
AFTER DDL
ON DATABASE
BEGIN
if ora_sysevent = &#039;CREATE&#039; THEN
  dbms_rls.add_policy
    ( object_schema   =&gt; ora_dict_obj_owner,
    object_name     =&gt; ora_dict_obj_name,
    policy_name     =&gt; &#039;MY_SELECT_TRIGGER&#039;,
    function_schema =&gt; &#039;SYS&#039;,
    policy_function =&gt; &#039;MY_SELECT_PACKAGE.MY_SELECT_ROWNUM&#039;,
    statement_types =&gt; &#039;select&#039; ,
    update_check    =&gt; FALSE );
  END IF;
END ddl_trig;
/
[/code]]]></description>
		<content:encoded><![CDATA[<p>something went wrong during copy/paste.<br />
there is a problem with &#8216;return rownum &#8220;less than&#8221; 101&#8242;.<br />
here the correct code: (executed as sys before the rest of the testcase)</p>
<pre class="brush: plain; title: ; notranslate">
CREATE OR REPLACE PACKAGE my_select_package AS
FUNCTION my_select_rownum (p_schema in varchar2,
                      p_object in varchar2 ) return varchar2;
END my_select_package;
/

CREATE OR REPLACE PACKAGE BODY my_select_package AS
function my_select_rownum( p_schema in varchar2,
                                p_object in varchar2 ) return varchar2
as
PRAGMA AUTONOMOUS_TRANSACTION;
begin
return ' rownum &lt; 101';
end;
END my_select_package;
/

CREATE OR REPLACE TRIGGER ddl_trig
AFTER DDL
ON DATABASE
BEGIN
if ora_sysevent = 'CREATE' THEN
  dbms_rls.add_policy
    ( object_schema   =&gt; ora_dict_obj_owner,
    object_name     =&gt; ora_dict_obj_name,
    policy_name     =&gt; 'MY_SELECT_TRIGGER',
    function_schema =&gt; 'SYS',
    policy_function =&gt; 'MY_SELECT_PACKAGE.MY_SELECT_ROWNUM',
    statement_types =&gt; 'select' ,
    update_check    =&gt; FALSE );
  END IF;
END ddl_trig;
/
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Berger</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1673</link>
		<dc:creator><![CDATA[Martin Berger]]></dc:creator>
		<pubDate>Tue, 17 Aug 2010 06:09:38 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1673</guid>
		<description><![CDATA[Charles,
sorry for the late reply.
I found some minutes to develop the FCA method: 

assume (for whatever reason) this package and trigger exists in the sandbox-DB where you are running the tests:

[code]
CREATE OR REPLACE PACKAGE my_select_package AS
FUNCTION my_select_rownum (p_schema in varchar2,
                      p_object in varchar2 ) return varchar2;
END my_select_package;
/
 
CREATE OR REPLACE PACKAGE BODY my_select_package AS
function my_select_rownum( p_schema in varchar2,
                                p_object in varchar2 ) return varchar2
as
begin
return &#039; rownum  ora_dict_obj_owner,
    object_name     =&gt; ora_dict_obj_name,
    policy_name     =&gt; &#039;MY_SELECT_TRIGGER&#039;,
    function_schema =&gt; &#039;SYS&#039;,
    policy_function =&gt; &#039;MY_SELECT_PACKAGE.MY_SELECT_ROWNUM&#039;,
    statement_types =&gt; &#039;select&#039; ,
    update_check    =&gt; FALSE );
  END IF;
 
END ddl_trig;
/
[/code]

with this approach you can do nearly anything. With some more logic and a status table you can even give all answers in a row, for each repeated test run. ;-)]]></description>
		<content:encoded><![CDATA[<p>Charles,<br />
sorry for the late reply.<br />
I found some minutes to develop the FCA method: </p>
<p>assume (for whatever reason) this package and trigger exists in the sandbox-DB where you are running the tests:</p>
<pre class="brush: plain; title: ; notranslate">
CREATE OR REPLACE PACKAGE my_select_package AS
FUNCTION my_select_rownum (p_schema in varchar2,
                      p_object in varchar2 ) return varchar2;
END my_select_package;
/
 
CREATE OR REPLACE PACKAGE BODY my_select_package AS
function my_select_rownum( p_schema in varchar2,
                                p_object in varchar2 ) return varchar2
as
begin
return ' rownum  ora_dict_obj_owner,
    object_name     =&gt; ora_dict_obj_name,
    policy_name     =&gt; 'MY_SELECT_TRIGGER',
    function_schema =&gt; 'SYS',
    policy_function =&gt; 'MY_SELECT_PACKAGE.MY_SELECT_ROWNUM',
    statement_types =&gt; 'select' ,
    update_check    =&gt; FALSE );
  END IF;
 
END ddl_trig;
/
</pre>
<p>with this approach you can do nearly anything. With some more logic and a status table you can even give all answers in a row, for each repeated test run. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1634</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Tue, 10 Aug 2010 11:26:57 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1634</guid>
		<description><![CDATA[I have updated the blog article to include the reasons why the potential answers were selected.  I am impressed with the different answers that were provided, and the justifications for those answers.  There were definitely some justifications that I had not considered.

How else might you obtain the &quot;wrong&quot; answers for the test question?]]></description>
		<content:encoded><![CDATA[<p>I have updated the blog article to include the reasons why the potential answers were selected.  I am impressed with the different answers that were provided, and the justifications for those answers.  There were definitely some justifications that I had not considered.</p>
<p>How else might you obtain the &#8220;wrong&#8221; answers for the test question?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flado</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1633</link>
		<dc:creator><![CDATA[Flado]]></dc:creator>
		<pubDate>Mon, 09 Aug 2010 16:58:31 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1633</guid>
		<description><![CDATA[&gt; What if… this is not an Oracle database?
Yeah, that was the first &#039;gotcha&#039; I thought about... but the select from DBA_TABLES killed that idea even before I got to connect by
Cool question, though.]]></description>
		<content:encoded><![CDATA[<p>&gt; What if… this is not an Oracle database?<br />
Yeah, that was the first &#8216;gotcha&#8217; I thought about&#8230; but the select from DBA_TABLES killed that idea even before I got to connect by<br />
Cool question, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1631</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Mon, 09 Aug 2010 09:47:01 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1631</guid>
		<description><![CDATA[Martin,

Good question regarding the goal of this quiz.  Several years ago I was state certified to teach mathematics and computer science classes.  One of the interesting parts of teaching is discovering how an answer other than the &quot;right&quot; answer was obtained by the people taking a particular test - more or less by reviewing the work of the person answering the questions it is quite possible to discover that more than one answer is correct.  

I read Cary Millsap&#039;s recent blog articles about showing one&#039;s work (the intermediate steps to the answer), heard about some of the difficulties with the  PL/SQL Challenge mentioned by Gary, and I am currently reading Tom Kyte&#039;s latest book - those were the inspirations for this blog article.  I thought that this quiz would offer a chance to stop, think, and understand how the different answers might be obtained - that 100 number is hard to obtain.  

All 3 of the sessions were connected at the start of the test script.  What are some of the items that we do not know (that were not already mentioned):
* Were the sessions connected using SQL*Plus or something like JDBC, ODBC, or ADO that automatically commits by default
* Were the sessions, if SQL*Plus was used, closed after executing each set of commands
* You and Joel mentioned serializable - do we know if the sessions were just connected to the database, or could it be possible that the sessions had just completed another experiment that left an in-process transaction in place.
* What do we know about the pre-existing database - there might be views and public synonyms hanging around.

---------------------
Edit:
The original comment was posted using a netbook with a very small screen - I must have over-looked some of Martin&#039;s response when typing the last bullet point.  The question is more or less how is it possible to obtain different answers for this particular multiple choice question.  Martin, I would like to see the answers using FGA and the other solutions that you develop.

If I had just 60 seconds to answer the question, I would try to produce an answer as clearly written as the first comment.  If I had more than 60 seconds to answer the question I would consider picking one of the other answers...

What if... this is not an Oracle database?  The CONNECT BY LEVEL syntax is probably Oracle Database specific, but what if it were not (or an equivalent syntax were used) and the database was actually SQL Server, Informix, or Sybase that commit by default after every DML statement (reference page 284 in Tom Kyte&#039;s latest book).]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>Good question regarding the goal of this quiz.  Several years ago I was state certified to teach mathematics and computer science classes.  One of the interesting parts of teaching is discovering how an answer other than the &#8220;right&#8221; answer was obtained by the people taking a particular test &#8211; more or less by reviewing the work of the person answering the questions it is quite possible to discover that more than one answer is correct.  </p>
<p>I read Cary Millsap&#8217;s recent blog articles about showing one&#8217;s work (the intermediate steps to the answer), heard about some of the difficulties with the  PL/SQL Challenge mentioned by Gary, and I am currently reading Tom Kyte&#8217;s latest book &#8211; those were the inspirations for this blog article.  I thought that this quiz would offer a chance to stop, think, and understand how the different answers might be obtained &#8211; that 100 number is hard to obtain.  </p>
<p>All 3 of the sessions were connected at the start of the test script.  What are some of the items that we do not know (that were not already mentioned):<br />
* Were the sessions connected using SQL*Plus or something like JDBC, ODBC, or ADO that automatically commits by default<br />
* Were the sessions, if SQL*Plus was used, closed after executing each set of commands<br />
* You and Joel mentioned serializable &#8211; do we know if the sessions were just connected to the database, or could it be possible that the sessions had just completed another experiment that left an in-process transaction in place.<br />
* What do we know about the pre-existing database &#8211; there might be views and public synonyms hanging around.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Edit:<br />
The original comment was posted using a netbook with a very small screen &#8211; I must have over-looked some of Martin&#8217;s response when typing the last bullet point.  The question is more or less how is it possible to obtain different answers for this particular multiple choice question.  Martin, I would like to see the answers using FGA and the other solutions that you develop.</p>
<p>If I had just 60 seconds to answer the question, I would try to produce an answer as clearly written as the first comment.  If I had more than 60 seconds to answer the question I would consider picking one of the other answers&#8230;</p>
<p>What if&#8230; this is not an Oracle database?  The CONNECT BY LEVEL syntax is probably Oracle Database specific, but what if it were not (or an equivalent syntax were used) and the database was actually SQL Server, Informix, or Sybase that commit by default after every DML statement (reference page 284 in Tom Kyte&#8217;s latest book).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Berger</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1630</link>
		<dc:creator><![CDATA[Martin Berger]]></dc:creator>
		<pubDate>Mon, 09 Aug 2010 08:32:49 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1630</guid>
		<description><![CDATA[Charles, what&#039;s your goal with this quiz? Do you want to show how useless are multiple choice questions if not all possible parameters are defined? Or do you want to get as many possible methods to create any of these numbers by additional setups not mentioned in your quiz?
I managed to get the numbers 0, 200 and 600 by playing around with the startup time of the sessions and &#039;alter session set isolation_level=serializable;&#039;. If you consider this statement directly applied before does not match the quiz rules, I&#039;d could make it with a login.sql file or a login trigger. These should match the rules.
Other methods whould be different users (the quiz only talks about sessions) and views/synonyms which can make any result possible.
As next idea I&#039;d like to play with FGAC. This could make even more possibilities!]]></description>
		<content:encoded><![CDATA[<p>Charles, what&#8217;s your goal with this quiz? Do you want to show how useless are multiple choice questions if not all possible parameters are defined? Or do you want to get as many possible methods to create any of these numbers by additional setups not mentioned in your quiz?<br />
I managed to get the numbers 0, 200 and 600 by playing around with the startup time of the sessions and &#8216;alter session set isolation_level=serializable;&#8217;. If you consider this statement directly applied before does not match the quiz rules, I&#8217;d could make it with a login.sql file or a login trigger. These should match the rules.<br />
Other methods whould be different users (the quiz only talks about sessions) and views/synonyms which can make any result possible.<br />
As next idea I&#8217;d like to play with FGAC. This could make even more possibilities!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joel garry</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1629</link>
		<dc:creator><![CDATA[joel garry]]></dc:creator>
		<pubDate>Sun, 08 Aug 2010 22:53:01 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1629</guid>
		<description><![CDATA[d. 0
b. 200

I noticed that if I didn&#039;t have all the sessions going at the start of the test, it was 0.  If I did, it was 200.  But the question seems to say all three sessions would be going at the beginning of the test.

Oooooohhh... Statement level transaction consistency, each session sees the db as of the start of its own transaction.   So that can depend on other unstated factors... like what-all you have in a global or local sql login file.

I would have answered b had I not tried it.  But I still have a nagging feeling I&#039;m forgetting about something else.]]></description>
		<content:encoded><![CDATA[<p>d. 0<br />
b. 200</p>
<p>I noticed that if I didn&#8217;t have all the sessions going at the start of the test, it was 0.  If I did, it was 200.  But the question seems to say all three sessions would be going at the beginning of the test.</p>
<p>Oooooohhh&#8230; Statement level transaction consistency, each session sees the db as of the start of its own transaction.   So that can depend on other unstated factors&#8230; like what-all you have in a global or local sql login file.</p>
<p>I would have answered b had I not tried it.  But I still have a nagging feeling I&#8217;m forgetting about something else.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1628</link>
		<dc:creator><![CDATA[Gary]]></dc:creator>
		<pubDate>Sun, 08 Aug 2010 22:47:03 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1628</guid>
		<description><![CDATA[Steven Feuerstein has been facing these with his PL/SQL Challenge. There&#039;s a bunch of assumptions that go with it (no hidden triggers etc), and he still has to do the odd &#039;fix&#039;. And no, designing the question doesn&#039;t always mean you know the answer.
IF you have done a SET AUTOCOMMIT ON in SQL*Plus then session 1 would have inserted 200 row into T1, followed by session 2 inserting another hundred. Those three hundred would have been copied to T2 twice, giving answer (A).

In 11gR2, with deferred segment creation, you can have the strange situation where you can successfully create a table (in your default tablespace) but not have any quota on it. In which case any attempt to insert will fail (when it tries to create the segment). So case (D) can be the answer. Oh, and in 8.0 (maybe 8i) the CONNECT BY LEVEL didn&#039;t work, so that would give (D) as well

Haven&#039;t worked out how to get (C) yet without some sort of constraint.

You can probably cheat with your own version]]></description>
		<content:encoded><![CDATA[<p>Steven Feuerstein has been facing these with his PL/SQL Challenge. There&#8217;s a bunch of assumptions that go with it (no hidden triggers etc), and he still has to do the odd &#8216;fix&#8217;. And no, designing the question doesn&#8217;t always mean you know the answer.<br />
IF you have done a SET AUTOCOMMIT ON in SQL*Plus then session 1 would have inserted 200 row into T1, followed by session 2 inserting another hundred. Those three hundred would have been copied to T2 twice, giving answer (A).</p>
<p>In 11gR2, with deferred segment creation, you can have the strange situation where you can successfully create a table (in your default tablespace) but not have any quota on it. In which case any attempt to insert will fail (when it tries to create the segment). So case (D) can be the answer. Oh, and in 8.0 (maybe 8i) the CONNECT BY LEVEL didn&#8217;t work, so that would give (D) as well</p>
<p>Haven&#8217;t worked out how to get (C) yet without some sort of constraint.</p>
<p>You can probably cheat with your own version</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://hoopercharles.wordpress.com/2010/08/08/down-for-the-count-multiple-choice-quiz/#comment-1627</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Sun, 08 Aug 2010 19:37:10 +0000</pubDate>
		<guid isPermaLink="false">http://hoopercharles.wordpress.com/?p=2954#comment-1627</guid>
		<description><![CDATA[Sean,

That was a very quick answer.  I will wait a couple of days before stating which answer is correct (I must have the correct answer if I designed the test question, right?).

This question seems to be very specific, yet ask yourself what the question does not state.]]></description>
		<content:encoded><![CDATA[<p>Sean,</p>
<p>That was a very quick answer.  I will wait a couple of days before stating which answer is correct (I must have the correct answer if I designed the test question, right?).</p>
<p>This question seems to be very specific, yet ask yourself what the question does not state.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
