I have Oracle 10g installed and there is a package which has a number of cursors and procedures, how do I debug one of these procedures or cursors. Can you please provide steps for that?
I ran a Google search but did not find anything specifying how to debug a particular procedure from a package.
Basic Steps to Debug a Procedure in Toad
Load your Procedure in Toad Editor.
Put debug point on the line where you want to debug.See the first screenshot.
Right click on the editor Execute->Execute PLSQL(Debugger).See the second screeshot.
A window opens up,you need to select the procedure from the left side and pass parameters for that procedure and then click Execute.See the third screenshot.
Now start your debugging check Debug-->Step Over...Add Watch etc.
Reference:Toad Debugger
Open a PL/SQL object in the Editor.
Click on the main toolbar or select Session | Toggle Compiling with Debug. This enables debugging.
Compile the object on the database.
Select one of the following options on the Execute toolbar to begin debugging:
Execute PL/SQL with debugger ()
Step over
Step into
Run to cursor
Related
I am using sql developer and I have oracle database 10g and DBMS_OUTPUT.PUT_LINE() doesn't print. I have tried every way.
SET SERVEROUTPUT ON;
BEGIN
DBMS_OUTPUT.PUT_LINE('hello');
END;
With this code it only states PL/SQL procedure successfully completed. But it doesn't print hello.
Did you turn the output on in the sql developer settings?
Try the following:
View -> Dbms Output
On a new dbms output tab there is a green cross "Enable DBMS OUTPUT for the connection". Click it
You need to activate the DBMS Output screen and then choose the workspace you are working too, click on the PLUS button.
I'm using TOAD to develop a stored function in an Oracle database. When I click the "run as script" button in TOAD, it tells me that the script was executed with 0 errors and 1 compile errors. Where do I see the specific compile error(s). I'm fairly new to TOAD so I might be missing something obvious about the interface like a tab/window to see such error messages.
You can either add SHOW ERRORS to the end of the script, which will print the error message(s) to the "script output" tab, or compile the function using the "Execute Statement" command in Toad, which will cause the errors to be displayed in a box at the bottom of the editor.
Or you can look in USER_ERRORS table afterwards
Click on Database -> Procedure Editor in top tool bar.
Paste your code in this new editor window and execute by clicking green play button on top.
All the errors will be displayed in a new window at the bottom.
2 things you can do
goto Toad, schema browser, select Invalid Objects will tell you where to look.
then load the package into the editor and select the function, right click, compile, wioll show you the errors
Another option that worked for me was to open my script in the procedure editor and compile it there.
I have Oracle 10.5 installed on my system.
I created a stored procedure using Toad. It is running successfully.
I observed that there are different icons for stored procedures in Toad:
Red cross (error in procedure)
White rectangle (new procedure)
Green bug (debugged procedure)
My procedure has the white rectangle icon. I want to change it to the green bug icon.
I found online that I have to run the stored procedure in debug mode. I ran it but it didn't change the icon.
How I can get the green bug icon for my stored procedure?
The green bug indicates that the stored procedure (or package) was compiled with debug information and can be debugged. In order to create the necessary debug information, you need to (re-)compile your stored procedure with
alter procedure PROCNAME compile debug;
Replace PROCNAME with the actual name of your stored procedure.
When using the Schema Browser, you can right-click on your procedure and select "Compile with Debug" from the context menu.
For packages, the context menu item is "Compile" > "Compile with Debug".
If a dialog box opens asking to choose Refresh Mode, you can leave the default option "Refresh items one by one" on, unless otherwise required.
I'm using TOAD to develop a stored function in an Oracle database. When I click the "run as script" button in TOAD, it tells me that the script was executed with 0 errors and 1 compile errors. Where do I see the specific compile error(s). I'm fairly new to TOAD so I might be missing something obvious about the interface like a tab/window to see such error messages.
You can either add SHOW ERRORS to the end of the script, which will print the error message(s) to the "script output" tab, or compile the function using the "Execute Statement" command in Toad, which will cause the errors to be displayed in a box at the bottom of the editor.
Or you can look in USER_ERRORS table afterwards
Click on Database -> Procedure Editor in top tool bar.
Paste your code in this new editor window and execute by clicking green play button on top.
All the errors will be displayed in a new window at the bottom.
2 things you can do
goto Toad, schema browser, select Invalid Objects will tell you where to look.
then load the package into the editor and select the function, right click, compile, wioll show you the errors
Another option that worked for me was to open my script in the procedure editor and compile it there.
Below is some PL/SQL which is intended to create a very simple stored procedure in Oracle, based on code generated via SQL Developer IDE. I'm receiving the error when I run the command. On many tutorials online, the instructions for creating stored procedures didn't require a package (in the source code). When is a package required in Oracle? And how can I correct the code below to be as simple as possible?
Source Code:
CREATE OR REPLACE PROCEDURE PROCEDURE1
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello World!');
END;
Error:
Empty package PROCEDURE1 definition (no public members).
FYI:
Before running the code above, I was following these instructions to build a simple example of a stored procedure and connect via Enterprise Library. This code worked.
http://www.codeproject.com/Articles/19581/Microsoft-Enterprise-Library-Data-Access-Block-DAA
Workflow to Avoid the error:
When using SQL Developer IDE for Oracle, right click "{Database Name} > Procedures > New Procedure" in the object explorer, and click OK to that dialog after entering a stored procedure name, click the two gears (Compile) button.
Note
The Green Triangle button is used to run the compiled procedure, but it needs to be compiled before you can run it.
Workflow to reproduce the error:
When using SQL Developer IDE for Oracle, when right clicking "{Database Name} > Procedures > New Procedure" in the object explorer, and clicking OK to that dialog after entering a stored procedure name, and clicking the green triangle (execute) button, I get this error.
Solution:
I right clicked the {Database Name} and selected "Open SQL Worksheet" and then pasted the code generated from the workflow above. Then clicked the green triangle (execute) button.
What a piece of *HIT IDE!
"I SLIT A SHEET"
"A SHEET I SLIT"
"AND ON THAT SLITTED SHEET I SIT"