简体   繁体   English

尝试在 Oracle 中创建表类型时出现错误 PLS-00201

[英]Error PLS-00201 while trying to create table type in Oracle

When I run this code in Oracle 19c:当我在 Oracle 19c 中运行此代码时:

CREATE TYPE t_my_type IS TABLE OF my_table.my_col%TYPE;

I have this error:我有这个错误:

Type t_my_type compiled

LINE/COL  ERROR
--------- -------------------------------------------------------------
0/0       PL/SQL: Compilation unit analysis terminated
1/23      PLS-00201: identifier 'my_table.my_col' must be declared
Errors: check compiler log

Why does it says that it must be declared?为什么它说它必须声明?

Found answer here: https://community.oracle.com/tech/developers/discussion/3582858/pls-00201-when-declaring-table-type在这里找到答案: https://community.oracle.com/tech/developers/discussion/3582858/pls-00201-when-declaring-table-type

You can't use %TYPE in this case.在这种情况下,您不能使用%TYPE You must use some predefined Oracle type like NUMBER or create a collection.您必须使用一些预定义的 Oracle 类型,例如NUMBER或创建一个集合。

Example:例子:

CREATE TYPE t_my_type IS TABLE OF NUMBER;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM