How to Create a Table in Oracle with name [email protected]
I tried doing CREATE TABLE [email protected](..)
but this gives me error so i was looking for some other way of doing it
How to Create a Table in Oracle with name [email protected]
I tried doing CREATE TABLE [email protected](..)
but this gives me error so i was looking for some other way of doing it
I think is a not good way to place @.
charactes in name of a table.
I think is a not good way to create each table per one email user. Propably you have big database design problem and you trying to find solution where it not exists.
Think about database emails
, table users
there each user have unique ID
and username
and domain
in other column. On ID
column you have create index, then you have some thing to find and add relationship of user instance in other tables.
To use non standard characters in identifiers you can delimit with double quotes.
CREATE TABLE "[email protected]"(a int);
NB: Some of the discussion on this question reminded me of a simple talk article. I just tested and this is possible in Oracle as well.
CREATE TABLE "╚╦╩╗" ( "└┬┴┐" nvarchar2(10));
INSERT INTO "╚╦╩╗" VALUES ( '└┬┴┐' );
SELECT * FROM "╚╦╩╗";
Note I am not suggesting that anybody actually does this.
Either:
Put double-quotes around your table name:
CREATE TABLE "[email protected]" ...
Don't put special characters in your table names.
Future users of your database will thank you profusely if you choose option 2.
From http://ora-903.ora-code.com/:
ORA-00903: invalid table name
Cause: A table or cluster name is invalid or does not exist. This message is also issued if an invalid cluster name or no cluster name is specified in an ALTER CLUSTER or DROP CLUSTER statement.
Action: Check spelling. A valid table name or cluster name must begin with a letter and may contain only alphanumeric characters and the special characters $, _, and #. The name must be less than or equal to 30 characters and cannot be a reserved word.
Martin and CanSpice have pointed out that it's technically possible, but, yeah... you're asking for plenty of trouble with this approach. And why (on earth) would you name a table after an email address in the first place? I'd be fascinated to know.
What an odd name for a table.
I don't have access to an Oracle instance to find out which error you are getting, but it will refer to the third point below:
That email address looks like it should be in the table, as data.
Have a think about what you are going to store in the table and that should give you a more appropriate table name.
If you must, you could always name the table "abc_at_gmail.com" and get on with it.
I believe the at-sign means "link to another database" in Oracle. You're out of luck in preserving the e-mail address.
If you really need multiple e-mail addresses, why wouldn't you create a users table and have multiple rows, one per e-mail address, and make e-mail address a unique index on the table? Your design idea must be breaking some normalization rule.