表操作的常用SQL语句-oracle
来源:互联网 发布:女生 基本款 知乎 编辑:程序博客网 时间:2024/05/17 20:35
--删除表的主外键约束
alter table fw_user_group drop constraint FK_FW_USER_REFERENCE_FW_USER;
--添加主外键约束
alter table FW_USER_GROUP
add constraint FK_FW_USER_REFERENCE_FW_USER foreign key (USER_ID_FK)
references FW_USER (ID);
--查询数据库编码格式
select userenv('language') from dual;
select * from nls_database_parameters;
--查询导入导出编码
select nls_charset_name(to_number('0354','xxxx')) from dual;
--查询表中的主外键约束
select A.* from user_constraints A, user_constraints B
WHERE b.table_name = 'FW_USER'
and a.constraint_type = 'R'
and a.r_constraint_name = b.constraint_name;
select A.* from user_constraints A, user_constraints B
WHERE b.table_name = 'fw_menu'
and a.constraint_type = 'R'
and a.r_constraint_name = b.constraint_name;
--删除表中数据
delete from fw_user;
--表中添加字段
alter table FW_USER add (AVAILABLE_DATE date);
--删除表
drop table FW_USER;
--查询当前用户下的表
select * from user_tables;
select COUNT(*) from all_tables where owner='MY_PORTAL';
select count(*) from user_tab_columns where table_name=upper('FW_USER');
SELECT * FROM user_tab_columns WHERE table_name = 'FW_USER' for update;
--复制一个用户的一张表到另一个用户,
create table my_portal.FW_ANNOUNCEMENT as select * from fw_sample.FW_ANNOUNCEMENT;
create table my_portal.FW_ANNOUNCEMENT_ARRIVAL as select * from fw_sample.FW_ANNOUNCEMENT_ARRIVAL;
create table my_portal.FW_WF_DELIVER as select * from fw_sample.FW_WF_DELIVER;
create table my_portal.FW_WF_DELIVER_CONFIG as select * from fw_sample.FW_WF_DELIVER_CONFIG;
commit;
select * from fw_user;
alter table fw_user_group drop constraint FK_FW_USER_REFERENCE_FW_USER;
--添加主外键约束
alter table FW_USER_GROUP
add constraint FK_FW_USER_REFERENCE_FW_USER foreign key (USER_ID_FK)
references FW_USER (ID);
--查询数据库编码格式
select userenv('language') from dual;
select * from nls_database_parameters;
--查询导入导出编码
select nls_charset_name(to_number('0354','xxxx')) from dual;
--查询表中的主外键约束
select A.* from user_constraints A, user_constraints B
WHERE b.table_name = 'FW_USER'
and a.constraint_type = 'R'
and a.r_constraint_name = b.constraint_name;
select A.* from user_constraints A, user_constraints B
WHERE b.table_name = 'fw_menu'
and a.constraint_type = 'R'
and a.r_constraint_name = b.constraint_name;
--删除表中数据
delete from fw_user;
--表中添加字段
alter table FW_USER add (AVAILABLE_DATE date);
--删除表
drop table FW_USER;
--查询当前用户下的表
select * from user_tables;
select COUNT(*) from all_tables where owner='MY_PORTAL';
select count(*) from user_tab_columns where table_name=upper('FW_USER');
SELECT * FROM user_tab_columns WHERE table_name = 'FW_USER' for update;
--复制一个用户的一张表到另一个用户,
create table my_portal.FW_ANNOUNCEMENT as select * from fw_sample.FW_ANNOUNCEMENT;
create table my_portal.FW_ANNOUNCEMENT_ARRIVAL as select * from fw_sample.FW_ANNOUNCEMENT_ARRIVAL;
create table my_portal.FW_WF_DELIVER as select * from fw_sample.FW_WF_DELIVER;
create table my_portal.FW_WF_DELIVER_CONFIG as select * from fw_sample.FW_WF_DELIVER_CONFIG;
commit;
select * from fw_user;
0 0
- 表操作的常用SQL语句-oracle
- Oracle中常用的修改表操作的sql语句
- Oracle 常用数据库sql语句操作
- Oracle常用的SQL语句
- oracle的常用sql语句
- oracle常用的SQL语句
- oracle常用的sql语句
- ORACLE常用的sql语句
- 常用的Oracle SQL语句
- ORACLE常用的SQL语句
- Oracle的常用SQL语句
- 常用表操作Sql语句
- oracle常用SQL语句
- oracle常用SQL语句
- oracle常用SQL语句
- oracle 常用sql语句
- oracle常用sql语句
- oracle常用SQL语句
- java堆详解
- 上传文件或图片 controller层
- Linux环境tomcat软链接问题
- (四)工厂方法模式详解(另附简单工厂的死亡之路)
- R链接到数据库(http://www.dataguru.cn/thread-289411-1-1.html)
- 表操作的常用SQL语句-oracle
- 用联合体判断机器是大端字节序还是小端字节序
- mysql-视图
- oracle数据库procedure&package新手参考
- Error: PLS-00201
- Error: PLS-00201
- 遭遇MultiDex的坑
- 科技英语/专业英语——改错总结【2】
- InetAddress(IP类)