PL/SQL function call syntax hassle

From: Chris Eastwood <ua.ude.ug_at_doowtsae.c>
Date: 1997/10/18
Message-ID: <6272bs$459$1_at_griffin.itc.gu.edu.au>#1/1


HiYa

when tryingto use a procedure in a PL/SQL script I have found that I have to declare the local variables BEFORE I declare the PROCEDURES.

Like this works:

DECLARE     PROCEDURE Boing(p_in NUMBER) IS

  • declare local variables cart NUMBER(3); float NUMBER(3); BEGIN cart := 2; float := p_in * cart; END Boing;

    FUNCTION Skew(p_in NUMBER) RETURN NUMBER IS

  • declare local variables one NUMBER(3); two NUMBER(3); BEGIN one := 1; two := p_in * one; RETURN two; END Skew;
    • local variables startNumber NUMBER; displayNumber NUMBER; resultNumber NUMBER;

BEGIN
    dbms_output.enable(1000000);
    startNumber := 5;
    Boing(startNumber);

blah blah blah....

and this doesn't:
DECLARE

  • local variables startNumber NUMBER; displayNumber NUMBER; resultNumber NUMBER;

    PROCEDURE Boing(p_in NUMBER) IS

  • declare local variables cart NUMBER(3); float NUMBER(3); BEGIN cart := 2; float := p_in * cart; END Boing;

    FUNCTION Skew(p_in NUMBER) RETURN NUMBER IS

  • declare local variables one NUMBER(3); two NUMBER(3); BEGIN one := 1; two := p_in * one; RETURN two; END Skew;

BEGIN
    dbms_output.enable(1000000);
    startNumber := 5;
    Boing(startNumber);

blah blah blah....

why?

Thanks

---

Chris Eastwood                           email the mirror image above
Software Engineer                          ie->  doowtsae | eastwood
ITS                                      its a pain I know, but I think it'll
[Quoted] Griffith University                      fool the robot mailers (I hope;-)
[Quoted] Queensland                               if its all too hard, try the most
[Quoted] AUSTRALIA                                obvious address ;-)

************************************************************************

'But oh, beamish nephew, beware of the day,
     If your Snark be a Boojum!  For then
You will softly and suddenly vanish away,
     And never be met with again!'
Received on Sat Oct 18 1997 - 00:00:00 CEST

Original text of this message