Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Oracle / Oracle Server / August 2007

Tip: Looking for answers? Try searching our database.

Converting Data types using SQL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ciojr@yahoo.com - 31 Aug 2007 15:56 GMT
I have a table that has a column that is a data type of "LONG". The
data in this column is actually text (it's descriptions). Don't know
they history of why it was set up this way, but I cannot change it.
So, I am trying to use SQL to pull this column along with other
columns in the table. In my where clause I need to use the column in
question (which is called "service_description", for example) to
limit
the data I am pulling back. However, SQL does not allow me to use the
CAST or CONVERT or SUBSTR functions to convert the data in the field.
I get the error ORA-00997: illegal use of LONG datatype  or
ORA-00932:
inconsistent datatypes: expected NUMBER got LONG or some other ORACLE
error.
Is there some way to do this? I cannot change the data type of the
column, so I have to convert the data in the sql in order to use it
in
my where clause.
Thanks.

select *
from table_definitions
where service_description = 'TBD';
vitalisman@gmail.com - 31 Aug 2007 16:29 GMT
On Aug 31, 4:56 pm, ci...@yahoo.com wrote:

> select *
> from table_definitions
> where service_description = 'TBD';

LONG columns cannot be used in WHERE clauses.
Convert the column to CLOB and user to_char() in your WHERE clause.

Jerome
ciojr@yahoo.com - 31 Aug 2007 17:51 GMT
On Aug 31, 11:29 am, vitalis...@gmail.com wrote:
> On Aug 31, 4:56 pm, ci...@yahoo.com wrote:
>
[quoted text clipped - 6 lines]
>
> Jerome

Thank you for your reply, but I cannot convert the column within the
table. I was trying to find a way to do this within the sql statement.
But, from what you are telling me, it cannot be done via sql, it has
to be changed in the oracle table itself.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.