I am trying to convert a long data type to a varchar2 using a function but the function is not working.
Can someone tell me what could be the possible error?
Input parameter is LONG data type. I would like to return varchar2 from this function.
create or replace function func2 (p_long_text in long) return varchar2
as
v_long long;
v_text varchar2(4000);
begin
select p_long_text into v_long from all_ind_expressions where rownum = 1;
v_text := substr(v_long, 1,4000);
return v_text ;
end;
/
SQL> select func2 (column_expression) from all_ind_expressions a where a.index_owner = 'FACT' and rownum < 2;
select func2 (column_expression) from all_ind_expressions a where a.index_owner = 'FACT' and rownum < 2
*
ERROR at line 1:
ORA-00997: illegal use of LONG datatype