Madhu Sharan
Madhu Sharan

Reputation: 68

Difference between procedures/functions and objects in Oracle PL/SQL

I just stumbled upon the concept of objects in PL/SQL and thus started pondering on what would be the difference between Oracle PL/SQL procedures/functions and objects. I need to know their functional difference.

PS: I am familiar with Java.

Upvotes: 0

Views: 3336

Answers (1)

hol
hol

Reputation: 8423

FUNCTION allows a value to return with the RETURN statement.

PROCEDURE has no such return value. However it is possible to return values by declaring the parameter as OUT rather than the default IN. There is also a IN OUT.

OBJECT in Oracle is some other concept and has nothing to do with PROCEDURE AND FUNCTION and is more like a class definition as you know it from Java. Though this comparison is a bit weak. There is some useful documentation on Oracle Objects, e.g. this link http://docs.oracle.com/cd/B28359_01/appdev.111/b28425/obj_types.htm

PACKAGE Though you have not asked for it, it should be mentioned. A Oracle Package contains a collection of Functions and Procedures (and more). The Package consists of the declaration and the package body. What is defined in the Package declaration can be accessed from outside the rest is private.

Upvotes: 3

Related Questions