Home » SQL & PL/SQL » SQL & PL/SQL » EXCEPTION Woes?
EXCEPTION Woes? [message #186170] Sun, 06 August 2006 17:08 Go to next message
DCrash
Messages: 9
Registered: July 2006
Junior Member
I'm getting an error:
"29/1 PLS-00103: Encountered the symbol "EXCEPTION"

Not sure why, everything looks fine to me... though im a bit new to exception stuff so im wondering what im doing wrong. below ismy code:

CREATE OR REPLACE PROCEDURE MOVIE_STOCK_SF
(p_movie_id mm_movie.movie_id%TYPE)
IS
v_movie_title mm_movie.movie_title%TYPE;
v_movie_qty mm_movie.movie_qty%TYPE;

ex_unknown_movie EXCEPTION;
ex_movie_not_available EXCEPTION;


v_message VARCHAR2(20);
v_count INTEGER;

BEGIN
SELECT COUNT(movie_title) into v_count
FROM mm_movie WHERE movie_id =p_movie_id;
IF (v_count=0) THEN RAISE ex_unknown_movie;
END IF;

SELECT movie_qty into v_movie_qty
FROM mm_movie WHERE movie_id= p_movie_id;
IF v_movie_qty = 0 THEN RAISE ex_movie_not_available;
END IF;

v_message := v_movie_title + ' is available: ' + v_movie_qty + ' on the shelf.';
DBMS_OUTPUT.PUT_LINE(v_message);
END;

EXCEPTION
WHEN ex_movie_not_available THEN
DBMS_OUTPUT.PUT_LINE('Movie ' || p_movie_id || ' is not available at this time');
WHEN ex_unknown_movie THEN
DBMS_OUTPUT.PUT_LINE('There is no movie with id: ' || p_movie_id);
END;
/
Re: EXCEPTION Woes? [message #186172 is a reply to message #186170] Sun, 06 August 2006 17:22 Go to previous messageGo to next message
William Robertson
Messages: 1640
Registered: August 2003
Location: London, UK
Senior Member
There is an "END;" just above the EXCEPTION section that shouldn't be there.

btw I assume this is a test example, as normally you would not declare named exceptions just to put out a debug message and have the procedure complete without errors.
Re: EXCEPTION Woes? [message #186173 is a reply to message #186170] Sun, 06 August 2006 17:23 Go to previous message
DCrash
Messages: 9
Registered: July 2006
Junior Member
Oops, runs like a charm now. I appreciate the help
Previous Topic: Autoinc field?
Next Topic: very complex group by challange
Goto Forum:
  


Current Time: Thu Dec 08 02:16:53 CST 2016

Total time taken to generate the page: 0.06357 seconds