Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TYPE

Status
Not open for further replies.

arpan

Programmer
Joined
Oct 16, 2002
Messages
336
Location
IN
I came across the following code in one website (I am providing the line numbers as well):

1.
DECLARE
2. TYPE typePopulation IS TABLE OF NUMBER INDEX BY VARCHAR2(64);
3. tPopCountryPopulation typePopulation;
4. tPopContinentPopulation typePopulation;
5. iHowMany NUMBER;
6. strWhich VARCHAR2(64);
7. BEGIN
8. tPopCountryPopulation('Greenland'):=100000;
9. tPopCountryPopulation('Iceland'):=750000;
10. iHowMany:=tPopCountryPopulation('Greenland');
11.
12.
tPopContinentPopulation('Australia'):=30000000;
13. tPopContinentPopulation('Antarctica'):=1000;
14. tPopContinentPopulation('Antarctica'):=1001;
15. strWhich:=tPopContinentPopulation.FIRST;
16. strWhich:=tPopContinentPopulation.LAST;
17. iHowMany:=tPopContinentPopulation(tPopContinentPopulation.LAST);
18. END;
19. /


I know that the 2nd line creates a TYPE named typePopulation but what does the statement IS TABLE OF NUMBER INDEX BY VARCHAR2(64) do? When the above is executed, the following errors are thrown:

PLS-00222: no function with name 'VARCHAR2' exists in this scope

which refers to line 2 in the above code &

PLS-00320: the declaration of the type of this expression is incomplete or malformed


which points to line 8, 9, 10, 12 & 13 in the above code. Why are the above errors getting generated? What's the solution to overcome for the above 2 errors?

Thanks,

Arpan
 
Are you running 9i? . . . INDEX BY VARCHAR2 is new and NOT in previous versions.
DaPi - no silver bullet
 
Yeah, I am running Oracle 9i. Could you please let me know where am I going wrong?

Thanks,

Regards,

Arpan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top