Quick Ref.

A question about question 12

James Ronald Asks...

Andrew,
I know you said we shouldn't ask about questions 6-15 on the coursework but I've got a question on question number 12 - more of a concern really.
Basically, I can't see anyway of solving this question without using PL/SQL. I used a few PL/SQL programs to answer this question, one of them using two cursors to update the last date based on the non chargeable days.
My concern is that you haven't taught us about PL/SQL and I'm just wondering if we are 'allowed' to use it?
Thanks,
Jim

Andrew replies

Good question. The answer is no - you are not to use PL or any other programming language to answer these questions.

However you have a point in that some rules of "good taste" must be broken to get past 12. When I answered this I needed to generate a lot of numbers and I used code something like..

CREATE TABLE num(a INTEGER);
INSERT INTO num VALUES (0);
INSERT INTO num VALUES (1);
INSERT INTO num VALUES (2);
INSERT INTO num VALUES (3);
INSERT INTO num VALUES (4);
INSERT INTO num VALUES (5);
INSERT INTO num VALUES (6);
INSERT INTO num VALUES (7);
INSERT INTO num VALUES (8);
INSERT INTO num VALUES (9);

  SELECT  1000*th.a+100*h.a+10*t.a+u.a
  FROM num u, num t, num h, num th;

It's not pretty - but it gave me the numbers 0, 1, 2 ... 9999, some of which I needed. HTH
Andrew