Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Worst of the worst

Re: Worst of the worst

From: Daniel Morgan <damorgan_at_exxesolutions.com>
Date: Mon, 26 May 2003 17:03:11 -0700
Message-ID: <3ED2AB3F.900CF026@exxesolutions.com>


Rauf Sarwar wrote:

> Daniel Morgan <damorgan_at_exxesolutions.com> wrote in message news:<3ED26387.74542B6C_at_exxesolutions.com>...
> > I've seen bad documentation from time to time but here's an example from
> > Oracle that staggers me.
> >
> > SQL> GET test.sql
> > 1 DECLARE
> > 2 TYPE NumTab IS TABLE OF NUMBER(4) INDEX BY BINARY_INTEGER;
> > 3 TYPE NameTab IS TABLE OF CHAR(15) INDEX BY BINARY_INTEGER;
> > 4 pnums NumTab;
> > 5 pnames NameTab;
> > 6 t1 NUMBER(5);
> > 7 t2 NUMBER(5);
> > 8 t3 NUMBER(5);
> > 9
> > 10
> > 11 BEGIN
> > 12 FOR j IN 1..5000 LOOP -- load index-by tables
> > 13 pnums(j) := j;
> > 14 pnames(j) := 'Part No. ' || TO_CHAR(j);
> > 15 END LOOP;
> > 16 t1 := dbms_utility.get_time;
> > 17 FOR i IN 1..5000 LOOP -- use FOR loop
> > 18 INSERT INTO parts VALUES (pnums(i), pnames(i));
> > 19 END LOOP;
> > 20 t2 := dbms_utility.get_time;
> > 21 FORALL i IN 1..5000 -- use FORALL statement
> > 22 INSERT INTO parts VALUES (pnums(i), pnames(i));
> > 23 get_time(t3);
> > 24 dbms_output.put_line('Execution Time (secs)');
> > 25 dbms_output.put_line('---------------------');
> > 26 dbms_output.put_line('FOR loop: ' || TO_CHAR(t2 - t1));
> > 27 dbms_output.put_line('FORALL: ' || TO_CHAR(t3 - t2));
> > 28* END;
> > SQL> /
> > Execution Time (secs)
> > ---------------------
> > FOR loop: 32
> > FORALL: 3
> >
> > PL/SQL procedure successfully completed.
> >
> > Source:
> > http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm#28087
> >
> > Take a good look at lines 16 and 20. Then look at line 23.
> >
> > Ok you lurkers from Oracle ... here's your chance to do a public service
> > ... find whoever managed to do this
> > and explain to them the concept of why documentation is posted.
> > Obviously the concept was completely lost
> > on several people.
> >
> > Thanks.
>
> In fairness to Oracle documentation department (for doing a very
> boring job), get_time could be a stand alone procedure returning a
> call to dbms_utility.get_time, specially if they did a copy/paste job
> from a sql buffer after test or else they would have caught the error.
>
> Although I doubt that's the case otherwise they would done the same in
> line 16 and 20. It just looks like a typo. -:)
>
> Regards
> /Rauf Sarwar

Had they not gotten it correctly twice in the same block I'd be more forgiving. But this? Obviously no one ever tried this example before including it in the docs.

--
Daniel Morgan
http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Mon May 26 2003 - 19:03:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US