Hi All,
I have one function which transposes rows into columns ,
SQL> CREATE OR REPLACE Function mail_sep(cur sys_refcursor,p_email Varchar2) Return Varchar2
2 As
3 v_email Varchar2(1000);
4 h_email Varchar2(1000);
5 Begin
6 fetch cur into v_email;
7 v_email := ';'||v_email||';' ;
8 FOR cur IN 1 .. LENGTH (v_email) - LENGTH (REPLACE (v_email, ';', '')) - 1
9 Loop
10 return (SUBSTR (v_email,INSTR (v_email, ';', 1, cur) + 1,
11 INSTR (v_email, ';', 1, cur + 1) - INSTR (v_email, ';', 1, cur) - 1));
12 End Loop;
13 Close cur;
14 End;
15 /
Function created
But when i do the select i receive the following error
SQL> CREATE TYPE mail As Table Of Varchar2(200);
2 /
Type created
Select table(Cast(mail_sep(Cursor('X;Y;Z;A')) As mail)) From dual
ORA-00936: missing expression
Dont understand where i am going wrong please help me
Regards
Nic