尝试将项目分配给嵌套 table 导致 PLS-00382:表达式类型错误。 PLSQL
Attempt to assign item to nested table cause PLS-00382: expression is of wrong type. PLSQL
我已经创建了嵌套 table,我想为它们分配项目。但是当我尝试这样做时我得到一个错误
Error at line 27, 28: PLS-00382: expression is of wrong type
而27、28行是用赋值的。
我声明了几个参数:
DECLARE
clubIdFirst NUMBER;
clubIdSecond NUMBER;
TYPE clubsIdsArray IS TABLE OF NUMBER;
nestedclubsIdsArray clubsIdsArray:=clubsIdsArray()
BEGIN
//assign values to clubIdFirst and clubIdSecond trying assign them to table
nestedclubsIdsArray .EXTEND(2);
nestedclubsIdsArray := clubIdFirst;
nestedclubsIdsArray := clubIdSecond;
为什么会这样?
您忘记说明要将值赋给哪个元素(请参阅第 11 和 12 行),例如:
SQL> DECLARE
2 clubIdFirst NUMBER;
3 clubIdSecond NUMBER;
4
5 TYPE clubsIdsArray IS TABLE OF NUMBER;
6 nestedclubsIdsArray clubsIdsArray:=clubsIdsArray();
7
8 BEGIN
9 --assign values to clubIdFirst and clubIdSecond trying assign them to table
10 nestedclubsIdsArray .EXTEND(2);
11 nestedclubsIdsArray (1):= clubIdFirst;
12 nestedclubsIdsArray (2):= clubIdSecond;
13 end;
14 /
PL/SQL procedure successfully completed.
SQL>
我已经创建了嵌套 table,我想为它们分配项目。但是当我尝试这样做时我得到一个错误
Error at line 27, 28: PLS-00382: expression is of wrong type
而27、28行是用赋值的。 我声明了几个参数:
DECLARE
clubIdFirst NUMBER;
clubIdSecond NUMBER;
TYPE clubsIdsArray IS TABLE OF NUMBER;
nestedclubsIdsArray clubsIdsArray:=clubsIdsArray()
BEGIN
//assign values to clubIdFirst and clubIdSecond trying assign them to table
nestedclubsIdsArray .EXTEND(2);
nestedclubsIdsArray := clubIdFirst;
nestedclubsIdsArray := clubIdSecond;
为什么会这样?
您忘记说明要将值赋给哪个元素(请参阅第 11 和 12 行),例如:
SQL> DECLARE
2 clubIdFirst NUMBER;
3 clubIdSecond NUMBER;
4
5 TYPE clubsIdsArray IS TABLE OF NUMBER;
6 nestedclubsIdsArray clubsIdsArray:=clubsIdsArray();
7
8 BEGIN
9 --assign values to clubIdFirst and clubIdSecond trying assign them to table
10 nestedclubsIdsArray .EXTEND(2);
11 nestedclubsIdsArray (1):= clubIdFirst;
12 nestedclubsIdsArray (2):= clubIdSecond;
13 end;
14 /
PL/SQL procedure successfully completed.
SQL>