PL/SQL 中参数模式的区别
自变量模式基本上用于描述形参的行为。子程序中使用的参数模式有以下三种:IN 模式、OUT 模式和 IN OUT 模式。
这些解释如下:
- 输入模式:
它是子程序中的默认参数模式。此模式将一个常量值从调用环境传递到子程序中。 - 输出模式:
此模式将值从子程序传递到调用环境。 - 输入输出模式:
此模式是 IN 和 OUT 模式的混合。就像 IN 模式一样,它从子程序中的调用环境传递一个值,就像 OUT 模式一样,它可能使用相同的参数将不同的值从子程序传递回调用环境。
IN、OUT和IN OUT模式的区别:
IN Mode | Out Mode | IN OUT Mode |
---|---|---|
It is the default mode. | It must be specified. | It must be specified. |
In this value is passed into subprogram. | In this value is returned to calling environment. | In this, value is passed into subprogram and also returned to calling environment. |
In this formal parameter acts as a constant. | In this formal parameter act as un-initialized variable. | In this formal parameter act as initialized variable. |
In this actual parameter can be a literal, impression, constant or initialized variable. | In this actual parameter must be a variable. | In this actual parameter must be a variable. |
It can be assigned as a default value. | It cannot be assigned as a default value. | It also cannot be assigned as a default value. |
It performs read only operation. | It performs only write operation. | It performs both read and write operation. |