12.07.2015 Views

Oracle SQL Developer

Oracle SQL Developer

Oracle SQL Developer

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Debugging a PL/<strong>SQL</strong> Procedure2.7 Debugging a PL/<strong>SQL</strong> ProcedureIf you want to practice debugging a PL/<strong>SQL</strong> procedure with <strong>SQL</strong> <strong>Developer</strong>, create aprocedure that is like the list_a_rating procedure that you created in Creating aPL/<strong>SQL</strong> Procedure, but with a logic error. (The coding is also deliberately inefficient,to allow the display of the rating in a variable.)To create this procedure, if you are not already connected, connect to the database asthe user for the schema you are using for this tutorial. Right-click the Procedures nodein the schema hierarchy on the left side, select Create New PL/<strong>SQL</strong> Procedure, andenter the following information using the Create PL/<strong>SQL</strong> Procedure dialog box.Object Name: list_a_rating2Click OK. A Source window for the new procedure is opened. Enter (or copy andpaste) the following procedure text:PROCEDURE list_a_rating2(in_rating IN NUMBER) ASmatching_title VARCHAR2(50);matching_rating NUMBER;TYPE my_cursor IS REF CURSOR;the_cursor my_cursor;rating_cursor my_cursor;BEGINOPEN the_cursor FOR 'SELECT title FROM books WHERErating

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!