sql存储函数给出了一个错误
我正在尝试创建一个存储函数来接受一个名为budget的参数。对于小于或等于500000的预算,函数应返回字符串“LOW”;对于小于或等于850000的预算,函数应返回字符串“MID”;对于小于或等于1200000的预算,函数应返回字符串“HIGH”;对于大于1200000的预算,函数应返回字符串“ULTRA”。但是我得到了一个对我来说没有多大意义的错误 以下是我的功能:sql存储函数给出了一个错误,sql,error-handling,firebird,firebird-3.0,Sql,Error Handling,Firebird,Firebird 3.0,我正在尝试创建一个存储函数来接受一个名为budget的参数。对于小于或等于500000的预算,函数应返回字符串“LOW”;对于小于或等于850000的预算,函数应返回字符串“MID”;对于小于或等于1200000的预算,函数应返回字符串“HIGH”;对于大于1200000的预算,函数应返回字符串“ULTRA”。但是我得到了一个对我来说没有多大意义的错误 以下是我的功能: set term # ; create procedure f_rating(budget int) as begin i
set term # ;
create procedure f_rating(budget int)
as
begin
if (budget <= 500000) then
return ('LOW');
else if (budget <= 850000) then
return ('MID');
else if (budget <= 1200000) then
return ('HIGH');
else
return ('ULTRA');
end #
有人能帮我弄清楚这意味着什么吗?过程不返回任何值,函数返回 尝试: 而不是
create procedure f_rating(budget int)
as
问题是
你用的是什么数据库系统?我用的是Flamerobin数据库管理员
create function f_rating(budget int)
as
create procedure f_rating(budget int)
as
CREATE FUNCTION funcname [ ( [ <in_params> ] ) ]
RETURNS <domain_or_non_array_type> [COLLATE collation]
[DETERMINISTIC]
<module-body>
create function f_rating(budget int) RETURNS VARCHAR(5)
as
begin
if (budget <= 500000) then
return 'LOW';
else if (budget <= 850000) then
return 'MID';
else if (budget <= 1200000) then
return 'HIGH';
else
return 'ULTRA';
end #