Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Function to covert long data type

user520824Jun 22 2016 — edited Jun 23 2016

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

This post has been answered by Anton Scheffer on Jun 23 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 21 2016
Added on Jun 22 2016
14 comments
3,100 views