Why doesn't function return a value here?

Why doesn't function return a value here?

 

  

Hi All,
Been trying to debug a funtion I'm creating....I've stripped it to the
bare bones just trying to get it to return a value...and the strangest
thing is happening.

This function basically takes a date/time and room number as params. It does
a select to find a meeting number associated with this room at this date/time.

Well, I usually return the meeting number..but, no matter what I did...it
wouldn't return a value...I hardcoded the number 2 to be returned no matter
what the query did...and to my astonishment...if the query doesn't return
a value the hard coded return value doesn't return either...why is this?

Here is an example:

FUNCTION check_date (v_date IN DATE, v_room_id IN NUMBER) RETURN NUMBER IS

v_meeting_id NUMBER;

BEGIN

SELECT a.meeting_id INTO v_meeting_id from booked_meeting_room a, meeting b
WHERE v_date between b.begin_date and b.end_date
AND v_room_id = a.room_id
AND a.meeting_id = b.meeting_id;


RETURN 2;


END check_date;

If I do this, where there is a meeting on this date/time, in the room
in the booked_meeting_room table...it will return the 2. But, if there
is not a meeting_id for the date and room...it returns a null...even though
the return value is not even involved with the query here....

Any ideas?

TIA,

Kelly
--


------------------

A computer lets you make more mistakes faster than any other invention,
With the possible exceptions of handguns and tequila.

------------------
Oracle LazyDBA home page