Re: compilation error in plsql

From: Shakespeare <whatsin_at_xs4all.nl>
Date: Tue, 8 Apr 2008 22:03:20 +0200
Message-ID: <47fbcf90$0$14346$e4fe514c@news.xs4all.nl>

"The Boss" <usenet_at_No.Spam.Please.invalid> schreef in bericht news:47fa80ee$0$14345$e4fe514c_at_news.xs4all.nl...

> chris wrote:

>> Hi,
>>
>> I'm a new learner of pl/sql programing & try to write a basic
>> function; however, I can't figure out why my function is not compiling
>> correctly. Could someone pls let me know if you see where is the
>> problem? This is 10g & I'm writing it using iSQL*PLUS.
>>
>> CREATE OR REPLACE FUNCTION check_sal (empno employees.employee_id
>> %TYPE)
>> RETURN boolean IS
>>
>> dept_id employees.department_id%TYPE;
>> sal employees.salary%TYPE;
>> avg_sal employees.salary%TYPE;
>>
>> BEGIN
>> SELECT salary, department_id, INTO sal, dept_id FROM employees
>> WHERE employee_id = empno;
>> SELECT AVG(salary) INTO avg_sal FROM employees WHERE department_id
>> = dept_id;
>>
>> IF sal > avg_sal THEN
>> RETURN TRUE;
>> ELSE
>> RETURN FALSE;
>> END IF;
>> END;
>> /
>> show errors
>>
>> Errors for FUNCTION CHECK_SAL:
>>
>> LINE/COL ERROR
>> 8/4 PL/SQL: SQL Statement ignored
>> 8/34 PL/SQL: ORA-00936: missing expression
>>
>> TIA,
>> -Chris
>
> Your variable declarations should be preceded by the "DECLARE" keyword.
>
> HTH.
>
> -- 
> Jeroen
>

No they don't. Not within a procedure, I think it won't even compile.

Shakespeare Received on Tue Apr 08 2008 - 15:03:20 CDT

Original text of this message