读书人

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

发布时间: 2013-03-22 09:49:50 作者: rapoo

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>

?

读书人网 >编程

热点推荐