What is the difference between In, Out, InOut Parameters. Can we pass value or reference or both to the In Out Parameter.

Questions by sbagai2001   answers by sbagai2001

Showing Answers 1 - 7 of 7 Answers


  • May 31st, 2006

By default, OUT and IN OUT parameters are passed by value. The values of any IN

OUT parameters are copied before the subprogram is executed. During subprogram

execution, temporary variables hold the output parameter values. If the subprogram

exits normally, these values are copied to the actual parameters. If the subprogram

exits with an unhandled exception, the original parameters are unchanged.

  Was this answer useful?  Yes


  • May 31st, 2006

Eg for in out parameterBellow the parameter having x (eg x_return_status)as suffix is OUT,p (eg p_calling_fn)as suffix is IN and px (px_trans_rec)as suffix is INOUT.Initializing In parameter is mandatory to get desired output,OUT will be the result of procedure execution and INOUT will store result processed by the procedure.Initialize fl_chr_validation, l_num_messg_count,l_chr_messg,l_chr_trans,l_chr_disttrans proc1( p_validation_level => l_chr_validation , x_return_status => l_chr_return_status , x_msg_count => l_num_messg_count , x_msg_data => l_chr_messg , p_calling_fn => NULL , px_trans_rec => l_chr_trans , px_dist_trans_rec => l_chr_disttrans);NOTE:- for better analysis/execution Always initkialize all the parameter IN and OUT.

  Was this answer useful?  Yes


1 Default mode                       

2 Value is passed into


Formal parameter acts as

   a constant

4 Actual parameter can be a

   literal, expression,

   constant, or initialized


5 Can be assigned a default



1 Must be specified

2 Returned to



Uninitialized variable

4 Must be a variable

5 Cannot be


   a default value


1 Must be specified

2 Passed into


  returned to calling


Initialized  variable

4 Must be a variable

5 Cannot be


   a default value


Can we pass value or reference or both to the In Out Parameter.

Yes, we can by using NOCOPY keyword

  Was this answer useful?  Yes


  • Aug 15th, 2006

You can use NOCOPY hint for passing it by reference

  Was this answer useful?  Yes


  • Jan 15th, 2007

hi friends,

To make it simple, keep in mind,

IN : It is a CONSTANT in the sub-program and u can not modify its value in sub-      program. if its value is modified in the sub-program then it will give a error.

OUT: the out parameter will always have a NULL value during the begining of the sub-program, we can modify its value in the sub-program and then this modified value can be sent to the calling program. Suppose from calling evironment u are sending a variable which has some value to the sub-program, but if that corresponding  variable is mrked as OUT in the sub-program, then in the sub-program that value will be replaced with NULL, and then the operation in the sub-program will be done.

NOTE: this behaviour can be changed using the NOCOPY option, but remmeber the restriction imposed on NOPCOY.

IN-OUT: well this is the variable, where u can read the variable and write the variable.

And one more thing to note is that, for OUT and IN-OUT the variables will be passed  by value. if NOCOPY option is not used,

but the restriction with the NOCOPY is that its a hint to the compiler, and  not necessary that the compiler will be using it, so be careful while usin the NOCOPY option.

  Was this answer useful?  Yes


  • Nov 26th, 2008

Here is the answer in 1 line

IN-- value is used in a program.
       It cannot be a variable .COuld be literal,expression,value .

OUT-- value is returned back from the program to the caller.Must be a variable.

IN OUT-- Its combination of IN and OUT as name suggests. It acts like a varible ie value can be used in the program and than can be returned back to the caller from the program

Hope you get some idea.
Jai Sairam

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account

Send   Reset


Related Answered Questions


Related Open Questions