alt
Advertisement
Sponsored links
Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow Oracle 9i arrow Tutorial 13: Oracle 9i : Procedures and Functions
Site Search


Tutorial 13: Oracle 9i : Procedures and Functions
Article Index
Tutorial 13: Oracle 9i : Procedures and Functions
Page 2

Functions:

A function is a PL/SQL subprogram, which is used to compute a value. Function is same like a procedure except for the difference that it have RETURN clause.

Syntax for Function

Examples


Function without arguments

Function with arguments. Different ways of executing the function.

Privileges for creation and execution of procedures

To create a procedure in current user schema we use the syntax

CREATE OR REPLACE PROCEDURE (<argslist) IS
-------
-------


To create procedure in any schema we use


CREATE OR REPLACE ANY PROCEDURE (<argslist) IS
-------
-------

To grant EXECUTE privilege to some user on a procedure we write

GRANT EXECUTE ON <procedure-name> TO <user-name>

SQL> SELECT * FROM USER_PROCEDURES;
Lists all the procedures, functions in current user.

SQL> SELECT * FROM USER_PROCEDURES;
Lists all the procedures, functions in all users.

SQL> DROP PROCEDURE <procedure-name> ;
Drops or Removes a procedure from database

SQL> DROP FUNCTION <function-name> ; 
Drops or Removes a function from database


Trackback(0)
Comments (6)add comment

todeardennnis said:

  [EMAIL] This e-mail address is being protected from spam bots, you need JavaScript enabled to view it [/EMAIL]
March 26, 2005

ambuj_shukla said:

  hi all,
please send me anser what is difference b/w truncate and delete command and exaMPLE
August 18, 2005

raj soni said:

  truncate is a ddl and delete is a dml command
tru delete always segment,not a record so that u can't rollback
while delete deletes row and u can rollback
because after trun autocommit occur
October 11, 2006

jayshree said:

  can a function return more than one value at a time?
September 21, 2007

TR said:

  'NO'........FUNCTION CANT RETURN MORE THAN ONE VALUE AT A TIME.
BY USING "OUT PARAMETER" IN THE PROCEDURE WE CAN RETURN MORE THAN ONE VALUE AT A TIME.
October 04, 2007

rajeshk said:

  how can i fetch a value from an already existing table, and execute an operation in my procedure using select statement
December 06, 2007

Write comment

busy

 
< Prev   Next >
Exforsys Offers
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape