how to print DBMS_OUTPUT.PUT_LINE() at oracle database 10g? - oracle

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.

Related

VS Code Oracle Developer Hide SQL in Results Window

I'm using Oracle Developer Tools for VS Code Extension. When I run a SQL statement a Results Tab opens displaying the SQL statement and records retrieved.
How can I hide the SQL statement in the Results tab? I don't want to see it with my data rows.
This is the Extension:
This is the SQL Tab:
This is the SQL Results Tab:
This can be controlled using the oracledevtools.query.echo setting, but note you'll need to reload any windows before the setting will take effect:
You may also wiuth to bump the oracledevtools.query.resultSet.pageSize setting to 25 at the same time:

Autocomplete is not working: DBeaver plugin in Eclipse for Oracle PL/SQL in MacOS

Autocomplete is not working for DBeaver plugin (21.1.0) in Eclipse (2021-03) for Oracle PL/SQL (Oracle DB Developer VM: Oracle 19.3) in MacOS (Catalina).
It does autocomplete for SQL queries with MySQL, PostgreSQL, and Oracle.
But, with Oracle PL/SQL, it does some case changes and syntax highlights, but NO code completion.
For example, if I start typing DECLARE or BEGIN, it does NOT prompt it. But, once I complete these keywords, they are automatically turned to upper case and changes color to blue.
However, when I type dbms_output.put_line it neither prompts anything nor changes case or color thereafter.
(Noticed: In Oracle SQL Developer, it prompts several options as we continue typing the above command, and also does syntax highlight thereafter. Similarly, it prompts options, and code snippets with initial 3 letters like dec, etc.)
By default, the following are checked:
Windows > Preferences > Database > Database Editors > SQL Editor > Code Complete >
Enable auto activation
Activate on typing
Auto-insert proposal
Any idea?

How to debug a stored procedure in Toad?

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

How to get green bug (debug) icon on a stored procedure?

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.

Creation of a stored procedure requires a package in Oracle

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"

Resources