表操作的常用SQL语句-oracle

--删除表的主外键约束
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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值