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: PROBLEM WITH CREATING A FUNCTION

Re: PROBLEM WITH CREATING A FUNCTION

From: Kevin A Lewis <Kevin_A_Lewis_at_Hotmail.com>
Date: Wed, 29 Jan 2003 10:26:05 GMT
Message-ID: <1%NZ9.1$k62.41@newreader.ukcore.bt.net>


Niether of your SELECT statements are complete - you need some kind of FROM clause to complete each one.

Regards Kevin
"The Rhythm Chronologist"

"Paul Manson" <paul.manson_at_liv-coll.ac.uk> wrote in message news:c6074436.0301290223.386f2a82_at_posting.google.com...
> Hi
> Bit of a PL/SQL newbie here. Could anyone tell me what's wrong with
> this code? I'm gettin a message telling me that the "ELSE" is
> unexpected. I want to call this function in a pass-thru query. The
> returned rows will have a value for the progress_code, event_code, and
> live_weeks, and based on these values I want to get a value for
> expected_hours:
>
> CREATE FUNCTION exp_hrs
> (fes_progress_code STRING,
> event_code STRING,
> live_weeks NUMBER)
> RETURN NUMBER
> IS
> expected_hours NUMBER;
> BEGIN
> IF fes_progress_code = 'S' then
> SELECT
> COUNT(stud_attend_and_prog.event_code) * AVG(live_weeks)
> INTO expected_hours
> ELSE
> SELECT
> COUNT(stud_attend_and_prog.event_code) * week_num
> INTO expected_hours;
> RETURN (expected_hours);
> END;
Received on Wed Jan 29 2003 - 04:26:05 CST

Original text of this message

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