首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

oracle 安插游标 相当于主键约束

2013-03-22 
oracle 插入游标 相当于主键约束SQLcreate sequence stuid2increment by 13start with 14nomaxvalue5nocy

oracle 插入游标 相当于主键约束

SQL>  create sequence stuid  2   increment by 1  3   start with 1  4   nomaxvalue  5   nocycle  6   cache 10;Sequence created.SQL> select stuid.nextval from T_student;   NEXTVAL----------         1SQL> select stuid .currval from T_student;   CURRVAL----------         1SQL> insert into T_student values(stuid.nextval,'星星' ,'12-2月 -13','天空');1 row created.SQL> insert into T_student values(stuid.nextval,'星星' ,'12-2月 -13','天空');1 row created.SQL> insert into T_student values(stuid.nextval,'星星' ,'12-2月 -13','天空');1 row created.SQL> insert into T_student values(stuid.nextval,'星星' ,'12-2月 -13','天空');1 row created.SQL> insert into T_student values(stuid.nextval,'星星' ,'12-2月 -13','天空');1 row created.SQL> insert into T_student values(stuid.nextval,'星星' ,'12-2月 -13','天空');1 row created.SQL> insert into T_student values(stuid.nextval,'星星' ,'12-2月 -13','天空');1 row created.SQL> insert into T_student values(stuid.nextval,'星星' ,'12-2月 -13','天空');1 row created.SQL> insert into T_student values(stuid.nextval,'星星' ,'12-2月 -13','天空');1 row created.SQL> select * from T_student;     STUID STUNAME  STUDATE        STUADD---------- -------- -------------- --------------------         1 令狐冲   12-2月 -13     华山         2 星星     12-2月 -13     天空         3 星星     12-2月 -13     天空         4 星星     12-2月 -13     天空         5 星星     12-2月 -13     天空         6 星星     12-2月 -13     天空         7 星星     12-2月 -13     天空         8 星星     12-2月 -13     天空         9 星星     12-2月 -13     天空        10 星星     12-2月 -13     天空10 rows selected.SQL>

?

热点排行