Go4Oracle

Member Login






Powered by CodeRevolts
You are here  :Home arrow Articles arrow PL/SQL arrow IN AND OUT PARAMETER IN PLSQL PROGRAMMING
IN AND OUT PARAMETER IN PLSQL PROGRAMMING E-mail
(2 votes)
Written by Administrator   
Saturday, 12 July 2008
 

Views : 601    


There can be any number of parameters in plsql programming envoirement
Each parameters has a mode and a type. The possible modes are IN (read-only), OUT (write-only), and INOUT (read and write).
There can be any number of parameters in plsql programming envoirement
Each parameters has a mode and a type. The possible modes are IN (read-only), OUT (write-only), and INOUT (read and write). IN, OUT and INOUT Modes

Values are passed to a procedure in three modes; IN, OUT and INOUT. The mode
which a variable is passed defines how the variables can be used inside the
procedure.

IN Mode (Read Only)
Default By operation
IN mode can be read and used by the procedure/function but can not be changed and it cannot be assigned a value(except Default) in an operation. Variables passed using IN mode can be considered as a constant. It is recommended for maintainability reasons to always define the variable passing
mode when you define the variable.

OUT Mode(write-Only)

A variable passed in OUT mode is used to pass information back from the
procedure to the calling program. It is a write-only variable and has no value
until the block assigns it a value. Internally, an OUT variable is created and
not initialized when the procedure is called. When the procedure ends, the
variable value (upon ending) is copied to the variable passed in the call. As
such, a variable passed in OUT mode can not be assigned a default value nor can
it be read inside the procedure. Because the variable value is copied back to
the passed variable when the procedure terminates, the calling code can not pass
an OUT variable a literal value. If the procedure raises an exception that is
not caught, it will result in the OUT variable not being copied when the
procedure terminates.
INOUT, for example, means that the parameter will receive a value and return
another

INOUT Mode

A variable passed in INOUT mode has characteristics of both the IN and the OUT
mode. The variable value is passed in and can be read by the procedure. The
procedure can also change the value and it will be copied back to the passed
variable when the procedure completes. Like a variable passed in OUT mode, an
INOUT variable can not have a default value and can not be passed as a literal.
If the procedure terminates abnormally (as in an exception) the INOUT variable
will not be copied back to the variable passed in.




Consider The Following 2 Example and Analyse the the cause of error...Read the above to understand why error incase you need more help POST ON FORUM OF GO4ORACLE.COM FOR ADMIN OR WEBMASTER TO REPLY

create or replace procedure demo1
(a in number := 10,
b in number := 20)
as
begin
n_1 := n_2 + 30;
end;
/


create or replace procedure demo2
(a in number := 10,
b in number := 20
c out number :=30)
as
begin
null;
end;
/

Note : Never Use Contrained parameter declaration while declaring any paramenter in a
plsql programs which are being invoked.For example, CHAR(10) and
VARCHAR(20) are illegal; CHAR or VARCHAR should be used instead.The actual
length of a parameter depends on the corresponding argument that is passed in
when the procedure is invoked.




Reddit!Del.icio.us!Google!Live!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Smarking!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites! title=

   

Users' Comments  
 

Average user rating

   (0 vote)

 


Add your comment
Name
E-mail
Title  
 
Comment
 
Available characters: 600
   Notify me of follow-up comments
  Mathguard security question:
3PI         WS5      
  U    B      U   5LG
41T   YHQ   G1O      
G      X    O     KNS
YLF         X53      
   
   

No comment posted

< Prev
Register Now

Bookmark Us

 
 

Who's Online

No Users Online

Quote of the moment

It's not accident or time or forture that keeps you from the things you want, but rather, your own thinking.

Lillian Hellman

Advertisement

Linux Indore - 2007

Hello, you either have JavaScript turned off or an old version of Macromedia's Flash Player. Get the latest flash player.

Most Commented Items

Basic Cursor Writing
(1 comment)
Files that control oracle inst
(1 comment)
ROWID OF A RECORD (PSUEDO COLU
(1 comment)
rownum a pseudocolumn
(1 comment)

Visitors Counter

mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday23
mod_vvisit_counterYesterday77
mod_vvisit_counterThis week525
mod_vvisit_counterThis month2382
mod_vvisit_counterAll17272

Latest Job Offers

Our Recommendations

Get Firefox browser!
Go to Google!Get a free mail account!Get The Gimp!Get Openoffice!Get Videolan!