Functions - syntax, PL-SQL Programming

Functions

The function is a subprogram which can take parameters and be invoked. Normally, you can use a function to calculate a value. The function has 2 sections: the specification & the body. The specification starts with the keyword FUNCTION and ends with the RETURN clause that specifies the datatype of the result value.

The Parameter declarations are non-compulsory. The Functions which take no parameters are written without the parentheses. The function body starts with the keyword IS and ends with the keyword END followed by an elective function name.

The function body has 3 sections: an optional declarative section, an executable section, & an optional exception-handling section. The declarative section contains the declarations of the types, constants, cursors, variables, exceptions, & subprograms. These items are local and cease to exist whenever you exit the function. The executable section contains the statements that assign values, manipulate Oracle data, and control execution. The exception-handling section contains the exception handlers that deal with exceptions raised during the execution.

Syntax:

1438_functions.png

1737_functions 1.png

Posted Date: 10/8/2012 6:51:08 AM | Location : United States







Related Discussions:- Functions - syntax, Assignment Help, Ask Question on Functions - syntax, Get Answer, Expert's Help, Functions - syntax Discussions

Write discussion on Functions - syntax
Your posts are moderated
Related Questions
What Are Cursor Variables  ? The Cursor variables are like C or Pascal pointers that hold the memory location (address) of some item rather of the item itself. Therefore, decl

Using INNER JOIN INNER JOIN is used to retrieve the data from all tables listed based on a condition of equality listed after keyword ON. If the condition is not meet, rows ar

Example of Table Literal - SQL Example: A Table Literal (correct version) VALUES ('S1', 'C1', 'Anne'), ('S1', 'C2', 'Anne'), ('S2', 'C1', 'Boris'), ('S3', 'C3'

Predefined Exceptions The internal exception is raised implicitly whenever your PL/SQL program exceeds a system-dependent limit or violates an Oracle rule. Each & every Oracle

SQL Database: So, an SQL database is one whose symbols are organized into a collection of tables. Now, shows an SQL table as the current value of an SQL variable, ENROLMENT, b

Initial thought process: Design a script which was simple and user friendly. Integrate procedures/functions to extract data under the hood. I focused on giving the user the opt

Built-In Functions The PL/SQL provides a lot of powerful functions to help you to manipulate the data. These built-in functions fall into the categories as shown below: error r

Consider the following set of database tables (same tables from Assignment 6-1). Please take note of foreign keys (most of them carry the same names as the corresponding primary ke

Table Comparison - SQL The following definitions for relation comparisons: Let r1 and r2 be relations having the same heading. Then: r1 ⊆ r2 is true if every tuple of r1

1- You can check attribute names from each table in DBF11 by running for example:  desc dbf11.Member;  desc dbf11.Agent;  desc dbf11.Producer; Because some attribute names in