Home Oracle 常用语句
Post
Cancel

Oracle 常用语句

临时表

1
select to_date('2004-05-07','yyyy-mm-dd') from dual

修改字段长度

1
2
3
alter table <TABLENAME> modify <COL> <COLTYPE>;
-- 示例
alter table TEST modify param1 VARCHAR2(4000);

修改字段名称

1
alter table <TABLENAME> RENAME COLUMN <COL1> TO <COL2>;

查询数据库中包含USERCODE字段的表

1
select * from user_tab_cols where column_name='USERCODE';

查询所有表

1
select table_name from user_tables;

查询指定表名下的所有字段

1
select * from user_tab_columns where Table_Name='表名';

查询所有表的字段和注释

1
select * from user_col_comments;
This post is licensed under CC BY 4.0 by the author.