Answers for "sql delete column oracle"

SQL
4

delete column from table oracle PL SQL

ALTER TABLE table_name DROP COLUMN column_name;
Posted by: Guest on March-13-2020
1

drop colum oracle 18c

-- tested on oracle 18c
alter table table_name drop column column_name;

-- example
alter table products drop column category;
Posted by: Guest on June-15-2020
1

oracle drop column

ALTER TABLE my_table DROP COLUMN my_col;
-- 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_schema.my_table DROP COLUMN my_col';
    END IF;
END;
Posted by: Guest on May-04-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language