oracle主键修改&设置某一字段可以为null
1.oracle主键修改
1.1)首先查看需要修改的表的主键名,默认的情况下,数据库会自动分配
select * from user_cons_columns where table_name='表名'; 注意表名可能需要大写,否则可能查不出来。
1.2)删除主键约束
alter table 表名 drop constraint 主键名(通过上一步查找出来)
1.3)添加主键约束
alter table 表名 add constraint 主键名 primary key(字段名1,字段名2...);
主键名命名规则建议为pk_表名
2.oracle设置字段可以为空
alter table 表名 modify 字段名 null;
oracle主键修改&设置某一字段可以为null的更多相关文章
- oracle主键修改级联外键
举例:修改te_rygj_menu这张表的主键menu_id时,te_rygj_usermenu中的menu_id也跟着修改.利用触发器trigger实现: create or replace tri ...
- oracle 主键自增 设置----杜恩德
<div id="topicList"> <div class="forFlow"> <div class = "pos ...
- 字段username没有默认值查询(设计数据库一定要养成好习惯,不是主键最好设置为可以为空)
今天创建了一个表,但是username作为外键(不是主键)没有设置为可以为空,结果提交表单时忘记写username就报错了
- oracle主键自增
oracle主键自增 1建立数据表 create table Test_Increase( userid number(10) primary key, /*主键,自动增加*/ ...
- oracle 主键应用序列和触发器实现自动增长
oracle 主键自动增长 这几天搞Oracle,想让表的主键实现自动增长,查网络实现如下: create table simon_example ( id number(4) not null pr ...
- oracle 主键自动增长
oracle 主键自动增长 2009-12-11 16:07:00| 分类: 数据库资料|字号 订阅 这几天搞Oracle,想让表的主键实现自动增长,查网络实现如下: create tabl ...
- Oracle主键异常处理
Hibernate: insert into test1.WarnWeather (WAREA, wdate, WDAYS, WINFO, WTYPE, WNO) values (?, ?, ?, ? ...
- MySql数据库在表中添加新字段,设置主键,设置外键,字段移动位置,以及修改数据库后如何进行部署和维护的总结
1,为当前已有的表添加新的字段 alter table student add studentName varchar(20) not null; 2,为当前已有的表中的字段设置为主键自增 alter ...
- Mysql,SqlServer,Oracle主键自动增长的设置
1.把主键定义为自动增长标识符类型 MySql 在mysql中,如果把表的主键设为auto_increment类型,数据库就会自动为主键赋值.例如: )); insert into customers ...
随机推荐
- godep 包管理
go get -u -v github.com/tools/godep godep save
- webstocket 聊天
/** * 初始化socket **/ function initSocket(index_host){//端口号 if( !window.WebSocket ){ console.log(" ...
- JMeter使用中遇到的问题:Jmeter Debug - "Unrecognized VM option '+HeapDumpOnOutOfMemoryError"(转载)
转载自 http://www.cnblogs.com/yangxia-test 启动JMeter.bat的程序时,出现以下出错信息: Unrecognized VM option '+HeapDump ...
- day27 异常处理 和 网络协议
元类补充 class MyMeta(type): # 用于新建类对象 def __new__(cls,*args,**kwargs) print(MyMeta) print(*args) # 调用ty ...
- Log4j2配置及使用
Log4j2:一个日志管理工具.Log4j的升级版,需要Java6以上 一.安装log4j2依赖包 1.通过maven的pom.xml直接引入jar: log4j-api和log4j-core & ...
- Android 数据库框架总结(转)
转自 http://blog.csdn.net/da_caoyuan/article/details/61414626 一:OrmLite 简述: 优点: 1.轻量级:2.使用简单,易上手:3.封装完 ...
- pytest 学习笔记二:兼容unittest、执行方式、生成报告
1.官方文档上说pytest兼容unittest时,不支持setUpModule 和 tearDownModule,但实际验证是可以的. 验证的场景是py文件中,只有一个测试类, 经验证有多个测试类, ...
- Failed to start LSB: Bring up/down networking 问题
Failed to start LSB: Bring up/down networking 问题 1.执行 service network restart 出现以下错误 Restarting ne ...
- Python3 round() 函数
Python3 round() 函数 Python3 数字 描述 round() 方法返回浮点数x的四舍五入值. 语法 以下是 round() 方法的语法: round( x [, n] ) 参数 ...
- android 常用渐变背景绘制
从上到下绘制如图所示 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android= ...