Follow us: Connect on YouTube Connect on YouTube Connect on YouTube

Pages

Tuesday, 3 October 2017

Rename Column in Oracle Table


Used to change the existing column name
 
Syntax:
        Alter table <table_name> rename column <old_col_name> to <new_col_name>;
Example:
ALTER TABLE student RENAME COLUMN name TO sname;
Share this article :

2 comments:

  1. Hi Bro,


    What you’re saying is absolutely correct #topic, but this isn’t the exact situation everywhere. Where most smart folk work on a project - why can’t you do this the Boss asks :).


    from foll. select, how can i get unique values for screen_type and screen

    select a.EMP_NO,a.SCREEN, b.SCREEN_TYPE
    from EMPLOYEE_TAB a, SCREEN_TAB b
    where a.id = b.ID
    and SCREEN_TYPE like '%S';

    EMP_ID SCREEN SCREEN_TYPE
    EMP_123 SCR100 SCRTYPE100S
    EMP_124 SCR100 SCRTYPE100S
    EMP_125 SCR100 SCRTYPE100S
    EMP_127 SCR102 SCRTYPE102S
    EMP_128 SCR102 SCRTYPE102S
    EMP_135 SCR102 SCRTYPE102S
    EMP_136 SCR102 SCRTYPE102Sv


    THANK YOU!! This saved my butt today, I’m immensely grateful.


    Gracias

    ReplyDelete
  2. Hi Dayakar,



    Your writing shines! There is no room for gibberish here clearly you have explained about PLSQL. Keep writing!

    WITH PlantParameter AS(
    SELECT regexp_substr('a,b','[^,]+', 1, LEVEL) AS ParameterValue FROM dual
    CONNECT BY regexp_substr('a,b','[^,]+', 1, LEVEL) IS NOT NULL
    )

    SELECT * FROM Table1 WHERE td.PLANTID IN (SELECT ParameterValue FROM PlantParameter)) /*Paramater*/

    in the above example i am
    passing multi values to the query and handling them by using CTE which split's the entire string to values and these values are used in the below query.this functionality is reducing query performance and it is taking more time to fetch results is there any ways to improve query execution time .My main goal is to pass multi values and i am doing it by using CTE but this is reducing performance of query is there any other way that can be suggested.






    Once again thanks for your tutorial.


    Cheers,

    Ajeeth

    ReplyDelete