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

PROBLEM WITH CREATING A FUNCTION

From: Paul Manson <paul.manson_at_liv-coll.ac.uk>
Date: 29 Jan 2003 02:23:42 -0800
Message-ID: <c6074436.0301290223.386f2a82@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:23:42 CST

Original text of this message

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