TO Rename a column name

Hi all,
I have a table employee with columns
'employee_id',
'employee_name'
' employee_city' ( Note the spaces before the column name )
The table is created successfully.
But i cant to able to retreive the data by specifying the column name..
eg: select employee_city from employee.
It throws an error.
Please send me a solution to reanme the column name, so that it should not contain any spaces at start & end.
Thanks & Regards,
Hariharan ST

Obviously the table was created this way:
SQL>create table testtab
"employee_id" number,
"employee_name" varchar2(100),
" employee_city" varchar2(100)
Table created.
SQL>desc testtab
Name                                      Null?    Type
employee_id                                        NUMBER
employee_name                                      VARCHAR2(100)
  employee_city                                     VARCHAR2(100)Note the double quotes: Columns that are created this way can only be selected using double quotes, too:
SQL>select employee_city from testtab;
select employee_city from testtab
ERROR at line 1:
ORA-00904: "EMPLOYEE_CITY": invalid identifier
SQL>select " employee_city" from testtab;
employee_city
Chicago
SQL>This of course is a very bad idea. Dave already showed you how to rename the columns.
Regards,
Gerd

Similar Messages

  • How to rename a column name in a table? Thanks first!

    I tried to drop a column age from table student by writing the
    following in the sql plus environment as :
    SQL> alter table student drop column age ;
    but I found the following error
    ORA-00905: 缺少关键字 (Lack of Key word)
    I have oracle enterprise edition 8.0.5 installed at windows 2000
    thank you
    And I want to know how to rename a column name in a table?
    thanks

    In Oracle 8i, your syntax would have worked.  However, if I
    recall correctly, in Oracle 8.0, you can't rename or drop a
    column directly.  One way to get around that problem is to
    create another table based on a select statement from your
    original table, providing the new column name as an alias if you
    want to change the column name, or omitting that column from the
    select statement if you just want to drop it.  Then drop the
    original table.  Then re-create the original table based on a
    select statement from the other table.  Then you can drop the
    other table.  Here is an example:
    CREATE TABLE temporary_table_name
    AS
    SELECT age AS new_column_name,
           other_columns
    FROM   student
    DROP TABLE student
    CREATE TABLE student
    AS
    SELECT *
    FROM   temporary_table_name
    DROP TABLE temporary_table_name
    Something that you need to consider before doing this is
    dependencies.  You need to make a list of all your dependecies
    before you do this, so that you can re-create them afterwards. 
    If there are a lot of them, it might be worthwhile to do
    something else, like creating a view with an alias for the
    column or just providing an alias in a select.  It depends on
    what you need the different column name for.

  • How to rename the column name in oracle 8i?

    hi,
    Does anyone know how to rename the column name in oracle 8i?My method was drop the relationship key first then delete the old column,finally add the new column.
    Thanks for your replay.
    jing

    There is no facilty to rename a column name in Oracle 8i. This is possible from Oracle 9.2 version onwards.
    For you task one example given below.
    Example:-
    Already existed table is ITEMS
    columns in ITEMS are ITID, ITEMNAME.
    But instead of ITID I want ITEMID.
    Solution:-
    step 1 :- create table items_dup
    as select itid itemid, itemname from items;
    step 2 :- drop table items;
    step 3 :- rename items_dup to items;
    Result:-
    ITEMS table contains columns ITEMID, ITEMNAME

  • Rename the column names in Embedded BPM Worklist

    Hi,
    I have embedded the BPM worklist in ADF Page.
    My requirement is to rename the column names in the task list.
    For example, the column 'state' should be renamed as 'Status' and the column 'from User' should be renamed as 'From'.
    Is there any possibility to achieve this? Please let me know.
    Regards,
    Tamil

    See if the solution in this post helps -
    Re: Customize workspaceAlso , its better to post these questions in the BPM forum -
    Business Process Management SuiteEdited by: Sudipto Desmukh on Apr 27, 2012 8:57 AM

  • Rename a column name

    Hi All,
    Can rename a column name permanantly.?
    Please clarify

    Yes. It is possible
    alter table some_table rename column column_name to new_column_name;
    Regards
    K.Rajkumar

  • How to rename a column name

    dear friends,
    Is there any other way to rename a column without creating another table with the requested colum name and dropping the eariler table after inserting the values from it.

    SQL> desc t2
    Name                                      Null?    Type
    ID2                                                NUMBER
    SQL> alter table t2 rename column id2 to id;
    Table altered.
    SQL> desc t2
    Name                                      Null?    Type
    ID                                                 NUMBERRgds.
    ...but don't forget side effects !
    SQL> create or replace view v2 as select id from t2;
    View created.
    SQL> select status from user_objects where object_name = 'V2';
    STATUS
    VALID
    SQL> alter table t2 rename column id to id2;
    Table altered.
    SQL> select status from user_objects where object_name = 'V2';
    STATUS
    INVALID
    SQL> select * from v2;
    select * from v2
    ERROR at line 1:
    ORA-04063: view "SCOTT.V2" has errorsMessage was edited by:
    dnikiforov

  • Rename the Column Name in the Repository

    Hi,
    after creation the Repository and some Answers I want to change the name of some columns in the Repository (Presentation Layer or Busines Layer).
    After changing this column names the answers will not work any more until I replace the columns in answers.
    Has got somebody experience with changing column names in Repository and Catalog without replacing the columns in answers?
    Regards,
    Stefan

    Rename the objects in the Business Model Layer and that would get automatically reflected in Presentation Layer. In order for presentation layer to remain constant just double click on the columns and uncheck the "Use Logical Column Names". This would ensure that your presentation layer is not renamed when you rename the BM.
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • How to rename a column name while copying it from another table

    Hi All,
    I am copying rows between two table TableA to TableB
    but I wanted to insert data in he column name (username) in tableA to a column named (NewUser) in tableB
    How do I go about that?
    insert into TableB
    select Username
    from TableA
    Thanks

    If you want to only move username, then just specify the column name for TableB, that is
    insert into TableB(NewUser)
    select Username
    from TableA
    If you want to move all (or some) of the columns while putting Username in a column named NewUser, just list the columns in both the insert into part and the select part, for example
    insert into TableB(NewUser, ColA, ColB, ColC)
    select Username, ColA, ColB, ColC
    from TableA
    Tom

  • Rename column name of a table

    Hi Guys,
    I want to rename the column name of a table. Lets say I have table employee:
    SQL> desc emp;
    Name Null? Type
    EMPNO NOT NULL NUMBER(4)
    ENAME VARCHAR2(10)
    JOB VARCHAR2(9)
    MGR NUMBER(4)
    HIREDATE DATE
    SAL NUMBER(7,2)
    COMM NUMBER(7,2)
    DEPTNO NUMBER(2)
    STARS VARCHAR2(8)
    I want to change the name of the cloumn name of ENAME to EMPNAME so that structure looks like this:
    SQL> desc emp;
    Name Null? Type
    EMPNO NOT NULL NUMBER(4)
    EMPNAME VARCHAR2(10)
    JOB VARCHAR2(9)
    MGR NUMBER(4)
    HIREDATE DATE
    SAL NUMBER(7,2)
    COMM NUMBER(7,2)
    DEPTNO NUMBER(2)
    STARS VARCHAR2(8)
    Can anyone tell me any statement or way to solve this problem. Please keep in mind that I will not delete the table or create another column name of EMPNAME and copy the data from ENAME to EMPNAME.
    Regds,
    Debabrata

    ALTER TABLE DEPT2 RENAME COLUMN ENAME TO EMPNAME
    Regards,
    Raj

  • Changing the Column Name in Criteria is not reflected on the Column Selecto

    When we rename the column name in the Criteria, it is not being reflected on the Column Selector drop down list.

    Since you have to add the columns from the presentation layer to the column selector view, my guess is you would have to rename the columns at the presentation layer to accomplish that.

  • How to rename voting disk name in oracle clusterware 11gr2

    Hi:
    I need change the name of voting disk at os level, original name is /dev/rhdisk20, I need rename to /dev/asmocr_vote1 (unix AIX), the voting disk is locate in ASM diskgroup +OCR.
    Initial voting disk was: /dev/rhdisk20 in diskgroup +OCR
    #(root) /oracle/GRID/11203/bin->./crsctl query css votedisk
    ## STATE File Universal Id File Name Disk group
    1. ONLINE a2e6bb7e57044fcabf0d97f40357da18 (/dev/rhdisk20) [OCR]
    I createt a new alias disk name:
    #mknod /dev/asmocr_vote01 c 18 10
    # /dev->ls -lrt|grep "18, 10"
    brw------- 1 root system 18, 10 Aug 27 13:15 hdisk20
    crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 16:57 rhdisk20 --> Old name
    crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 16:59 asmocr_vote01 ---> alias to old name, the new name.
    After change votingn disk unix name, the cluster doesn't start, voting disk is not found by CRSSD.
    -STEPS to start clusterware after changing the OS voting disk name are:
    1- stop al nodes:
    #crsctl stop crs -f (every node)
    Work only in one node (node1, +ASM1 instance):
    2- Change asm_diskstring in init+ASM1.ora:
    asm_diskstring = /dev/asm*
    3- change disk unix permiss:
    # /dev->ls -lrt|grep "18, 10"
    brw------- 1 root system 18, 10 Aug 27 13:15 hdisk20
    crw-rw---- 1 root system 18, 10 Sep 6 16:59 asmocr_vote01
    crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 17:37 rhdisk20
    #(root) /dev->chown oracle:asmadmin asmocr_vote01
    #(root) /dev->chown root:system rhdisk20
    #(root) /dev->ls -lrt|grep "18, 10"
    brw------- 1 root system 18, 10 Aug 27 13:15 hdisk20
    crw-rw---- 1 oracle asmadmin 18, 10 Sep 6 16:59 asmocr_vote01 --> new name only have oracle:oinstall
    crw-rw---- 1 root system 18, 10 Sep 6 17:37 rhdisk20
    4-start node in exclusive mode:
    # (root) /oracle/GRID/11203/bin->./crsctl start crs -excl
    CRS-4123: Oracle High Availability Services has been started.
    CRS-2672: Attempting to start 'ora.mdnsd' on 'orarac3intg'
    CRS-2676: Start of 'ora.mdnsd' on 'orarac3intg' succeeded
    CRS-2672: Attempting to start 'ora.gpnpd' on 'orarac3intg'
    CRS-2676: Start of 'ora.gpnpd' on 'orarac3intg' succeeded
    CRS-2672: Attempting to start 'ora.cssdmonitor' on 'orarac3intg'
    CRS-2672: Attempting to start 'ora.gipcd' on 'orarac3intg'
    CRS-2676: Start of 'ora.cssdmonitor' on 'orarac3intg' succeeded
    CRS-2676: Start of 'ora.gipcd' on 'orarac3intg' succeeded
    CRS-2672: Attempting to start 'ora.cssd' on 'orarac3intg'
    CRS-2672: Attempting to start 'ora.diskmon' on 'orarac3intg'
    CRS-2676: Start of 'ora.diskmon' on 'orarac3intg' succeeded
    CRS-2676: Start of 'ora.cssd' on 'orarac3intg' succeeded
    CRS-2672: Attempting to start 'ora.ctssd' on 'orarac3intg'
    CRS-2672: Attempting to start 'ora.drivers.acfs' on 'orarac3intg'
    CRS-2679: Attempting to clean 'ora.cluster_interconnect.haip' on 'orarac3intg'
    CRS-2681: Clean of 'ora.cluster_interconnect.haip' on 'orarac3intg' succeeded
    CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'orarac3intg'
    CRS-2676: Start of 'ora.ctssd' on 'orarac3intg' succeeded
    CRS-2676: Start of 'ora.drivers.acfs' on 'orarac3intg' succeeded
    CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'orarac3intg' succeeded
    CRS-2672: Attempting to start 'ora.asm' on 'orarac3intg'
    CRS-2676: Start of 'ora.asm' on 'orarac3intg' succeeded
    CRS-2672: Attempting to start 'ora.crsd' on 'orarac3intg'
    CRS-2676: Start of 'ora.crsd' on 'orarac3intg' succeeded
    5-check votedisk:
    # (root) /oracle/GRID/11203/bin->./crsctl query css votedisk
    Located 0 voting disk(s).
    --> NO VOTING DISK found
    6- mount diskgroup of voting disk (+OCR in this case) in +ASM1 instance:
    SQL> ALTER DISKGROUP OCR mount;
    7-add votedisk belongs diskgroup +OCR:
    # (root) /oracle/GRID/11203/bin->./crsctl replace votedisk +OCR
    Successful addition of voting disk 86d8b12b1c294f5ebfa66f7f482f41ec.
    Successfully replaced voting disk group with +OCR.
    CRS-4266: Voting file(s) successfully replaced
    #(root) /oracle/GRID/11203/bin->./crsctl query css votedisk
    ## STATE File Universal Id File Name Disk group
    1. ONLINE 86d8b12b1c294f5ebfa66f7f482f41ec (/dev/asmocr_vote01) [OCR]
    Located 1 voting disk(s).
    8-stop node:
    #(root) /oracle/GRID/11203/bin->./crsctl stop crs –f
    8-start node:
    #(root) /oracle/GRID/11203/bin->./crsctl start crs
    10- check:
    # (root) /oracle/GRID/11203/bin->./crsctl query css votedisk
    ## STATE File Universal Id File Name Disk group
    1. ONLINE 86d8b12b1c294f5ebfa66f7f482f41ec (/dev/asmocr_vote01) [OCR]
    Vicente.
    HP.
    Edited by: 957649 on 07-sep-2012 13:11

    There is no facilty to rename a column name in Oracle 8i. This is possible from Oracle 9.2 version onwards.
    For you task one example given below.
    Example:-
    Already existed table is ITEMS
    columns in ITEMS are ITID, ITEMNAME.
    But instead of ITID I want ITEMID.
    Solution:-
    step 1 :- create table items_dup
    as select itid itemid, itemname from items;
    step 2 :- drop table items;
    step 3 :- rename items_dup to items;
    Result:-
    ITEMS table contains columns ITEMID, ITEMNAME

  • How can i replace column name using reciever JDBC adapter on runtime.

    Hi Experts,
    I have a problem with reciever JDBC synario.
    Target Oracle table has columns named 2 bytes Japanese character like "日本".
    Datatype cannot accept 2bytes character as element name.
    So, I would like to how to replace column name on runtime.
    Please tell me.
    Regards,
    Shinya Kawaoge

    Hi Shinya Kawagoe,
    I understand there is a column with two Japanese characters in target database table. Now you want to UPDATE or INSERT data in that table. You do not want to rename the column name in the database table (if you want to rename column, ask the target database admin ).
    As Japanese characters are not allowed in XML Data Type in ESR. You can [Define a SQL_QUERY Statement|http://help.sap.com/saphelp_nwpi711/helpdata/en/44/7b7855fde93673e10000000a114a6b/frameset.htm]. Check the Addres日本s in below code.
    <root>
      <stmt>
        <Customers action="SQL_DML">
          <access> UPDATE Customers SET CompanyName=u2019$NAME$u2019, Addresu65E5u672Cs=u2019$ADDRESS$' WHERE CustomerID='$KEYFIELD$u2019
          </access>
          <key>
            <NAME>Firma</NAME>
            <ADDRESS>Strasse 3 </ADDRESS>
            <KEYFIELD>FI</KEYFIELD>
          </key>
        </Customers>
      </stmt>
    </root>
    Regards,
    Raghu_Vamsee

  • Odi REVERSE ENGINEERING AFTER RENAMING  A COLUMN.

    hi,
    i have altered the table definition .
    i have just renamed the columns name .
    now when i reverse engineer , the model contains new as well old columns.
    is there any way by which i can rename existing columns to the new one.

    No. You cannot.
    ODI doesnt know what your intentions were with the column renames.
    It doesnt remove the columns during reverse engineering that dont exist in the database because the columns in ODI maybe used in the mappings.
    The only way you can do is by doing it manually in ODI by renaming them

  • ORA-17414: Insufficient Buffer size to store Columns Names

    Hi,
    During data retrieval from an Oracle 8.0.6 database (on HP-Unix) we get the following error: "Insufficient Buffer size to store Columns Names". This error is registered as ORA-17141 (???). At least this is what we see if we have a look at the JDBC driver (8.1.6 driver for Java 1.2.x in file "Message.properties" of the "classes12.zip")
    We cannot find any further explanation for this problem. Which buffer size is meant? Can this buffer be adjusted? Is this an oracle buffer or an buffer used by java?
    Thanks,
    Ronald

    Thom,
    How many columns are there in your query? Do they have lengthy column names? Has your schema or query changed during the upgrade?
    One possible workaround if you have lengthy column names in your query is to try doing something like "select somelongcolumnname1 as c1, somelongcolumnname2 as c2 ..." and see if it works. Admittedly, this is only a workaround, but it should be better than renaming your column names.

  • Insufficient Buffer size to store Columns Names

    I am using WebSphere 3.02 with Oracle on OS/390. Some of my servlets work but some get the error:
    Insufficient Buffer size to store Columns Names
    This is a Oracle error, ORA-17414. All of the doc says:
    Note: Cause and action for each message will be provided in a later release.
    This was in 1999, and I still cannot find cause and action information.
    Anyone know what this error is?
    Thanks.

    Thom,
    How many columns are there in your query? Do they have lengthy column names? Has your schema or query changed during the upgrade?
    One possible workaround if you have lengthy column names in your query is to try doing something like "select somelongcolumnname1 as c1, somelongcolumnname2 as c2 ..." and see if it works. Admittedly, this is only a workaround, but it should be better than renaming your column names.

Maybe you are looking for