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
Read-Only Operator (+) - SQL The term read-only operator to the mathematical term function. Here I just need to add that the SQL standard reserves the term function for read-

Nested Tables versus Index-by Tables The Index-by tables and nested tables are just similar. For e.g.  They have similar structure and their individual elements are accessed in

Predicate - SQL Consider the declarative sentence-a proposition-that is used to introduce this topic:  "Student S1, named Anne, is enrolled on course C1." Recall that th

Organi c Evolution Evolution is a slow continuous, irreversible and natural process of change to give rise to advance and diverse forms of life i.e. formation of new specie

Authorize and fetch data from Instagram Project Description: Incorporate Instagram feed on mobile site platform: c#, ms sql, jquerymobile, jquery Web admin Author

Query: SELECT * FROM EMPLOYEE1; Select 5 columns and all rows from one table Query: SELECT C_ID, COMPANY, BUILDING, DEPARTMENT, BRANCH FROM CONTRACT;

Using Host Arrays The Client-side programs can use anonymous PL/SQL blocks to bulk-bind input and output host arrays. However, this is the well-organized way to pass the colle

set serveroutput on declare a number(5); b number(5); c number(5); begin a:=&a; b:=&b; c:=a/b; dbms_output.put_line(c); exception when zero_d

Parameter and Keyword Description: package_name: This construct identifies the package. AUTHID Clause: This determine whether all the packaged subprograms impleme

Project Description: I want somebody who can help me with an idea that I have been working on for a few months now. The person will require extensive knowledge of warcraft 3 PvP