目前这是我使用此功能的方式:
TYPE strings IS TABLE OF VARCHAR(255) INDEX BY BINARY_INTEGER;
str_columns strings;
function parse ( prc_string in varchar,
prc_delim in varchar ) return strings as
str_record varchar(32767) := '';
str_field varchar(255) := '';
int_length integer := 0;
int_sub integer := 0;
int_count integer := 0;
str_fields strings;
begin
str_record := trim(prc_string) || prc_delim;
int_length := length(str_record);
if int_length = 0 then
int_count := -1;
return str_fields;
end if;
loop
int_sub := int_sub + 1;
exit when int_sub > int_length;
if substr(str_record,int_sub,1) <> prc_delim then
str_field := str_field || substr(str_record,int_sub,1);
else
int_count := int_count + 1;
str_fields(int_count) := str_field;
str_field := '';
end if;
end loop;
return str_fields;
end;
str_columns := parse_function(inp_buffer, ',');
我需要能够把它变成一个函数,并从许多过程中调用它。它使用逗号分隔符解析文本。我尝试在 SQL Navigator 中使用集合类型和函数,但收到错误表达式类型错误。
本质上,此过程会打开一个文本文件并对其进行解析。