我看到错误,但帐户有效

发布于 2024-12-06 02:31:24 字数 1061 浏览 1 评论 0原文

 SQL> CREATE or REPLACE FUNCTION custord (custNo IN number)
 2     RETURN NUMBER
 3     IS cust_tot NUMBER(11,2);
 4     BEGIN
 5        SELECT sum(cust_total_field)
 6        INTO cust_tot
 7        FROM ord
 8        WHERE cust_number_field=custNo;
 9        RETURN(cust_tot);
 10      END;
 11  /

 Warning: Function created with compilation errors.

 SQL> begin
  2    dbms_output.put_line('customer 102 total is ' || custord(102));
  3  end;
  4  /
  dbms_output.put_line('customer 102 total is ' || custord(102));
                                                    *
  ERROR at line 2:
  ORA-06550: line 2, column 52:
  PLS-00905: object CIS605.CUSTORD is invalid
  ORA-06550: line 2, column 3:
  PL/SQL: Statement ignored


  SQL>

我看到错误,但对象 cis605 有效。我缺少什么想法吗?

使用 ORD 表创建一个名为 custord 的存储函数,该函数将使用客户 ID (CUSTID),该客户 ID 将返回指定客户 ID TOTAL 字段的总和。 存储函数后,运行以下 SQL: 开始 dbms_output.put_line('客户 102 总数为 ' || custord(102)); 结尾;

你的输出应该是这样的: 结果 解释 描述 已保存的 SQL 历史

客户 102 总计已

处理 27775.5 份报表。

 SQL> CREATE or REPLACE FUNCTION custord (custNo IN number)
 2     RETURN NUMBER
 3     IS cust_tot NUMBER(11,2);
 4     BEGIN
 5        SELECT sum(cust_total_field)
 6        INTO cust_tot
 7        FROM ord
 8        WHERE cust_number_field=custNo;
 9        RETURN(cust_tot);
 10      END;
 11  /

 Warning: Function created with compilation errors.

 SQL> begin
  2    dbms_output.put_line('customer 102 total is ' || custord(102));
  3  end;
  4  /
  dbms_output.put_line('customer 102 total is ' || custord(102));
                                                    *
  ERROR at line 2:
  ORA-06550: line 2, column 52:
  PLS-00905: object CIS605.CUSTORD is invalid
  ORA-06550: line 2, column 3:
  PL/SQL: Statement ignored


  SQL>

I see the error but object cis605 is valid. Any ideas what I am missing?

Using the ORD table create a stored function called custord that will use a customer id (CUSTID) that will return the sum of the specified customer id TOTAL field.
When your function has been stored run the following SQL:
begin
dbms_output.put_line('customer 102 total is ' || custord(102));
end;

Your output should look like:
Results
Explain
Describe
Saved SQL
History

customer 102 total is 27775.5

Statement processed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素衣风尘叹 2024-12-13 02:31:24

尝试一下

SHOW ERRORS FUNCTION custord

您的 custord 函数创建时存在编译错误,因此它有问题。这就是您收到object CIS605.CUSTORD is invalid 错误的原因。

Try

SHOW ERRORS FUNCTION custord

Your custord function was created with compilation errors, so there is something wrong with it. This is why you're getting the object CIS605.CUSTORD is invalid error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文