les08 func cre tellme2





Creating Functions













The interactions in this eCourse require Javascript to be enabled.



 

Creating Functions: Part 2


previous|next





Example

In this example, the get_sal function is created with a single input parameter and returns the salary as a
number.
The get_sal function returns the common programming practice of assigning a returning
value to a local variable and uses a single RETURN statement in the executable section of the
code to return the value stored in the local variable. If your function has an exception section,
then it may also contain a RETURN statement.
Invoke a function as part of a PL/SQL expression, because
the function will return a value to the calling environment, such as Oracle
Application Express (formerly HTML DB). The second code box uses the EXECUTE
command to call the DBMS_OUTPUT.PUT_LINE procedure,
whose argument is the return value from the function get_sal.
In this case, get_sal is invoked first to
calculate the salary of the employee with ID 100. The salary value returned
is supplied as the value of the DBMS_OUTPUT.PUT_LINE
parameter, which displays the result.







Wyszukiwarka

Podobne podstrony:
les08 func cre tellme1
les08 proc cre tellme2
les08 func cre showme
les08 proc cre tellme1
les08 man triggers tellme
les08 proc cre showme
les08 pack spec tellme
les08 audit trigger1 tellme
les08 pack body tellme
les08 proc cre whylearnit
les08 cre block1 tellme
les08 cre block2 tellme
les08 cre anonymous1 tellme
les08 cre triggers tellme
les08 cre dmltriggers1 tellme
les08 pack tellme1
les08 cre anonymous2 showme
les08 except tellme1
les08 cre dmltriggers2 showme

więcej podobnych podstron