zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

ORACLE uuid自动生成主键

Oracle自动 生成 主键 UUID
2023-09-14 08:57:15 时间
pre code_snippet_id= 331722 snippet_file_name= blog_20140507_1_4310081 name= code >-- Create table create table TECHNOLOGYCOMPANY ID VARCHAR2(32) default SYS_GUID() not null, FLOWID VARCHAR2(50), CONPANYID NUMBER, ISCOMMUNICATION VARCHAR2(10) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage initial 64K minextents 1 maxextents unlimited -- Add comments to the table comment on table TECHNOLOGYCOMPANY is 技术交流的交流公司; -- Add comments to the columns comment on column TECHNOLOGYCOMPANY.FLOWID is 申请编号; comment on column TECHNOLOGYCOMPANY.CONPANYID is 竞争对手ID; comment on column TECHNOLOGYCOMPANY.ISCOMMUNICATION is 是否交流; -- Create/Recreate primary, unique and foreign key constraints alter table TECHNOLOGYCOMPANY add constraint SYS_TECHNOLOGYCOMPANY primary key (ID) using index tablespace USERS pctfree 10 initrans 2 maxtrans 255 storage initial 64K minextents 1 maxextents unlimited
【MyBatis框架点滴】——mybatis插入数据返回主键(mysql、oracle) 向数据库中插入数据时,大多数情况都会使用自增列或者UUID做为主键。主键的值都是插入之前无法知道的,但很多情况下我们在插入数据后需要使用刚刚插入数据的主键,比如向两张关联表A、B中插入数据(A的主键是B的外键),向A表中插入数据之后,向B表中插入数据时需要用到A的主键。