Answers for "alter table rename table oracle"

SQL
3

RENAME table pl sql

ALTER TABLE old_table_name
  RENAME TO new_table_name;
Posted by: Guest on March-12-2020
3

rename column ORACLE

alter table sales rename column order_date to date_of_order;
Posted by: Guest on May-28-2020
2

oracle rename column

ALTER TABLE my_table RENAME COLUMN old_name TO new_name;

-- To check if column exists before renaming it:
DECLARE
    l_cnt INTEGER;
BEGIN
    SELECT count(*) INTO l_cnt
    FROM dba_tab_columns		-- or all_tab_columns (depending on grants)
    WHERE owner = 'my_schema' AND table_name = 'my_table' 
    	AND column_name = 'my_col';
    IF (l_cnt = 1) THEN
        EXECUTE IMMEDIATE 'ALTER TABLE my_table 
        	RENAME COLUMN my_col TO my_new_name';
    END IF;
END;
Posted by: Guest on May-02-2021
1

oracle rename table

RENAME table_name TO new_name;
Posted by: Guest on June-18-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language