[英]Error in function while using “between” keyword in function body oracle sql?? the error is on 6th line but donot kow how to resolve it?
create or replace function fweight
(minn in item.weight%type
,maxx in item.weight%type
,colour in item.color%type)
return number
is
total number(5);
begin
select count(itemno) into total from weight minn and maxx item where color = colour;
dbms_output.put_line('The item whose weight is between '||minn||' and '||maxx ||' is ');
return total;
end;
您没有使用between
,除非在字符串文字中。 查询的weight minn and maxx
部分不是有效的语法,并且没有真正意义,无论是在哪里还是作为where
子句的一部分。
根据您声明 arguments 的方式,您可能需要:
select count(itemno) into total
from item
where color = colour
and weight between minn and maxx;
依靠参数colour
和列名color
的拼写差异看起来有点危险; 可能会更好地为参数名称添加前缀以避免混淆。
db<> 摆弄一些虚构的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.