I am working on an oracle database which handles a lot of PL/SQL and APEX procedures . I'm not very born for programming, but I'm trying to understand.
code snippet
PROCEDURE create_request (out_OraErr out varchar2, out_request_no out
number, out_request_id out varchar2)
Can someone explain to me how a procedure with parameters works OUT
? I already read it in different sources, but I prefer someone to explain it to me.
In both stored procedures and functions, parameters can be input, output, or input/output:
IN (input) : These are the parameters that the function receives when it is executed to be inserted in the database or determine a business logic. They are always read -only parameters :
OUT (exit) : Parameters that are normally loaded into the stored procedure and then return a value. It is a write -only parameter and will have no value until one is assigned to it within the procedure:
IN/OUT : The combination of the previous two. A value is received to then modify it (or not) and return it. It is a read and write parameter :
Stored procedures store, for example, an SQL statement, which can be dynamic, that is, work through values entered by the user and based on those values, process them and return a result:
Case
IN
We need a SP that does a
SELECT
based onid
which a user enters; then we would do it like this:Case
out
It helps us to extract from a SP the calculation generated through a variable; thus:
The OUT parameters are the output parameters. In the example, if you call the procedure
you don't need IN input parameters, then the procedure does something and returns: OraErr, varchar2, request_no, etc.
Clarification: The syntax in the example is not correct. It is for illustrative purposes only to explain the OUT parameters.