Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: HELP- Code for SQL Single Row Character Function?

Re: HELP- Code for SQL Single Row Character Function?

From: Tony Andrews <andrewst_at_onetel.com>
Date: 30 Sep 2004 09:50:36 -0700
Message-ID: <1096563036.707570.108240@h37g2000oda.googlegroups.com>


Mario King wrote:
> I'm trying to write a function long2ch() to convert
> table's LONG column to varchar2 so that I could run
> select * from tab where long2ch(long_col) like '%MY String%'.
> -- I want to make long2ch() similar to upper(), trim()...

Sorry, but that's just not going to happen:

SQL> create or replace function long2ch( p_long in long ) return varchar2 is
2 begin
3 return p_long;
4 end;
5 /

Function created.

SQL> select * from user_views
2 where long2ch(text) like '%EMP%';
where long2ch(text) like '%EMP%'
*
ERROR at line 2:
ORA-00997: illegal use of LONG datatype

The problem is that you can't pass the LONG value INTO the function at all!

Maybe you could be using CLOB instead? Received on Thu Sep 30 2004 - 11:50:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US