--删除表的主外键约束
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;