Home » SQL & PL/SQL » SQL & PL/SQL » Renaming Table
Renaming Table [message #194700] Sun, 24 September 2006 08:40 Go to next message
sauami
Messages: 54
Registered: October 2005
Location: india
Member
Dear Sir,

one of my Friend make a table with space like daily status now i want to rename this table to daily_status. how can i rename that table. while i am trying to renaming the table it's give a error because oracle can't read object name with space.

Thanks,
Saurabh
Re: Renaming Table [message #194701 is a reply to message #194700] Sun, 24 September 2006 09:31 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
SQL> create table "daily status" (col1 number, col2 varchar2(20));

Table created.

SQL> desc "daily status"
 Name                                      Null?    Type
 ----------------------------------------- -------- ---------------------------
 COL1                                               NUMBER
 COL2                                               VARCHAR2(20)


SQL> alter table "daily status" rename to daily_status;

Table altered.

SQL> desc "daily status"
ERROR:
ORA-04043: object "daily status" does not exist


SQL> desc daily_status
 Name                                      Null?    Type
 ----------------------------------------- -------- ---------------------------
 COL1                                               NUMBER
 COL2                                               VARCHAR2(20)

[Updated on: Sun, 24 September 2006 09:33]

Report message to a moderator

Re: Renaming Table [message #194712 is a reply to message #194701] Sun, 24 September 2006 15:15 Go to previous messageGo to next message
Claud
Messages: 17
Registered: July 2006
Junior Member
RENAME sourcetable TO destinationtable;
Re: Renaming Table [message #194811 is a reply to message #194712] Mon, 25 September 2006 07:51 Go to previous message
joy_division
Messages: 4644
Registered: February 2005
Location: East Coast USA
Senior Member
Claud wrote on Sun, 24 September 2006 16:15

RENAME sourcetable TO destinationtable;


Insufficient response. Yes, that works for a table that follows the proper naming convention, but I'd go with ebrian's complete response.
Previous Topic: SQL syntax help
Next Topic: standardize time series
Goto Forum:
  


Current Time: Sat Dec 10 01:22:55 CST 2016

Total time taken to generate the page: 0.07995 seconds