| |
GeekInterview.com > Interview Questions > Oracle > PL/SQL
| Print | |
Question: Procedure Parameters
Answer: What is call by value and call by reference in parameters (IN, OUT, INOUT)? |
| November 11, 2008 21:55:43 |
#4 |
| lisha.varghese |
Member Since: November 2008 Total Comments: 1 |
RE: Procedure Parameters |
Three types of parameter modes
1) IN parameter mode- This mode is used to pass values to the calling module when invoked.The value of IN parameter can't be changed in the module.
2) OUT parameter mode -This mode is used to return a value to the main block.The value of OUT parameter can change anywhere in the program.
3)IN OUT parameter mode-This mode is used to pass values to the calling module and return a value to the main block.The value of IN OUT parameter can change anywhere in the program.
In Call By value ,the copy of actual parameter is passed to the formal parameter,So any changes to the formal parameter doesn't affect the actual parameter.
In Call By reference,the address of actual parameter is passed to the formal parameter,so any changes to the formal parameter will change the actual parameter also,because both of them are pointing to the same memory location. Here no copying is required. The IN parameter is passe by reference,so we can't change the value of IN parameter inside the module,It acts as a constant,But the OUT and IN OUT parameters are passed by value,we can change the values of OUT & IN OUT paremeters |
| |
Back To Question | |