• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 482
  • Last Modified:

explaining function

 FUNCTION str2tblvarchar(i_str IN VARCHAR2) RETURN cq_pdrsearchtype AS
    v_str  LONG DEFAULT i_str || ',';
    v_n    NUMBER;
    v_data cq_pdrsearchtype := cq_pdrsearchtype();
  BEGIN
    LOOP
      v_n := INSTR(v_str, ',');
      EXIT WHEN(NVL(v_n, 0) = 0);
      v_data.EXTEND;
      v_data(v_data.COUNT) := LTRIM(RTRIM(SUBSTR(v_str, 1, v_n - 1)));
      v_str := SUBSTR(v_str, v_n + 1);
    END LOOP;
    RETURN v_data;
  END;
can someone explain the function code
0
thota198
Asked:
thota198
  • 2
1 Solution
 
sdstuberCommented:
it builds a collection object from a comma delimited string.

so, for instance.

'a,b,c,d'

would become a collection (like an array)
'a'
'b'
'c'
'd'
0
 
sdstuberCommented:
you could try using it like this...


select * from table(str2tblvarchar('a,b,c,d'))

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now