Re: Reserved words in Oracle query

[email protected] Mon, 24 Mar 2003 12:15:08 +0000
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-925199-2003.03.24-12.15.22--gcdod-oracle#[email protected]>
Hi Graham,

      I have never come across this kind of [notation] in oracle and having
just tried it on a 8.1.7 instance it does not seem to work....

create table testable ( "UNIQUE" varchar2(100))
/
select "UNIQUE" from testable
/

works. but the words in quotes need to be of the same case as the table
definition.


You can "rename" the oracle column at statement level by using a column
alias such as .

  1* select ename "name" from emp
SQL> /

name
----------
SMITH
ALLEN
WARD
JONES

It looks like you're trying to write a database independent system so you
might want to look at using views to
"rename" the table columns to fit into your system but then down the line
you may run into further problems.

As an aside
      we prefix all our columns with a 2 or 3 letter short table name for
example
"emp_surname" as opposed to just "surname" in the employees table.
this enables our developers to write more easily readable code.
we also prefix our table names with a short system name eg HR_EMPLOYEES
rather than EMPLOYEES.


Regards
Chris Farmer



                                                                                                                                       
                      [email protected]                                                                                                
                      .uk                      To:       "Oracle" <[email protected]>                                                
                                               cc:                                                                                     
                      24/03/2003 12:04         Subject:  [oracle] Reserved words in Oracle query                                       
                      Please respond to                                                                                                
                      "Oracle"                                                                                                         
                                                                                                                                       
                                                                                                                                       




Hi

We have a web application that currently runs quite happily with SQL
Server and Access databases. Some of the table column names are reserved
words like "Unique" and "Ascending" for historical reasons. What we
normally do is just put [] round the elements in the query to ensure that
there is no confusion.

The programmer who is now responsible for the databases and in particular
Oracle does not want to do this but instead wants to rewrite the whole
system to prefix all table and field names with "FF_" but is reluctant to
explain his reasoning for this.

What are the implications with leaving [] around field names in Oracle?
Is it supported?
Are there likely to be any other issues?

I'd appreciate any views as this just seems to me like it is going to add
major delays and complications to this particular project.

Regards
Graham
---
Change your mail options at http://p2p.wrox.com/manager.asp or
to unsubscribe send a blank email to %%email.unsub%%.






---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to [email protected].