csteifel
csteifel

Reputation: 2934

Oracle Command not properly ended

I am doing the following:

SELECT * FROM word_utils.substring_matches('abac');

Which from what I read should get the out parameter to display from this stored procedure.

It is declared as so

procedure substring_matches( str in varchar2, validwords out charcollection)

Why am I getting an error of Command not properly ended when I try doing this?

I can't figure out how I am supposed to be able to SELECT from this so I can test my results

charcollection is defined as such type charcollection is table of varchar(12);

Upvotes: 0

Views: 191

Answers (1)

Kirill Leontev
Kirill Leontev

Reputation: 10941

You cannot select from procedures. Try PIPELINED functions.

10:59:12 SYSTEM@dwal> create type tt as table of number
10:59:15   2  /

Type created.

Elapsed: 00:00:00.01
10:59:16 SYSTEM@dwal> create or replace function f
10:59:23   2  return tt pipelined as
10:59:30   3  begin
10:59:31   4  for i in 1 .. 10 loop
10:59:35   5  pipe row (i);
10:59:42   6  end loop;
10:59:44   7  end f;
10:59:46   8  /

Function created.

Elapsed: 00:00:00.16
10:59:47 SYSTEM@dwal> select * from table(f);

COLUMN_VALUE
------------
           1
           2
           3
           4
           5
           6
           7
           8
           9
          10

10 rows selected.

Elapsed: 00:00:00.02

Upvotes: 2

Related Questions