PL/SQL编程—函数
时间:2021-07-01 10:21:17
帮助过:20人阅读
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编程—函数
标签:bsp 操作 abc begin class cti color name 数据