Navica:mysql函数创建基本操作。

在这里插入图片描述
1:函数名称
2:形参名称以及类型
3:返回值
4:定义变量:declare、default:默认值
5.查询结果赋值变量
6.返回变量

CREATE DEFINER=root@% FUNCTION Get_StationInfoByTrunkID(xxid int,instationid int,instationtype int) RETURNS varchar(60) CHARSET gbk
BEGIN
declare stationname varchar(255) default “”;
declare xxstationid int;
if(xxid>0) then
select Of_Station_ID into xxstationid from table1 where Dev_ID=xxid limit 1;
if(xxstationid>0) then
select Description into stationname from table2 where Dev_ID=xxstationid limit 1;
end if;
else
if(instationid>0 and instationtype >0) then
return Get_OfStationName(instationtype,instationid);
end if;
end if;
return stationname;
RETURN ‘’;
END

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值