Alter Fileds in an existing table

Hi to every body,
I have a doubt that if i want to edit filed names in already existing table i am getting an error that we cant alter table fileds
and so can any one help me in solving my problem
Regards,
Sasi

I created two tables namely:
1.ZBILLING
2.CUSTOMER
yes you are right i created VIEW "ZBILLCUST" by using this two tables and 1 common field "CNO"
but now i am trying to change another field but not CNO
but i am getting  "Enhancement category" Missing error
as you said i am that particular table is used by view but i am not trying to change the common field and so i am not able to change the field name
Please help me to solve mp problem
Regards,
Sasi Vardhan

Similar Messages

  • How can I convert an existing table to IOT

    Hi,
    My Oracle version is 10.2.0.4
    Below is my structure of my test_table .
    It has 1141580 rows.
    I want to convert this into index Organized table. It has no secondary indexes.
    How can I convert an existing table to IOT.
    CREATE TABLE test_table (
       Column1             NUMBER        NOT NULL,
       Column2             DATE          NOT NULL,
       Column3             VARCHAR2(100) NOT NULL,
       Column4             VARCHAR2(8)   NULL,
       Column5             VARCHAR2(40)  NOT NULL,
       Column6             VARCHAR2(3)   NULL,
       Column7             NUMBER        NOT NULL,
       Column8             NUMBER        NULL,
       Column9             VARCHAR2(32)  NULL,
    ALTER TABLE test_table
      ADD CONSTRAINT test_table_pk2 PRIMARY KEY (
        Column1,
        Column2
      USING INDEX
        STORAGE (
          INITIAL   30720 K
    ALTER TABLE test_table
      ADD CONSTRAINT test_table_cons1 FOREIGN KEY (
        Column1
      ) REFERENCES test_table2 (
        Column1
    /

    alter table doesn't allow to change the organization of a table.
    So the logical answer to your question is
    You can not
    and your question
    redundant.
    As most other questions here.
    So the answer should have been
    - create a new table
    - insert all rows
    - drop the old table
    - rename the new table
    Oracle is not about rocket science.
    Oracle is about reading documentation and using brains.
    If you do that, maybe, one day, you will be a bigboy.
    If you keep asking redundant questions you will remain a littleboy.
    Sybrand Bakker
    Senior Oracle DBA

  • How to create a table from an existing table with new column

    Hi !
    Please help me.
    I want to create a table from an existing table with data and add two new column to the new table.
    What will be the syntax?

    craete table new_table as select a.*, 'somevalue' new_col1, 'somevalue'
    new_col2 from old_table a;Also there is a pitfall - newly created table will accept column type and precision from the select statement, so further you can be needed to modify columns
    if you want to have VARCHAR2 instead of CHAR for example:
    SQL> create table new_dept as select dept.*, 'New data' new_col from dept;
    Table created.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            CHAR(8)
    SQL> alter table new_dept modify (new_col varchar2(8));
    Table altered.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            VARCHAR2(8)Rgds.
    Didn't see michael's post - it reflects the fix for this problem using CAST.
    Message was edited by:
    dnikiforov

  • How to insert columns in an existing table?

    iv read the tutorial in this site http://www.w3schools.com/sql/sql_alter.asp but it is not for SQL Server 2000 DB.
    Im using SQL Server 2000 DB. how do i insert column in an existing table?
    i tried to execute the code (String query) below but it doesn't wrk:
    For data type char:
    String query = "ALTER TABLE [dbo].["+tablename+"] ADD [columnname] [char] (60) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL";
    For data type int:
    String query = "ALTER TABLE [dbo].["+tablename+"] ADD [columnname] [int] NOT NULL";________________________
    is what's wrong with the code?

    Best solution would be to look up the exact syntax from the SQL Server 2000 documentation. The tutorial you have there teaches the ANSI Standard SQL. It is surprising that SQL Server 2000 (Microsoft right?) doesn't comply with that (especially since they list it in as one of the ones the tutroial was made to demonstrate).
    I would double and triple check your sintax, whatch your error logs to make sure something else isn't preventing you from changing, and making sure you are logged in to the DB as a user who has the ability to alter tables.

  • How to add an unique column to an existing table?

    How to add an unique column to an existing table?
    I have a large table which has no unique constraint. and I want to add an unique column for it. How to do it?
    Does adding a sequence is a good choice? How to do it?
    Thank you

    Hi,
    alter table tablename
    add constraint contraint_name unique (columnname);but before that you need to check in the table.column there is no duplicate record exist.
    Does adding a sequence is a good choice?
    Your talking about unique constraint then yes.
    Regards,
    Taj

  • SQL Server 2008 File Stream On Existing Table

    Hi Folks,
    I have enabled the SQL Server File Stream option on a Existing table.
    1. Created a GUID Column 
    2. Created a File Stream Column 
    3. Swapped the Blob Column information into file Stream column. 
    4. Dropped the BLOB Column. 
    I could evidence, The above Step 3 Process moved out all the Blob Data into an configured Network File Group.
    Ex:
    Existing BLOB Data Size --> 10 GB 
    Once after the completion of above step 4, SQL Server is not freeing up the BLOB occupied Space 10 GB. It should have only few MB's pointer address to the network file Group?
    If we create a new table with File Stream data type and insert the existing BLOB data ,Will result few MB pointer Address occupied in the newly created table. We except the similar behaviour for updating BLOB to File Stream in existing table. 
    Please advice me.
    Thanks 
    Narendran
    Narendran

    When you drop a column, SQL Server only mark the column as dropped, but does not reclaim the space, as that requires data to be shuffled around. You need to rebuild the clustered index (and any other index with the column) to reclaim the space. See repro
    below:
    CREATE TABLE myblobbie (id int   NOT NULL PRIMARY KEY,
                            name sysname  NOT NULL,
                            blob varchar(MAX) NOT NULL)
    go
    INSERT myblobbie(id, name, blob)
       SELECT object_id, name, replicate(convert(varchar(MAX), name), 1000)
       FROM   sys.objects
    go
    EXEC sp_spaceused myblobbie
    go
    ALTER TABLE myblobbie DROP COLUMN blob
    go
    EXEC sp_spaceused myblobbie
    go
    ALTER INDEX ALL ON myblobbie REBUILD
    go
    EXEC sp_spaceused myblobbie
    go
    DROP TABLE myblobbie
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Add a new aprtition to existing table

    Hi all,
    we have already a table badge2 in our database we need to add partition but when we add this like we get some errors. below is the structure of the table .please any one suggest me how do i add a partition to existing table. quick response will be higly appreciated.
    Name Null? Type
    EMP_TYPENO NUMBER(10)
    EMP_NO NUMBER(10)
    EMP_DATE DATE
    EMP_TIME DATE
    EMP_EVINT NUMBER(1)
    EMP_FLAGE NUMBER(1)
    MAC VARCHAR2(50)
    EMP_CARDNO NUMBER(3)
    when i run these queries it give errors like this
    sql> alter table badge2 partition by range (emp_date)
    add partition p1 values less than (TO_DATE('01/01/2005', 'DD/MM/YYYY')));
    ERROR at line 1:
    ORA-01735: invalid ALTER TABLE option
    or
    sql> alter table badge2 partition by range (emp_date)
    partition p1 values less than (TO_DATE('01/01/2005', 'DD/MM/YYYY')));
    ERROR at line 1:
    ORA-01735: invalid ALTER TABLE option
    or
    SQL> alter table badge2
    add partition p1 values less than (TO_DATE('01/01/2004', 'DD/MM/YYYY'));
    alter table badge2
    ERROR at line 1:
    ORA-14501: object is not partitioned
    BEST REGARDS

    Hi,
    You can only add partitions to a partitioned table. When the table is non-partitioned table you will be greeted with an error as shown below:
    SQL> create table t(dt date);
    Table created.
    SQL> alter table t add partition  p1 values less than (TO_DATE('01/01/2004', 'DD/MM/YYYY'));
    alter table t add partition  p1 values less than (TO_DATE('01/01/2004', 'DD/MM/YYYY'))
    ERROR at line 1:
    ORA-14501: object is not partitionedIf the table is already partitioned then you can add partitions as shown below:
    SQL> create table t1( dt date) partition by range(dt)
      2  (partition p1 values less than (TO_DATE('01/01/2004', 'DD/MM/YYYY')));
    Table created.
    SQL> alter table t1 add partition p2 values less than (TO_DATE('01/02/2004', 'DD/MM/YYYY'));
    Table altered.
    SQL>I would suggest you to read this document for a clear understanding on how partition are created and maintained:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10713/schemaob.htm#CFAGCHCD
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/partconc.htm#sthref2570
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/partiti.htm#i1108745
    Regards
    Asif Momen
    http://momendba.blogspot.com

  • Adding a new Big INT column to existing table in production, which holds 700 million records will impact anything in production?

    Hi Guys,
    I have to add a new Big INT column to existing table in production, which holds 700 million records and would like to know the impact?
    I have been tolled by one of my colleagues that last time they tried adding a column to same table during working hour and it locked out the table and impacted the users.
    Please suggest/share If any one had similar experience.
    Thanks Shiven:) If Answer is Helpful, Please Vote

    If you add a new column to a table using an ALTER TABLE ADD command and specify that the new column allows NULLs and you do not define a default value, then it will take a table lock.  However, once it gets the table lock, it will essentially run instantly
    and then free the table lock.  That will add this new column as the last column in the table, for example
    ALTER MyTable ADD MyNewColumn bigint NULL;
    But if you your change adds a new column with a default value, or you do something like using table designer to add the new column in the middle of the current list of columns, then SQL will have to rewrite the table.  So it will get a table lock, rewrite
    the whole table and then free the table lock.  That will take a considerable amount of time and the table lock will be held for that whole period of time.
    But, no matter how you make the change, if at all possible, I would not alter a table schema on a production database during working hours.  Do it when nothing else is going on.
    Tom

  • Range Partitioning Existing table

    Hi,
    I have a table with numeric field. I want to range partition the existing table. I used the following query
    alter table dept add partition by range(deptno) (
    partition p1 values less than (20),
    partition p1 values less than (40))
    It gives me ORA-00902: invalid datatype.
    What am I doing wrong? Is it possible to partition an existing table?
    Regards,
    Subbu S.

    Hi,
    You cannot partition an existing table with an ALTER TABLE command. There are couple of techinques with which you can partition an existing table, like:
    1) Rename existing table, create a new partitoned table and move data.
    2) Using DBMS_REDEFINITION package.
    Have a look at the following links for details:
    http://www.oracle-base.com/articles/misc/PartitioningAnExistingTable.php
    http://www.dba-oracle.com/oracle_news/2004_3_9_rittman.htm
    Regards
    Asif Momen
    http://momendba.blogspot.com

  • How to add create partition to an existing table?

    hi,
    please tell me how to add partition to an existing table.
    i have tried
    alter table mvr add partition sno
    but getting error : ORA-14501: object is not partitioned
    thanks.

    Just Googling for ora-14501 resulted in the following
    Adding a partition results in ORA-14501: object is not partitioned
    It is really sad you can not do this on your own, and always need someone to do this for you.
    Sybrand Bakker
    Senior Oracle DBA

  • Can we addnew partition and sub partition in the existing table in one shor

    can we addnew partition and sub partition in the existing table in one short

    nav wrote:
    can we addnew partition and sub partition in the existing table in one shortYes,
    You can and below is the example for Range-List partition
    ALTER TABLE <table_name>
       ADD PARTITION <partition_name> VALUES LESS THAN (<value>
          STORAGE (INITIAL 20K NEXT 20K) TABLESPACE <TS name> NOLOGGING
              SUBPARTITION Clause
              SUBPARTITION Clause
              SUBPARTITION Clause
              SUBPARTITION Clause
               );

  • Partitioning an already existing table

    Hi,
    I need to partition many existing tables. All these tables hold more than 50 million data each.
    Since i am new to partitioning, can any one kindly guide what are the best practices one should look for under such circumstances.
    Is it neccessary to dwell on the following point
    1) Type of table (Heap or IOT etc).
    2) Indexes and kinds of indexes along with the columns in which they are defined.
    3) Block size
    4) Constraints
    5) Row Chaining, Migration etc.
    I have very basic idea about the above mentioned points.
    Please guide me as to how should the partitioning be done, what sort of partitioning is best, any performace issues.
    I sincerely appreciate the cooperation of all members.
    Thanks in advance
    Message was edited by:
    Master

    Hi,
    to create a partitioned table from the non portioned table
    create table part partition XXXXXXXX
    (partition p01 tablespace XX1,
    partition p02 tablespace XX2,
    partition p03 tablespace XX3,
    partition p04 tablespace XX 4
    nologging
    as select * from old data ;
    OR
    export the old non partition table data – rename the non partitioned table, create partitioned table import the data
    OR
    Exchanging Partitions
    You can convert a partition (or sub partition) into a non-partitioned table, and a non-partitioned table into a partition (or sub partition) of a partitioned table by exchanging their data segments. You can also convert a hash-partitioned table into a partition of a range-hash partitioned table, or convert the partition of the range-hash partitioned table into a hash-partitioned table. Similarly, you can convert a list-partitioned table into a partition of a range-list partitioned table, or convert the partition of the range-list partitioned table into a list-partitioned table
    One of the great features about partitioning, and most specifically range-based partitioning, is the ability to load in new data quickly and easily with minimal impact on the current users. The manuals indicate that the critical command to achieve this is as follows:
    alter table pt_tab1 exchange partition p_9999
    with table new_data
    Ani

  • Create table for existing table

    dear all
    I have a partition table with millions records and i want to create table from that table
    and i want the new table that i create it is contain the same structure(partition) and contain all data
    i write this code
    create table abc as select * from cda;
    but this script donot work as i want (same structure(partition) and contain all data)
    so anybody can help me
    best regards

    And it is not possible to alter the structure of the table in place? It sounds like you are going to be copying all the data from the current table to a new table and then back to the existing table once the existing table has been altered-- that is going to be very expensive in terms of resources, time, downtime windows, etc. Generally, you can just alter the table in place...
    Assuming you really want to copy all the data twice, and that the new (staging?) table really needs to have the same partitioning scheme as the primary, the DBMS_METADATA suggestion would seem to work. Moving the data from the exisiting table to the staging table, you might consider partition exchange if you want the staging table to have the same indexes that the current table has.
    Justin

  • Adding Constraints to an existing table

    Hi,
    I've consulted the forum, documentation, the internet and text books but cannot find the correct SQL command to add constraints to an existing table
    Obviously I would
    ALTER TABLE Turkey ADD CONSTRAINT Whitemeat
    But what comes next is puzzling, the values of column Whitemeat can be any value other than Dinner, Gravy, Pumpkin, or Sauce
    Any assistance would be great
    Thank You

    Hi,
    user8998591 wrote:
    Sorry,
    This is what I'm trying to run
    ALTER TABLE TURKEY add
    CONSTRAINT TURKEY_WHITEMEAT_CK CHECK WHITEMEAT NOT IN ('Dinner', 'Gravy', 'Pumpkin', 'Sauce');And this is the error message I am getting
    Error report:
    SQL Error: ORA-00906: missing left parenthesis
    00906. 00000 -  "missing left parenthesis"
    *Cause:   
    *Action:Thank you for your assistanceSee the [SQL Language manual|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_3001.htm#sthref5176] for the correct syntax.
    The condition after the keyword CHECK has to be in parentheses.
    To add a CHECK constraint to an existing table, I think you have to modify the column.
    ALTER TABLE turkey
    MODIFY  ( whitemeat     CONSTRAINT     turkey_whitemeat_ck
                     CHECK          ( whitemeat NOT IN ( 'Dinner'
                                                , 'Gravy'
                                          , 'Pumpkin'
                                          , 'Sauce'
         )                    )             );Edited by: Frank Kulash on Jan 22, 2010 4:37 PM

  • Adding fields to an existing table without dropping it

    Hi Guys,
    Just wondering if anyone can tell me if it's possible to write an SQL statement to add extra fields to an existing table without dropping it then re-creating and also what SQL would be needed. The added fields will be part of an exclusive arc, so can contain NULL values.
    Any help would be much appreciated.
    Anton

    Hi,
    You can Use the ALTER TABLE statment.
    like consider emp table having 3 columns empno,enmae,deptno.
    now u want to add sal and mgr columns.
    u can do it like this
    ALTER TABLE ADD ((sal NUMBER(5,2),(mgr NUMBER));
    If u want to modify the column datatype
    u can use ALTER TABLE MODIFY (<column datatype>............);
    Trinath Somanchi,
    Hyderabad.

Maybe you are looking for

  • Windows Vista compatibility for Crviewer.DLL

    Our Windows XP are installed CRVIEWER.DLL Crystal Viewer 11.5 (Version 11.5.8.826), I'd like to know does this DLL support Windows Vista, or need to upgrade to a newer DLL? Also, any known bug is this version?

  • Sales order link to MRP run

    Dear gurus, I have one query regarding sales order link to MRP run. I had created sales order by VA01 & also independent requirement in MD61. Both are acknowledged in MRP run.I know the requirement in MD61 transferred for MRP run(MD02/MDBT/MD01). But

  • How do I get my iPad to play Netflix on my tv

    I have a Netflix account and have successfully downloaded movies to the ipad2. How do I get the movie to play on my Tv?

  • Having problem skipping something in .txt file

         File input = new File(fname);      Scanner scan = new Scanner(inputFile);      while (scan.hasNext())      for (int i=0; i<10;i++)           lang=scan.next();                for (int j=0; j<26;j++)                String trash=scan.next();       

  • Dynamic Calc member has more than 100 children

    In my db, I've a dynamic calc member, in say hierarchy Accounts, that has more than 100 members under it (children). I'm using MaxL scripts to update the Accounts hierarchy i.e. adding new members, tagging UDA's etc. However, the MaxL command is erro