find a string in a long column

Experts -

How can I search for a string in a Long column like below?

select count(*) from dba_views where text like ('%@ABCPRD%')

I getting below error when I execute the above sql.

ORA-00932: inconsistent datatypes

Thanks,
sve
LVL 18
sventhanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ess KayEntrapenuerCommented:
you need to specify the column name instead of text

also, LONG is a number, should never have a string in it. you can convert to string
0
slightwv (䄆 Netminder) Commented:
You cannot use a LIKE with a LONG.

The best way I can find is creating your own function, convert the LONG to a CLOB and search that.

There is an example here:
https://forums.oracle.com/message/1420208



Now if dba_views was just for example and you have a table with a LONG you want to search you can also create a Text index on a LONG and use CONTAINS to look for text.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slightwv (䄆 Netminder) Commented:
>>also, LONG is a number, should never have a string in it. you can convert to string

Very incorrect.  LONGs are for large amounts of Text data before CLOBs.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

sventhanAuthor Commented:
@YZlat

I getting the same error
0
Ess KayEntrapenuerCommented:
@slightwv
yea sorry, i mixed it up with programming and by the time i realized it i couldnt retract that statement
0
Ess KayEntrapenuerCommented:
here is a method to convert long to varchar. then you simply search the varchars


http://www.arikaplan.com/oracle/ari11498.html
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.