1. 程式人生 > >PL/SQL編程—函數

PL/SQL編程—函數

必須 var turn clas created cti weight num 開頭

技術分享

SQL> select * from mytest;
 
ID    NAME                 PASSWD                                                                                         SALARY
----- -------------------- -------------------- --------------------------------------------------------------------------------
1     gagaga               123
100 2 gaodingle!!!! 123 100 3 gagaga 123 100
SQL> SQL> create function annual_calsaly(id_in varchar2) 2 return 3 number is calsaly number(7,2); 4 begin 5 select salary*12 into calsaly from mytest where id =id_in; 6 return calsaly; 7 end; 8 / Function created SQL> var abc number; SQL> call annual_calsaly(
1)into:abc; Method called abc --------- 1200
函數必須要有返回值的在函數的開頭 return 返回類型 is 返回變量名 具體類型 在begin操作完數據後在把對應的變量進行返回 return 返回變量名

PL/SQL編程—函數