SQLDeveloper has a very good GUI,that can let you test the SP you developed
open a new SQL windows,drag and drop the SP into this windows,I will create code for you to test,you just need change IN parameter's value,print the OUT value when call is done.
one thing is not very handy that It can not gracefully handle cursor,If I define a Cursor in my SP as a IN parameter,when I direct run the test,It says syntax wrong,I need change the cursor defintion same as it was define in my SP.
I still need addtional code to iterator my OUT cursor.
from SQLPLUS,it will be very handy than that.
simplely define a refcursor like this,and call sp,then print result.
note that all the code we out in sqlplus can also be put in sqldeveloper and get the same result.
SQL> var rc refcursor
SQL> exec WS_PKG.Get_CMTS_By_Facility('AJAX',10,:rc);
PL/SQL procedure successfully completed.
SQL> print rc
no rows selected
SQL>
if there are some data,it will print it out,good way to handle cursor here.
TOAD do not have a drag and drop option,It will be more convinient to run in TOAD.following those steps
1) browse to you packages(package),right click run package
2) from Menu View,select DBMS Output.
3) it will pop up a window,let you select specific SP,and ask for input parameters.REMEMBER,there is a tab beside Arguments in this popup dialog,called option,in there,we need click "Print OUT arguments/Return values to DBMS Output",make sure select third option "LOAD into grid from memory",then click OK,it will run test code and display return cursor value in grid.
This is tested in TOAD for Oracle FreeWare 10.6.0.42
No comments:
Post a Comment