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: select in oracle

Re: select in oracle

From: Daniel A. Morgan <dmorgan_at_exesolutions.com>
Date: Mon, 08 Jan 2001 22:33:47 -0800
Message-ID: <3A5AB0CA.CABA6FD@exesolutions.com>

> I have an oracle table like the following:
>
> SQL> describe platform;
> Name Null? Type
> --------------------------------------------
> PLATFORMID NUMBER(1)
> NAME VARCHAR2(128)
> DESCRIPTION VARCHAR2(255)
>
> But when I try to get a simple select statement. I get an erorr:
>
> SQL> select * from platform where name = Win32;
> Input truncated to 1 characters
> select * from platform where name = Win32
> *
> ERROR at line 1:
> ORA-00904: invalid column name
>
> I need a single quote:
> SQL> select * from platform where name = 'WIN32';
>
> Is that I must use a single quote? Is that oracle on NT is not case
> sensitive? Since I can use upper and lower case for table name.
> Thanks.

You are confusing things a bit here. You need single quotes because the field is a VARCHAR2 with a content as text. The single quote marks tell Oracle, or for that matter any other ANSI compliant SQL engine that you are passing it a string. If the punctuation is not there the engine assumes that you are passing the name of a field (column name) or a variable.

If you are concerned about case sensitivity the solution is to cast the field value as in the following example:

SELECT *
FROM platform
WHERE UPPER(name) = 'WIN32';

In Oracle 8i you can also create function based indexes where the value stored in the index is cast to upper or lower case.

Dan Morgan Received on Tue Jan 09 2001 - 00:33:47 CST

Original text of this message

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