Connor and Chris will both be at AI World from October 12 to October 17 , the premier Oracle conference of 2025. If you're in Vegas, please come say Hi or pop into our sessions
Thanks for the question, Andrzej.
Asked: March 17, 2017 - 3:55 pm UTC
Last updated: March 20, 2017 - 2:47 pm UTC
Version: 12.1.0.2.0
Viewed 1000+ times
CREATE TABLE aaa (ID NUMBER, i NUMBER); INSERT INTO aaa VALUES (1,1); COMMIT; ALTER TABLE aaa ADD (a CHAR(7) NOT NULL, b NUMBER); select column_name,data_type,data_length from user_tab_cols where table_name='AAA'; COLUMN_NAME DATA_TYPE DATA_LENGTH ID NUMBER 22 I NUMBER 22 SYS_C00003_17031710:20:29$ CHAR 7 SYS_C00004_17031710:20:29$ NUMBER 22 alter table aaa drop unused columns; select column_name,data_type,data_length from user_tab_cols where table_name='AAA'; COLUMN_NAME DATA_TYPE DATA_LENGTH I NUMBER 22 ID NUMBER 22
Andrzej Lisowski, March 20, 2017 - 11:55 am UTC
Rajeshwaran, March 20, 2017 - 12:20 pm UTC
demo@ORA11G> create table t(x int,y int); Table created. demo@ORA11G> insert into t values(1,1); 1 row created. demo@ORA11G> column column_name format a10 demo@ORA11G> select column_name,hidden_column 2 from user_tab_cols 3 where table_name ='T'; COLUMN_NAM HID ---------- --- X NO Y NO demo@ORA11G> alter table t add(b1 date not null,b2 number); alter table t add(b1 date not null,b2 number) * ERROR at line 1: ORA-01758: table must be empty to add mandatory (NOT NULL) column demo@ORA11G> select column_name,hidden_column 2 from user_tab_cols 3 where table_name ='T'; COLUMN_NAM HID ---------- --- X NO Y NO demo@ORA11G>
demo@ORA12C> column column_name format a30 demo@ORA12C> select column_name,hidden_column 2 from user_tab_cols 3 where table_name ='T'; COLUMN_NAME HID ------------------------------ --- X NO Y NO SYS_C00003_17032017:46:23$ YES SYS_C00004_17032017:46:23$ YES demo@ORA12C>
Share and learn SQL and PL/SQL; free access to the latest version of Oracle Database!
Classes, workouts and quizzes on Oracle Database technologies. Expertise through exercise!