dbTalk Databases Forums  

What character are valid in the name of a table?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss What character are valid in the name of a table? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ramon F Herrera
 
Posts: n/a

Default What character are valid in the name of a table? - 09-20-2009 , 03:42 PM






I am constructing a regular expression to check the validity of an
Oracle table name.

What characters are valid?

TIA,

-Ramon

Reply With Quote
  #2  
Old   
The Boss
 
Posts: n/a

Default Re: What character are valid in the name of a table? - 09-20-2009 , 04:05 PM






Ramon F Herrera wrote:
Quote:
I am constructing a regular expression to check the validity of an
Oracle table name.

What characters are valid?

http://download.oracle.com/docs/cd/E...lements008.htm

(carefully read about the difference between quoted and unquoted
identifiers)

HTH

--
Jeroen

Reply With Quote
  #3  
Old   
Phil Herring
 
Posts: n/a

Default Re: What character are valid in the name of a table? - 09-20-2009 , 05:25 PM



On Sep 21, 6:42*am, Ramon F Herrera <ra... (AT) conexus (DOT) net> wrote:

Quote:
What characters are valid?
Almost anything, if you use double quotes around the table name. You
can even amaze your friends by creating tables with names that contain
newlines and/or back spaces.


-- Phil

Reply With Quote
  #4  
Old   
Piet de Arcilla
 
Posts: n/a

Default Re: What character are valid in the name of a table? - 09-21-2009 , 12:29 AM



On Sep 20, 6:25*pm, Phil Herring <phil_herr... (AT) yahoo (DOT) com.au> wrote:
Quote:
On Sep 21, 6:42*am, Ramon F Herrera <ra... (AT) conexus (DOT) net> wrote:

What characters are valid?

Almost anything, if you use double quotes around the table name. You
can even amaze your friends by creating tables with names that contain
newlines and/or back spaces.

-- Phil
Unicode?

Reply With Quote
  #5  
Old   
Mark D Powell
 
Posts: n/a

Default Re: What character are valid in the name of a table? - 09-21-2009 , 09:30 AM



On Sep 20, 6:25*pm, Phil Herring <phil_herr... (AT) yahoo (DOT) com.au> wrote:
Quote:
On Sep 21, 6:42*am, Ramon F Herrera <ra... (AT) conexus (DOT) net> wrote:

What characters are valid?

Almost anything, if you use double quotes around the table name. You
can even amaze your friends by creating tables with names that contain
newlines and/or back spaces.

-- Phil
You will also create a nightmare for maintenance. I strongly suggest
sticking to the use of A - Z, 0 - 9, and underscore to all database
object names. Avoid using the dollar sign and pound characters that
Oracle sometimes uses in its names. By default if double quotes are
not used around the name Oracle will store it in uppercase. This
works best since then all table_name = and column_name = queries will
always be on upper('&name'), that is, table_name = 'UPPER'.

It will make writing the SQL to access the objects case insensative
since Oracle will tread TABLE_NAME, Table_Name, and table_name in SQL
exactly the same: TABLE_NAME.

select * from any_of_the_above_choices

HTH -- Mark D Powell --

Reply With Quote
  #6  
Old   
Phil Herring
 
Posts: n/a

Default Re: What character are valid in the name of a table? - 09-21-2009 , 05:29 PM



On Sep 22, 12:30*am, Mark D Powell <Mark.Pow... (AT) eds (DOT) com> wrote:

Quote:
You will also create a nightmare for maintenance. *I strongly suggest
sticking to the use of A - Z, 0 - 9, and underscore to all database
object names. *[&c.]
Sure. And Oracle recommend sticking to ASCII. And I get pretty annoyed
with people who use mixed case where it isn't appropriate. I've even
inherited code (I think it originated in a SQL Server system) that had
spaces in table and column names. Irritating.

However, if the question is "What characters are valid?", the answer
is still: "anything you can type with the keyboard in front of you".


-- Phil

Reply With Quote
  #7  
Old   
The Boss
 
Posts: n/a

Default Re: What character are valid in the name of a table? - 09-21-2009 , 05:46 PM



Phil Herring wrote:
Quote:
On Sep 22, 12:30 am, Mark D Powell <Mark.Pow... (AT) eds (DOT) com> wrote:

You will also create a nightmare for maintenance. I strongly suggest
sticking to the use of A - Z, 0 - 9, and underscore to all database
object names. [&c.]

Sure. And Oracle recommend sticking to ASCII. And I get pretty annoyed
with people who use mixed case where it isn't appropriate. I've even
inherited code (I think it originated in a SQL Server system) that had
spaces in table and column names. Irritating.

However, if the question is "What characters are valid?", the answer
is still: "anything you can type with the keyboard in front of you".

Not entirely true. From the link I provided earlier:

<q>
Nonquoted identifiers can contain only alphanumeric characters from your
database character set and the underscore (_), dollar sign ($), and pound
sign (#). Database links can also contain periods (.) and "at" signs (@).
Oracle strongly discourages you from using $ and # in nonquoted identifiers.

Quoted identifiers can contain any characters and punctuations marks as well
as spaces. However, neither quoted nor nonquoted identifiers can contain
double quotation marks or the null character (\0).

</q>

--
Jeroen

Reply With Quote
  #8  
Old   
Mark D Powell
 
Posts: n/a

Default Re: What character are valid in the name of a table? - 09-22-2009 , 08:37 AM



On Sep 21, 6:29*pm, Phil Herring <phil_herr... (AT) yahoo (DOT) com.au> wrote:
Quote:
On Sep 22, 12:30*am, Mark D Powell <Mark.Pow... (AT) eds (DOT) com> wrote:

You will also create a nightmare for maintenance. *I strongly suggest
sticking to the use of A - Z, 0 - 9, and underscore to all database
object names. *[&c.]

Sure. And Oracle recommend sticking to ASCII. And I get pretty annoyed
with people who use mixed case where it isn't appropriate. I've even
inherited code (I think it originated in a SQL Server system) that had
spaces in table and column names. Irritating.

However, if the question is "What characters are valid?", the answer
is still: "anything you can type with the keyboard in front of you".

-- Phil
My answer was directed to the serious adverse consequences of not
sticking to the standard non-quoted identifiers as detailed in the SQL
manual, which you had said were technically valid. It is a very bad
idea.

IMHO -- Mark D Powell --

Reply With Quote
  #9  
Old   
Shakespeare
 
Posts: n/a

Default Re: What character are valid in the name of a table? - 09-22-2009 , 08:55 AM



Mark D Powell schreef:
Quote:
On Sep 21, 6:29 pm, Phil Herring <phil_herr... (AT) yahoo (DOT) com.au> wrote:
On Sep 22, 12:30 am, Mark D Powell <Mark.Pow... (AT) eds (DOT) com> wrote:

You will also create a nightmare for maintenance. I strongly suggest
sticking to the use of A - Z, 0 - 9, and underscore to all database
object names. [&c.]
Sure. And Oracle recommend sticking to ASCII. And I get pretty annoyed
with people who use mixed case where it isn't appropriate. I've even
inherited code (I think it originated in a SQL Server system) that had
spaces in table and column names. Irritating.

However, if the question is "What characters are valid?", the answer
is still: "anything you can type with the keyboard in front of you".

-- Phil

My answer was directed to the serious adverse consequences of not
sticking to the standard non-quoted identifiers as detailed in the SQL
manual, which you had said were technically valid. It is a very bad
idea.

IMHO -- Mark D Powell --
alt-003 may have very surprising effects for some tools!

Shakespeare

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.