You are on page 1of 32

| |


  |
  |

 !"#!$%

$! &
' (!  |
' (!  |!$
%%!()
' *%!  |
' %"*"%$%%$"
"%+% "%$$%%% 
' %%   | %%$ 
' (%$%+% 
' %%% ,)-
  |

'  |!$%*
|!$ %
 % % % .
' (%%%%%$/#
%|%$$!
$%$.
 |
PL/SQL engine
PL/SQL Procedural
PL/SQL PL/SQL statement
block block SQL
executor

SQL statement executor

Oracle server
)  |

 %

Ô lication

Shared Oracle server


library
)  |

SQL
$% SQL
Ô lication Other DBMSs
SQL
SQL

| 

|  Oracle with
Ô lication | PL/SQL
| 


| 
Benefits of PL/SQL

$%0 %$
1
DECLÔE

1
BEGIN

1
EXCEPTION

END;
)  |

'  |%.
' %$%%%.
)  |

' % %!$%


% % .
'  |%!%$.
)| %

' %#%%
' $$%%#%$ #
' $%
' $$%#
+ |$ $
%$2
Scott   
rocedure
1 xxxxxxxxxxxxxx
vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
2 vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
xxxxxxxxxxxxxx
vvvvvvvvvvvvvv
3 vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
xxxxxxxxxxxxxx vvvvvvvvvvvvvv
Oracle Oracle Oracle vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
Portal Discoverer Forms vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
Develo er vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
vvvvvvvvvvvvvv

4
Scott
|%#
'  |%*|.
' )+  |$%%$%$
$#%  | .
' )  |&
3  %
3 $%
3 %#
3 $%# %$
' | %%%$  |+"
$%$%!$.
' %+ %$
.
(% 4%%


 !"#!$
%
$! &
'
 0!%  |+
%$
' (! %%%
  |
' (%  |%%
' *%  |+
 |)+|
4  ,%-
4%%""5$$*
  ,%$%#-
3 |%
3  |%

  ,%-
!
4 ,%$%#-
1


 
1
1
 


*

|%%$
 |)+


 !
 
|
"#$%&&%
 
 ' (&%
 
)
*"+(#&&%




1


 
1
1
 


)+#

#
Ë ,
$
  
&%
2
 
&%
| 
/((0+
|
     
--.((%&(. --.((%&(. --.((%&(.

$
Ë , Ë , Ë ,

  
 % 
1


 
1
1
 


p     

       

    
    
      

      

     
     
    



Î4%%

4%%%$&
' %#% $%%
' %%$%
'
%#
' %%%
-%$ 4%%  |

' (%%$%0%%!
$%%.
'  %%%!
*%.
' %%  |+
! !%%.
' 4! !%%.
#4%%

'  |%%&
3 |%%
3 
3

A   ,% -
' 65  |%%&)$%$!
%%
Î á|7 4%%
8!  |)+
'  |$!%
%%#.

' %%%
!%  |+!%$ 
%%$.

' á|7 !,9$:-%%%


$%%!
 |+%+! á|7 
.
#4%%
25-JÔN-01

>#$
."#
&/
.&
0.
1#
#$
2(3.
#$13(
2#(3
$+#&
(3.
"#&(&&(4

&5
&(#&4
"#&"/
&
64
&/
//"(/

256120.08 (#
(3
+#+#.(#&
(3(

%&

"(/
7$8

Ôtlanta
(%   |4%%
Syntax:
á áá Ë |,
 Ë 
,

Ë 
9

 ,

Exam les:

3/( 
/+(&# '!
 


:;
#"(#& :<!

=(&(=
""#%%  |
'

:>;;
$(%   |
4%%
' 2% .
' %0%%$ %$% 
 %$   .
' (%$.
' %0$# !
á% %,-!
áá 
 

4  $$.
6% 

' %%%!%!%%"
$$!#%$+.
' !%%%,$-!$
!%%!%%$

%+#0/ '?!
!+.
 
| %+#0/
 %+#0/
 ' %+#0.
)
.(&%

=@#"33=

A
4%%%0%%$
;#$

'  %,-


 4  +#$
 á  %
áá 
 

|#%*&
3/(

=;:-B-;;:=

&%

='/$#=

*%&
|%%(%%#
Ä -old a single value
Ä -ave no internal com onents

25-OCT-99
>#$
."#
&/
.&
0.

1#
#$
2(3.
#$13(

2#(3
$+#&
(3.
"#&(&&(4

&5
&(#&4
"#&"/
&

256120.08 64
&/
//"(/
(#

(3
+#+#.(#&
(3(

%&

Ô  

"(/
7$8
)%|%%(%%#

 maximum_length(
  maximum_length(
  
  
  precision,
scale(
   

  
   
)%|%%(%%#

 4
   

   
    
   
    
 
      
  4   4
|%%4%%(%%

*%&

C# D!
"#$&( 6 

;
(#(. 'D4!

;
#//( 

|6| 
E
F
"(*(  |
'<4!

G
/