Kalana
Kalana

Reputation: 6143

Type created with compilation errors in Oracle

I have tried to run two script in oracle sqlplus

create type virus_Statistic_t as object(
    vDate date,
    infection int,
    dead int,
    recovered int
)
/

Above script run without any errors.

But after that when I tried to run this script

create type countries_t as object(
    Province_or_State varchar2(50),
    Country_or_Region varchar2(100),
    Lat Number(10,0),
    Long Number(10,0),
    virus virus_Statistic_t
)
/

This give me some warnings

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      PL/SQL: Compilation unit analysis terminated
5/1      PLS-00330: invalid use of type name or subtype name

How can I avoid this?

Upvotes: 1

Views: 160

Answers (1)

Popeye
Popeye

Reputation: 35900

Your issue is not related to subtype.

It is error because you are using the oracle reserved keyword as field name: Long Number(10,0),

Change it to something like: Long_ Number(10,0), and everything will work fine.

Upvotes: 2

Related Questions