Plsql parameters IN and OUT

Source: Internet
Author: User

     scott.pro_para_inout(p_dname  out scott.dept.dname                                            p_loc out scott.dept.locTYPE)     dbms_output.put_line(p_dname     dbms_output.put_line(p_loc    pro_para_inout;

Call

  ;

 

Result

 

When the parameter type is OUT, the value in the original record (v_dept) does not exist. If it is in out, the original record value remains the same.

Of course, you can set it when you use it according to the actual situation. However, if you want to reset the value under certain circumstances, you can do nothing without meeting the conditions. If the original value remains unchanged, it is wrong to write it as OUT.

This is the official explanation of oracle parameter value transfer or reference transfer.

Summary of Subprogram Parameter Modes

Table 8-1 summarizes the characteristics of parameter modes.

Table 8-1 Parameter Modes

IN OUT IN OUT

The default

Must be specified

Must be specified

Passes a value to the subprogram

Returns a value to the caller

Passes an initial value to the subprogram and returns an updated value to the caller

Formal parameter acts like a constant

Formal parameter acts like an uninitialized variable

Formal parameter acts like an initialized variable

Formal parameter cannot be assigned a value

Formal parameter must be assigned a value

Formal parameter shocould be assigned a value

Actual parameter can be a constant, initialized variable, literal, or expression

Actual parameter must be a variable

Actual parameter must be a variable

Actual parameter is passed by reference (the caller passes the subprogram a pointer to the value)

Actual parameter is passed by value (the subprogram passes the caller a copy of the value) unlessNOCOPYIs specified

Actual parameter is passed by value (the caller passes the subprogram a copy of the value and the subprogram passes the caller a copy of the value) unlessNOCOPYIs specified

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.