Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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;
Comment

delete column from table oracle PL SQL

ALTER TABLE table_name DROP COLUMN column_name;
Comment

oracle alter table delete column

alter table table_name drop column column_name;
alter table table_name drop (column_name1, column_name2);
Comment

PREVIOUS NEXT
Code Example
Sql :: start mysql server 
Sql :: postgres DROP and create contraint 
Sql :: ubuntu stop mysql from starting on boot 
Sql :: oracle current date without time 
Sql :: mysql dump database command line linux 
Sql :: change mysql password from command line 
Sql :: sql check roles 
Sql :: oracle compile schema 
Sql :: how to update an attribute in MySQL 
Sql :: oracle sleep 1 second 
Sql :: how to delay stored procedure execution in sql server 
Sql :: pip install mysqlclient error 
Sql :: psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" f 
Sql :: how to delete columns in sql 
Sql :: sql missing records from another table 
Sql :: select item.* as json mysql 
Sql :: SQL select past number of days 
Sql :: sqlite create integer column with limit 
Sql :: select from one table where not on the other 
Sql :: postgresql show current database 
Sql :: oracle source query 
Sql :: python mysql check if database exists 
Sql :: postgresql get last day of month 
Sql :: get rows affected mysql python 
Sql :: select insert new table sql server 
Sql :: insert random numbers in columns postgress 
Sql :: add created and updatedAt fields in mysql 
Sql :: oracle search columns in schema 
Sql :: create row number in sql 
Sql :: oracle create program if no exists 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =