What is the difference between Anonymous Block and subprogram?Can we call a procedure from Anonymous PL/SQL block?

Showing Answers 1 - 15 of 15 Answers

Rav

  • Feb 22nd, 2006
 

Hi,

Ananymous is also PL/SQL block, but it is not named. So that these are not stored server for further reference. We can name the anonymous, but still we can use withing the sub-program. Subprogram is a named PL/SQL block and will be stored in server. This is avaialble for reference.

Procedure can be called from anonymous block and reverse is not possible.

Regards,
Ravi

  Was this answer useful?  Yes

Culver_lake

  • Mar 28th, 2006
 

dont confuse subprogram with stored procedure.

both anonymous block and subprogram are executed on the server.  ALL pl/sql and SQL are executed on the server (ie by ORACLE). The anonynmous block is unnamed while the subprogram is named and can be called from the anonymous block and passed arguments as well. both the anonymous block and the named pl/sql subprogram can call external programs (like a C) program as well.

  Was this answer useful?  Yes

venkatesh

  • Apr 23rd, 2015
 

named block: the named blocks are stores permanently in database server.
these blocks are calling from front languages like .net,java.
example:stored procedure,stored functions

create or replace procedure p(a varchar2)
is
begin
dbms_output.put_line(a);
end;
/
execution:exec p(hi);
output:hi
anonymous block:these block are not stored in database permanently.
these blocks are not calling from front languages like .net,java.
example:
begin
dbms_output.put_line(hi);
end;
/

  Was this answer useful?  Yes

Nupur

  • Apr 25th, 2015
 

Anonymous blocks contain PLSQL statements but they do not have any name. They cannot be stored and are written and executed when required. Sub programs are procedures and functions that have name and can be compiled and stored. Functions must return a value. Procedures might or might not return a value.

  Was this answer useful?  Yes

Nupur

  • Apr 25th, 2015
 

Answer to second part of the question : yes we can call a procedure from an anonymous block

  Was this answer useful?  Yes

Diwakar

  • Oct 20th, 2017
 

Anonymous block is independent piece of code to implement certain pseudo code. subprogram are some named entities like procedure and function which can be invoked from outside window.
YES procedure can be invoked using anonymous block.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions