Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find caracters in a field with long type

Status
Not open for further replies.

Cantor

Programmer
Apr 27, 2000
28
0
0
CA
Hi,

What I know:
If you want to find all records of the table PERSONS where the FIRSTNAME begins with 'Joh' (FIRSTNAME is a VARCHAR2 type column), you do that:
SELECT * FROM PERSONS WHERE FIRSTNAME LIKE 'Joh%';

What I ask:
How do you do that if the column is defined LONG type instead of VARCHAR2? Is it possible to do that?

Thanks
 
Yes, use the exact same syntax. eg:

Code:
SELECT * FROM tablename
WHERE col1 LIKE '100%'

Returns 100, 100342, 1002, 100999999 etc.. --James
 
Obviously, I try it before to post my question.
When I use this syntax (the same as you), I have a inconsistent datatypes error (ORA-00932).

The only solution I see is to write a PL/SQL program.
I'm trying this way.

Thanks
 
My query worked in SQL Server. I don't know about Oracle but I would imagine you should be able to utilise the equivalent to SQL Server's CONVERT() function to convert the numeric into a char type and test that.

I suggest you post your question in the Oracle forum and see what they say. --James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top