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

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 :: postgresql substring 
Sql :: sql create table if not exists 
Sql :: sql display number without decimals 
Sql :: how to pass password mysql command line 
Sql :: sql server current date 
Sql :: node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v72-win32-x64.tar.gz 
Sql :: sql delete join 
Sql :: brew start postgres manual 
Sql :: psql connect 
Sql :: clear a table in mysql 
Sql :: mysql procedures 
Sql :: postgresql drop table 
Sql :: contains word in sql 
Sql :: coalesce postgresql 
Sql :: current year sql 
Sql :: mysql check if not null 
Sql :: Get Minimum from multiple columns sql 
Sql :: where date = max(date) in sql 
Sql :: update field sql 
Sql :: mysql how to store lat,lng 
Sql :: how to get duplicate records with multiple field in sql 
Sql :: ubuntu connect to mssql database 
Sql :: date between in mysql 
Sql :: how to connect to xampp sql server on windows cmd 
Sql :: sql drop default 
Sql :: mysql cashing error 
Sql :: oracle nextval 
Sql :: create_engine sqlalchemy with parsed url sql server 
Sql :: drop multiple columns in sql 
Sql :: sqlite indexes 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =