Writting Anonymous Blocks of PL/SQL....

I’m pretty new to PL/SQL and to SQL Navigator. I’ve used SQL Nav. to write SQL queries and run them…but that’s about it.

All I want to do is have a scratch-pad where I can type in PL/SQL examples from the PL/SQL book I’m reading and excute it. I don’t want to create a procedur or anything.

I’ve read the help and there is supposed to be an ‘Execution Console’ - but I can’t seem to find it for the life of me.

Any help is greatly appreciated,

Thanks!

Hi Rob,

Welcome to the community.

Here I am giving some steps that may help you to make your self familiar with SQL Navigator.

Steps:

  1. The PL/SQL stored procedures or objects need to be created in Database schema in order to execute them. On a fly it is not possible to execute and see the result like a SQL query.

  2. Once you have created under any user of Database then they will be listed in SQLNAV Db Nav tree, under appropriate nodes like functions, procedures,packages e.t.c then if you don’t want them any more you can drop it from database by highlighting them and press delete button.

  3. To clarify you question regarding executing it has to be executed from execution console.

  4. For future reference these can be added to Code templates which are under View menu. Please add them to code template so that you can refer to them in future and they can be drag and drop to SQL editor and you can re create them if you want. Make sure if the pl/sql object creation script has create or replace then it will be replaced all the time irrespective of if you have it on database.

  5. If you are executing anonymous block which is called un named block in oracle pl/sql then they can be executed straight away in SQL editor without creating on database. These blocks also can be stored in Code templates.

Anonymous blocks looks like this >>>>>>>>>>>>>>>>>

DECLARE

BEGIN

DBMS_OUTPUT.PUt_LINE (‘It Is working’);
END;
/
Note: Please click on scan defines on (&) , if your code needs any variable to be defined. For anonymous blocks execution you don’t need to have any execution console.

  1. IF any pl/sql script looks like
    Create or replace function/procedure/package/type

END;
/
Then these are called named blocks or oracle objects. These need to be created against database inorder to execute it.

Regards
sekhar

HI Rob,

Please observe my attachments.If you click on the Run button then it leads to Execution Console.

regards
sekhar

HI Rob,

Please observe my attachments.If you click on the Run button then it leads to Execution Console.

regards
sekhar