Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> Re: column name can't include character '-'

Re: column name can't include character '-'

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 19 Feb 2004 06:28:08 -0800
Message-ID: <2687bb95.0402190628.6a972fc4@posting.google.com>

"x" <x_at_x.hr> wrote in message news:<c11pqa$u56$1_at_ls219.htnet.hr>...
> IF you had a tale with columns
>
> a number
> b number
> a-b number
>
> what would return
>
> select a-b from x
>
> ?

Obviously a minus b:

SQL> @test
SQL> create table marktest3 (
  2 a number, b number, "a-b" number);

Table created.

SQL> desc marktest3

 Name                                      Null?    Type
 ----------------------------------------- --------
----------------------------
 A                                                  NUMBER
 B                                                  NUMBER
 a-b                                                NUMBER


SQL>
SQL> insert into marktest3 values (6,4,9);

1 row created.

SQL> commit;

Commit complete.

SQL>
SQL> select a, b, a-b, "a-b" from marktest3;

         A B A-B a-b ---------- ---------- ---------- ----------

         6 4 2 9

SQL>
SQL> drop table marktest3;

Table dropped.

If you need a col "a-b" it would be better to name it a_minus_b, diff_a_b, or some such than use double quotes to create potential problems for users.

HTH -- Mark D Powell -- Received on Thu Feb 19 2004 - 08:28:08 CST

Original text of this message

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