【问题标题】:I see the error but the account is valid我看到错误,但帐户有效
【发布时间】:2011-09-24 23:36:27
【问题描述】:
 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

声明已处理。

【问题讨论】:

  • 你有ORD表的权限吗?

标签: sql oracle sqlplus


【解决方案1】:

试试

SHOW ERRORS FUNCTION custord

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

【讨论】:

    猜你喜欢
    • 2016-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-25
    • 1970-01-01
    • 2017-01-14
    • 2012-01-11
    相关资源
    最近更新 更多