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

Home -> Community -> Usenet -> c.d.o.misc -> Re: if statement inside function

Re: if statement inside function

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Wed, 15 Feb 2006 13:45:07 -0500
Message-ID: <j7qdnW_01qso627eRVn-oQ@comcast.com>

<drdave_at_canoemail.com> wrote in message news:1140027860.478945.246030_at_g14g2000cwa.googlegroups.com...
: New to Oracle and cant understand why my code is not working ..
:
: FUNCTION "VARIATION_ID" ("range_id" IN VARCHAR2) return NUMBER is
: rangebig NUMBER;
:
: BEGIN
:
:
: SELECT max(minimum_wage_variation_id) as bigrange into rangebig
: FROM minimum_wage_variation
:
: IF range_id = 1 THEN
: WHERE minimum_wage_variation_id < 100
: ELSE
: WHERE minimum_wage_variation_id > 100
: END IF;
:
:
: RETURN rangebig;
: END;
:
: error:00933 sql command not properly ended, yet if I put a semicolon on
: the where clauses it throws an error on the else clause..
:
: thx.
:
: Dave
:

your issue is actually IF (which is PL/SQL) inside a SELECT (which is SQL)

tip: try all your SQL outside of a PL/SQL block first

++ mcs Received on Wed Feb 15 2006 - 12:45:07 CST

Original text of this message

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