Sunday, November 4, 2012

How to RENAME the TABLE name in ORACLE

There are two ways of renaming a table in Oracle:

Method 1: Simple

rename {old_table_name} to {new_table_name}

Example:

rename CUSTOMER to CUSTOMER_BACKUP

Method 2: Not so Complex

alter table {old_table_name} rename to {new_table_name};

Example:

alter table CUSTOMER rename to CUSTOMER_BACKUP;

The minimum version that supports table renaming is Oracle 8i. All the dependencies of the table will automatically updated. No need of updating them after wards.

3 comments:

  1. Hello There,


    Fully agree on SQL & PL/SQL We’re seeing a lot of projects tackle big complex problems but few seem to have taken into consideration and in particular reasons to adopt.

    Currently I'm trying to make a test using create job as a way to have multiple process on database starting in a loop.
    Basically I'm getting different behaviours when testing on different database machines. I'll define the machine names are A and B.

    I did another test in the same machine B using enabled FALSE when creating the job and during the call from DBMS_SCHEDULER.RUN_JOB changed to false in the user credentials but only one job runned, i.e., the result was logged from just one job, instead of the 3 jobs that had most be created.

    Do you have an idea about what I need to look? Is there something related about database setup, credentials that I need to take a look?

    It was cool to see your article pop up in my google search for the process yesterday. Great Guide.

    Keep up the good work!

    Thank you,
    Yash

    ReplyDelete
  2. Selamat Petang,

    The challenge however, is we don’t yet know how it will be used making to hard to assess their value proposition and consequently value.

    how to apply refcursor in package with multiple insted of multple cursors in oracle?
    Give one example.
    Thank you very much and will look for more postings from you.

    Regards,
    Radhey

    ReplyDelete
  3. Hello,


    11/10!! Your blog is such a complete read. I like your approach with How to RENAME the TABLE name in ORACLE. Clearly, you wrote it to make learning a cake walk for me.


    how to find first nonspace character from end of the string


    ex: 'abc def g '

    I should get 4 in this case. (the first nonspace character from backwards in the above example is g and the position is 4 from backwards.

    Could you help me in getting this?

    I am so grateful for your blog. Really looking forward to read more.


    Best Regards,
    Radhey

    ReplyDelete