30 June 2012

PL/SQL Challenge at Kscope12

I returned a few days ago from ODTUG's annual Kscope (formerly Kaleidoscope) conference, this year in hot, hot San Antonio, but located at the very comfortable and luxurious JW Marriott resort.

At the suggestion of Mike Brunstedt, one of our fabulous PL/SQL quiz reviewers, I made up a PL/SQL Challenger ribbon so that players and friends of the site could proudly proclaim their Challenger-ness:



We will also be giving them out at Oracle Open World in the Fall, so there's another reason to attend Larry's outsized celebration of all things Oracle.

It was great to meet players of the PL/SQL Challenge, and hear about how playing the quizzes has helped them in their work. It was even more of a pleasure to meet up with some of the reviewers who ensure the high quality of quizzes we play on the site:


From left to right: Michael Brunstedt, Patrick Barel, Steven Feuerstein, Kim Berg Hansen

The PL/SQL Challenge wouldn't exist at all without the initial support and ongoing efforts by my Application Express expert friends at Apex Evangelists, so I demanded that they also join me for a photo:


From left to right: Dimitri Gielis, John Scott, Steven Feuerstein, Paul Broughton

Kscope12 was the usual fantastic conference, organized oh-so-well by Kathleen McCasland and her posse of capable women from Your Conference Connection, led by a friendly, enthusiastic board of directors.

Hope to see you there next year!

22 June 2012

PL/SQL Bug Confirmed from 20 June Quiz

The 20th June quiz tested your knowledge of how to remove "gaps" from a sparse array (make it dense). Daniel Kennedy posted an objection to the scoring, saying that if you use a NULL value for the index value in the collection, then none of the choices are correct.

This was a big surprise to many of us, who have long seen in our code that the idex value in an integer-indexed array cannot be NULL. Well....after checking with Bryn Llewellyn, Oracle PL/SQL Product Manager, I confirmed that this was a bug - and one that had not yet been reported!

So Bryn filed a bug report (1422744) with the explanation and code shown below.

Many aspects of the PL/SQL Challenge make me proud (the large number of players, their dedication, the growing body of knowledge about PL/SQL accessible in formats never available before, and so on). But when we identify bugs in the language or fixes required in the documentation, then I feel even more strongly how much the PL/SQL language can benefit from an active, engaged community.

Thanks, Daniel, for identifying this bug and for playing the PL/SQL Challenge.

Steven Feuerstein

v(null) := 42 succeeds when v is an IBBI – and brings Heisenberg exception handling 
(from Bryn Llewellyn)

The testcase is copied below. Run it as any user with at least Create Session and Create Procedure.

The behavior of the varray and nested table tests is exactly as expected. Without the exception handling code, ORA-06502 is reported with a ORA-06512 for Line 9. And with the exception handling code, ORA-06502 is caught and nicely reported, and the program completes with no unhandled error.

However, IBBI_Test_1 runs without error and prints out 42. This is clearly a bug. Null is not a value. Rather, it's an indicator that expresses that the value is unknown.

Now it gets worse. IBBI_Test_2 simply adds the identical exception handler code for ORA-06502 around [v(null) := 42;] that Varray_Test_2 and Nested_Table_Test_2 use. But at run-time, we get this:
 
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: NULL index table key value
ORA-06512: at "USR.IBBI_TEST_2", line 13
ORA-06512: at line 1

And finally, it gets worse still. IBBI_Test_3 adds more exception handling code. This time around [a := v(null);]. At run time, ORA-06502 is now obligingly caught at both [ v(null) := 42; ] and [ a := v(null); ].

------ Testcase ------
 
alter session set Plsql_Warnings = 'Enable:All'
/
 
create procedure Varray_Test_1 authid Definer is
  type t is varray(10) of pls_integer;
  v t;
  a pls_integer;
  n pls_integer;
  -- PL/SQL: numeric or value error: NULL index table key value
  ORA_06502 exception; pragma Exception_Init(ORA_06502, -06502);
begin
  v(null) := 42; -- Line 9
end Varray_Test_1;
/
begin Varray_Test_1(); end;
/
 
create procedure Varray_Test_2 authid Definer is
  type t is table of pls_integer;
  v t;
  a pls_integer;
  n pls_integer;
  -- PL/SQL: numeric or value error: NULL index table key value
  ORA_06502 exception; pragma Exception_Init(ORA_06502, -06502);
begin
  begin
    v(null) := 42;
  exception when ORA_06502 then
    DBMS_Output.Put_Line('ORA-06502 on "v(null) := 42"');
  end;
end Varray_Test_2;
/
begin Varray_Test_2(); end;
/
 
create procedure Nested_Table_Test_1 authid Definer is
  type t is table of pls_integer;
  v t;
  a pls_integer;
  n pls_integer;
  -- PL/SQL: numeric or value error: NULL index table key value
  ORA_06502 exception; pragma Exception_Init(ORA_06502, -06502);
begin
  v(null) := 42; -- Line 9
end Nested_Table_Test_1;
/
begin Nested_Table_Test_1(); end;
/
 
create procedure Nested_Table_Test_2 authid Definer is
  type t is table of pls_integer;
  v t;
  a pls_integer;
  n pls_integer;
  -- PL/SQL: numeric or value error: NULL index table key value
  ORA_06502 exception; pragma Exception_Init(ORA_06502, -06502);
begin
  begin
    v(null) := 42;
  exception when ORA_06502 then
    DBMS_Output.Put_Line('ORA-06502 on "v(null) := 42"');
  end;
end Nested_Table_Test_2;
/
begin Nested_Table_Test_2(); end;
/
 
create procedure IBBI_Test_1 authid Definer is
  type t is table of pls_integer index by pls_integer;
  v t;
  a pls_integer;
  n pls_integer;
begin
  v(null) := 42;
  a := v(null);
  DBMS_Output.Put_Line(a);
end IBBI_Test_1;
/
begin IBBI_Test_1(); end;
/
 
create procedure IBBI_Test_2 authid Definer is
  type t is table of pls_integer index by pls_integer;
  v t;
  a pls_integer;
  n pls_integer;
  -- PL/SQL: numeric or value error: NULL index table key value
  ORA_06502 exception; pragma Exception_Init(ORA_06502, -06502);
begin
  begin
    v(null) := 42;
  exception when ORA_06502 then
    DBMS_Output.Put_Line(q'{ORA_06502 on "v(null) := 42"}');
  end; -- Line 13
  a := v(null);
  DBMS_Output.Put_Line(a);
end IBBI_Test_2;
/
begin IBBI_Test_2(); end;
/
 
create procedure IBBI_Test_3 authid Definer is
  type t is table of pls_integer index by pls_integer;
  v t;
  a pls_integer;
  n pls_integer;
  -- PL/SQL: numeric or value error: NULL index table key value
  ORA_06502 exception; pragma Exception_Init(ORA_06502, -06502);
begin
  begin
    v(null) := 42;
  exception when ORA_06502 then
    DBMS_Output.Put_Line(q'{ORA_06502 on "v(null) := 42"}');
  end;
  begin
    a := v(null);
  exception when ORA_06502 then
    DBMS_Output.Put_Line(q'{ORA_06502 on "a := v(null)"}');
  end;
  DBMS_Output.Put_Line(a);
end IBBI_Test_3;
/
begin IBBI_Test_3(); end;
/

19 June 2012

Big Mistake by Steven, No Quiz on Monday (for Many)

Dear PL/SQL Challenge Players,

I made a very big mistake today, and the result is that many of you could not play Monday's quiz.

I switched to maintenance mode at 15:00 to fix a bug, but then neglected to return to normal mode of play.

Then, seeing as I am in Taos, NM, I left the world of computers behind for Bandelier National Monument, an amazing place....but as a result, I did not notice that so many of you were notifying me of a problem with the site.

My deepest apologies. We will have to void the results for Monday's quiz.

I will change the site so that maintenance mode is always turned off after a period of time, so that if I happen to forget again, the site will correct itself.

Steven Feuerstein

15 June 2012

Gee Thanks, Amazon

Sure, Amazon Web Services are generally amazing and wonderful.

Except when they are not.

As you can read here, "parts of Amazon Web Services (AWS) suffered an outage on Thursday which led to a spread of high-profile sites clocking off the Web for the evening." Like the PL/SQL Challenge.

And 10 hours later, the PL/SAL Challenge site is still not available.

As a result, today's quiz will not be included in rankings for the quarterly championship.

My apologies to all players....

Steven Feuerstein

04 June 2012

Over 500,000 Answers Submitted on the PL/SQL Challenge!

Over the weekend of 2 June, we reached a major milestone on the PL/SQL Challenge: the 500,000th answer to a quiz was submitted!

Altogether, a total of 9,503 players from 120 countries have submitted (at the time of writing this post) 501,623 answers to quizzes. They used a total of 5770 days' time to decide on their choices and submit the answers.

Of course, the vast majority of those answers were submitted by a much smaller "core group" of Oracle technologists who play the daily PL/SQL quiz each day, or close to it.

Which means it's time for the Dedicated Players Roll Call. You will find below the list of all players who have missed no more than 50 daily PL/SQL quizzes out of the 559 that have been played since 8 April 2010. Now, that's dedication!

Dedicated Players Roll Call

PLAYER TAKEN MISSED
Martin_Scholz_Berlin_Berlin
558
1
Patrick Barel
558
1
poelger
555
4
John Hall
553
6
Rohan Gray
552
7
DaveStadt-wbt
550
9
Ralf Koelling
549
10
Niels Hecker
548
11
Sterol Andro
547
12
Sean Molloy
547
12
Mike Pargeter
543
16
Anatoliy Kanivets
542
17
Zoltán Pásztor
541
18
João Barreto
540
19
Cliff Nadler
540
19
Scott Wesley
539
20
Frank Schrader
538
21
Jeroen Rutte
537
22
emha
535
24
VictorD
533
26
Marc Thompson
533
26
Otto Palenicek
533
26
Martin Mierke
531
28
Jim Schmitz
531
28
Alexander Koblov
530
29
Kevin Bentley
530
29
Rich Dellheim
529
30
Ronald Sönksen
529
30
Justin Cave
529
30
Henry Abeska
528
31
Janis Baiza
528
31
EdgarsP
527
32
Natarajan-wbt
522
37
Wolfgang Habermann
521
38
Michal Cvan
521
38
Markus Zuser
521
38
Marcus Matzberger
520
39
Hellmaster
520
39
Ivan Blanarik
519
40
Thierry Poels
519
40
CLW-wbt
517
42
Chad Lee
516
43
Naresh Kumar
515
44
Jeff Kemp
514
45
David Codl
514
45
William (Yi) Zhu
512
47
Bartek Goldman
511
48
Jens Petersen
511
48
Oliver Dimalanta
511
48
Jeyhun Gasimov
510
49
GabrieleR
510
49
Rob van den Berg
510
49
Radoslav Golian
510
49
Xavier Descamps
510
49
Geert Guldentops
510
49
Wim de Lange
509
50
Milan Vontorcik
509
50

30 May 2012

Q1 2012 Championship Playoff Results

You will find below the rankings for the Q1 2012 playoff; the number next to the player's name is the number of times that player has participated in a playoff. Congratulations first and foremost to our top-ranked players:

1st Place: Chad Lee, United States, wins an Amazon.com US$250 Gift Card.
2nd Place: Niels Hecker, Germany, wins an Amazon.com US$175 Gift Card.
3rd Place: Ivan Blanarik, Slovakia, wins an Amazon.com US$100 Gift Card.

Chad has participated in four playoffs, but this is his first time in the top 3. Nice work, Chad!

This was Ivan's first playoff - an excellent showing for a first-time player!

Niels has participated in seven playoffs. He took top honors in the Q3 2010 playoff and took second place in the Q2 2010 playoff. That is a very impressive track record.

As you can see, the highest % correct is 87. This was a tough competition and in the end the time to answer became the differentiator. Would you like to try it for yourself? Then set up a practice based on the competition and see how you do!

Congratulations to everyone who played in the playoff. I hope you found it entertaining, challenging and educational.

Steven Feuerstein

Rank Name Country Total Time % Correct Total Score
1Chad Lee (4)United States19 mins 59 secs87%2865
2Niels Hecker (7)Germany24 mins 21 secs87%2813
3Ivan Blanarik (1)Slovakia25 mins 18 secs87%2794
4kowido (5)No Country Set18 mins 08 secs83%2787
5Alexander Polivany (4)Ukraine24 mins 21 secs87%2778
6Mike Pargeter (6)United Kingdom18 mins 45 secs83%2740
7Kevan Gelling (5)Isle of Man29 mins 47 secs87%2704
8mentzel.iudith (6)Israel29 mins 54 secs87%2702
9Siim Kask (6)Estonia27 mins 14 secs83%2605
10Vebjørn Koksvik (1)Norway26 mins 53 secs83%2542
11Krzysztof Helbin (1)Poland21 mins 25 secs78%2537
12Michal Cvan (5)Slovakia29 mins 53 secs83%2517
13Frank Schrader (7)Germany23 mins 20 secs78%2458
14Jerry Bull (4)United States29 mins 25 secs78%2302
15Vincent Malgrat (2)French Republic27 mins 03 secs74%2274
16Sean Stuber (4)United States25 mins 21 secs74%2273
17Zoltan Fulop (1)Hungary22 mins 10 secs70%2187
18_tiki_4_ (2)Germany19 mins 31 secs65%2160
19Viacheslav Stepanov (5)Russia28 mins 12 secs70%2136
20Randy Gettman (6)United States28 mins 57 secs70%2086
21Dieter Kowalski (1)Germany23 mins 59 secs65%2070
22Sebastian Kolski (1)Poland20 mins 19 secs65%2034
23Rimantas Adomauskas (1)Lithuania28 mins 50 secs65%1938
24Anna Onishchuk (5)Ireland25 mins 16 secs65%1895
25Justin Cave (5)United States23 mins 41 secs61%1891
26Gideon Bruggink (2)Netherlands28 mins 49 secs65%1864
27Thierry Poels (3)Belgium28 mins 19 secs57%1574
28haennesche (1)Germany14 mins 15 secs48%1515
29Vladimir Drozdov (1)Russia19 mins 38 secs48%1447
30Stelios Vlasopoulos (3)Belgium27 mins 47 secs52%1434
31Marco Siefert (1)Germany26 mins 51 secs52%1338
32Syed Ariful Bari (3)Bangladesh16 mins 34 secs43%1319
33Elena Rakhimov (1)Canada29 mins 34 secs43%1059
34Goran Stefanović (1)Serbia29 mins 48 secs35%754
35Tobias Stark (1)Germany26 mins 06 secs35%753

16 May 2012

Ideas for PL/SQL Challenge 2.3


We are now planning new features and enhancements to the PL/SQL Challenge website (version 2.3).  I'd love to hear what you think - both about these ideas and your own. Now, you might be thinking that I already asked for such feedback on the blog and that's true - sort of. In my 9 March post, we discussed some possible changes in the way the daily quiz is played. I am still sorting through those ideas. But for our next release, we will be making smaller-scale changes to the site, keeping the basic quiz structures in place, but improving overall usability and access.

So first:

What's Missing from the PL/SQL Challenge?

What features and content would you like to see on the PL/SQL Challenge? What would bring you back to the site more often? What would help you get your jobs done faster and with higher quality? And now our ideas for 2.3:

"Rank Me" for Competitions

Today at the PL/SQL Challenge, you can either play competitively or for educational purposes only. If the latter, then your performance is not ranked. This setting applies to all the quizzes and also affects all results since you started taking quizzes. It's an inflexible model that is showing its age in many ways. We plan to enhance the PL/SQL Challenge so that you can indicate for a specific competition (such as the daily PL/SQL quiz or the weekly SQL quiz) that you want to be ranked or not. We will keep track of when you start and stop competitive play for each quizzes. So, for example, if you have a vacation coming up, you can ask us to not rank you while you are away, and you will no longer see all your previous rankings disappear.

As you can probably tell from the way I wrote the above paragraph, we are definitely going to do this, but we are still happy to hear any comments on it, of course!

Favorites

Several players have asked for the ability to mark a quiz or feature or author as a "favorite", so that they can easily find and reference that information. Would you use this feature? What sort of information would you want to be able to keep track of as a "favorite"?

Recent Activity

There's a lot more going on, on the PL/SQL Challenge website, now that we have discussions on quizzes directly on the site, Quizbooks that can be shared, and so on. It's hard at the moment for a player to know about the new happenings on the site, so we'd like to show a list of recent activity on the home page.

Featured Discussion

As of 2.2, you can now ask questions and have a discussion about specific quizzes. We are thinking that it might also be interesting to post a topic each month and invite discussion on it, independent of any particular quiz. Examples of topics we might explore: "Should exceptions be trapped in the block in which they are raised or simply handled at the top-level block?" or "Should all (or most, anyway) SQL statements be encapsulated by procedures and functions?" or "What are your favorite techniques for debugging problems in your code as quickly as possible?"

The discussion topic would be shown on the home page, with links to the full discussion thread and past discussions.

Better Library Search

Today, the Library lists quizzes by the order in which they were taken. You can perform searches against the text displayed in the table, and that's about it. The Practice and Quizbook features now let you find quizzes by a feature (handy when you want to check out all the quizzes and related information for dynamic SQL, for example). We'd like to offer the same kind of searching to the Library.

Changes to Home Page

I feel that it is time for the home page to "catch up" with changes in the PL/SQL Challenge, both based on new features in 2.2 and the new ideas listed above. Here are my ideas regarding the home page:
  • First, whatever changes we make, you will be able to choose the "classic" home page that is currently offered. People generally don't like change and I expect that whatever we do, we will hear complaints that the "old way" was better or, at least, preferred.
  • Move Top Ranked Players to a pop up. Rather than use valuable real estate on the page, give you access to this information with a click of a button. Perhaps also show this information on our Rankings page.
  • Remove myLibrary: this will be effectively replaced by Recent Activity (see above).
  • Remove myAccount: this information can be made available without taking up so much space.
  • Shrink the Play a Quiz table. It contains information that I expect very few players even see, much less care about (number of quizzes in the competition, for example, which is almost always just 1).
  • Add a Search field to the home page to provide a "short cut" into the Library.
  • Add the Recent Activity, Features and Featured Discussion sections.