Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用“时函数出错”;介于;函数体中的关键字oracle sql??错误在第六行,但不知道如何解决?_Sql_Database_Oracle_Plsql - Fatal编程技术网

使用“时函数出错”;介于;函数体中的关键字oracle sql??错误在第六行,但不知道如何解决?

使用“时函数出错”;介于;函数体中的关键字oracle sql??错误在第六行,但不知道如何解决?,sql,database,oracle,plsql,Sql,Database,Oracle,Plsql,在之间不使用,除非在字符串文本中使用。查询的weight minn和maxx部分语法无效,无论是在何处,还是作为where子句的一部分,都没有真正意义 根据您声明参数的方式,您可能需要: create or replace function fweight (minn in item.weight%type ,maxx in item.weight%type ,colour in item.color%type) return number is

在之间不使用
,除非在字符串文本中使用。查询的
weight minn和maxx
部分语法无效,无论是在何处,还是作为
where
子句的一部分,都没有真正意义

根据您声明参数的方式,您可能需要:

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;
依靠参数
color
和列名
color
之间的拼写差异看起来有点危险;最好在参数名称前加前缀,以避免混淆


有一些虚构的数据。

我看不到那行中的'between'关键字?什么是“from weight minn and maxx item where”?这应该是连接两个表,还是检查item.weight作为where子句的一部分在两个值之间,还是其他什么?包括表格定义、样本数据和结果可能会有所帮助。非常感谢Alex Poole
select count(itemno) into total
from item
where color = colour
and weight between minn and maxx;