FUNCTION: Function is a self content block which performs a specific task.
1.System defined functions
2.User defined functions
1.System defined functions: A function which is defined by the system along with the software is called System Defined Functions.
2.User Defined Functions: A function which is defined by the user manually or programatically is called user defined functions.
User Defined Functions are again divided into 4 types depending on Receiving & sending the values:
1.A Function which receives & return the value
2.A Function which receives but do not return the value
3.A Function do not receive but return the value
4.A Function do not receive and do not return the value
In above 4 types only 1 & 3 supports pl/sql
Syntax to write a function:
CREATE or REPLACE function <function_name>
(list of parameters)
Return <data_type>
IS/AS
Variable Declaration;
BEGIN
Statement 1;
.
.
.
Statement n;
END;
- Function always returns a single value from sub program to main program
- The Main Advantage of the function is CODE REUSABILITY.
1.System defined functions
2.User defined functions
1.System defined functions: A function which is defined by the system along with the software is called System Defined Functions.
2.User Defined Functions: A function which is defined by the user manually or programatically is called user defined functions.
User Defined Functions are again divided into 4 types depending on Receiving & sending the values:
1.A Function which receives & return the value
2.A Function which receives but do not return the value
3.A Function do not receive but return the value
4.A Function do not receive and do not return the value
In above 4 types only 1 & 3 supports pl/sql
Syntax to write a function:
CREATE or REPLACE function <function_name>
(list of parameters)
Return <data_type>
IS/AS
Variable Declaration;
BEGIN
Statement 1;
.
.
.
Statement n;
END;
No comments:
Post a Comment
If you Like my blog Spread it and help friends for whom this blog is useful for their career.