繁体   English   中英

在 function 正文 oracle ZAC5C74B64B4B82AZ?EF?F 错误在第 6 行,但不知道如何解决?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM