Harshana
Harshana

Reputation: 7647

array must be declare error in pl sql

I want to return a array in a function as my function looks like below,

CREATE OR REPLACE FUNCTION TEST  
RETURN t_array 

IS 
strings t_array;

BEGIN
--do something
RETURN strings; 
END:

But it gives a error t_array must be declare. I want to know where to declare it and how can i declare it?

Upvotes: 0

Views: 1977

Answers (1)

Armunin
Armunin

Reputation: 996

When you are using a custom type, you have to declare that type first. For example:

CREATE OR REPLACE TYPE string_array IS TABLE OF varchar2(50);

Which creates a new type named string_array that is a table of varchars.
For more information check the official oracle dokumentation here

Upvotes: 2

Related Questions