oracle rename column if exists

Solutions on MaxInterview for oracle rename column if exists by the best coders in the world

showing results for - "oracle rename column if exists"
Mika
19 May 2020
1ALTER TABLE my_table RENAME COLUMN old_name TO new_name;
2
3-- To check if column exists before renaming it:
4DECLARE
5    l_cnt INTEGER;
6BEGIN
7    SELECT count(*) INTO l_cnt
8    FROM dba_tab_columns		-- or all_tab_columns (depending on grants)
9    WHERE owner = 'my_schema' AND table_name = 'my_table' 
10    	AND column_name = 'my_col';
11    IF (l_cnt = 1) THEN
12        EXECUTE IMMEDIATE 'ALTER TABLE my_table 
13        	RENAME COLUMN my_col TO my_new_name';
14    END IF;
15END;
queries leading to this page
alter rename column oracleoracle alter table modify column name exampleoracle rename tablerename oracle tableoracle rename a columnrename column in oraclealter column name in table oraclechange column name in sql oraclehow to rename column name in oraclecan we rename existing column in oraclerename table column in oraclealter column name in oraclesql oracle change column nameoracle renamerename a column oraclerename column name in table oraclerename table in oraclerename in sql oraclecan we rename existing column constaint in oraclerename table in oracle sqlrename column oraclerename column name in oracle tablealter table oracle rename columnrename column name oraclerename column name in oraclealter rename table name oraclemodify column name in oraclealter to rename column in oracleoracle sql rename tableoracle change column nameoracle sql modify column nameoracle change name of a columnoracle change table column namerename column namre in oraclehow to change column name in oraclealter column name in oracle dboracle table column name changerenaming oracle columnsrename in oraclerename table in oracleoracle alter column renamerename table name in oraclehow to rename column name in oracle ebscan alter command rename column in oraclerename column of type oracle sqlalter column name oraclechange column name oraclerename table oracleoracle rename columnoracle 2balter table change column namerename table column in sql oraclerename a column in oracle as dateoracle rename column examplehow to rename a table in oraclehow to alter column name in oraclesql oracle rename tablealter table rename table oraclerename column sql oracleoracle rename column if exists