首页 > 解决方案 > 错误的号码或循环输入

问题描述

收到此错误:

ERROR at line 5:
ORA-06550: line 5, column 19:
PLS-00306: wrong number or types of arguments in call to 'DAYS'

所以这是一个粗体的“天”的问题......为什么?

CREATE OR REPLACE
  TYPE lyrics IS OBJECT
  ( date_name   VARCHAR2(8)
  , gift_name   VARCHAR2(24));
/

DECLARE
  TYPE days IS TABLE OF lyrics;
  TYPE gifts IS TABLE OF lyrics;
 lv_dates DAYS :=
                  **days**('first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth', 'eleventh', 'twelth');  

标签: sqloracleplsqldeclare

解决方案


那将是这样的;数组中的元素必须是“对象”,因此您必须lyrics在代码中指定:

SQL> create or replace
  2    type lyrics is object
  3    ( date_name   varchar2(8)
  4    , gift_name   varchar2(24));
  5  /

Type created.

SQL>
SQL> declare
  2    type days is table of lyrics;
  3    lv_dates days := days();
  4  begin
  5    lv_dates := days(lyrics('first', 'second'), lyrics('third', 'fourth'));
  6  end;
  7  /

PL/SQL procedure successfully completed.

SQL>

推荐阅读