IDENTITY_VAL_LOCAL??????

Derby ???IDENTITY_VAL_LOCAL?????????????????????????????????

??????:
 IDENTITY_VAL_LOCAL ( )

IDENTITY_VAL_LOCAL?????????????????????????????????????????????????????????VALUES????????????INSERT????????????????????????????????????????????????????????????

IDENTITY_VAL_LOCAL?????????????????????????????????????????????????????????????????????????????????????????????????????????DECIMAL (31,0)?????????

IDENTITY_VAL_LOCAL???????????????????????????????????????????????????????????????INSERT??????????????????????????????????????????????????????INSERT?????????????????????????????????VALUES?????????????????????????????????????????? ?????????????????????Derby????????????????????????????????? ????????????????????????????????????????????????INSERT??????????????????????????????????????????????????????null??????????????????

?????????????????????????????????????????????????????????????????????
  • ??????????????????VALUES?????????????????????INSERT???
  • VALUES????????????????????????INSERT???
  • select?????????INSERT???
??????????????????????????????INSERT???????????????????????????????????????????????????????????????????????????????????????????????????????????????IDENTITY_VAL_LOCAL()???????????????????????????????????????????????????????????????????????????????????????

???:

ij> create table t1(c1 int generated always as identity, c2 int);
0 rows inserted/updated/deleted
ij> insert into t1(c2) values (8);
1 row inserted/updated/deleted
ij> values IDENTITY_VAL_LOCAL();
1 
-------------------------------
1                              
1 row selected
ij> select IDENTITY_VAL_LOCAL()+1, IDENTITY_VAL_LOCAL()-1 from t1;
1                                |2                          
-------------------------------------------------------------------
2                                |0                                
1 row selected
ij> insert into t1(c2) values (IDENTITY_VAL_LOCAL());
1 row inserted/updated/deleted
ij> select * from t1;
C1             |C2             
-------------------------------
1              |8              
2              |1              
2 rows selected
ij> values IDENTITY_VAL_LOCAL();
1                        
-------------------------------
2                              
1 row selected
ij> insert into t1(c2) values (8), (9);
2 rows inserted/updated/deleted
ij> -- ?????????????????????????????????????????????????????????????????????
values IDENTITY_VAL_LOCAL();
1                        
-------------------------------
2                              
1 row selected
ij> select * from t1;
C1             |C2             
-------------------------------
1              |8              
2              |1              
3              |8              
4              |9              
4 rows selected
ij> insert into t1(c2) select c1 from t1;
4 rows inserted/updated/deleted
-- select?????????????????????????????????????????????????????????????????????
ij> values IDENTITY_VAL_LOCAL();
1                        
-------------------------------
2                              
1 row selected
ij> select * from t1;
C1             |C2             
-------------------------------
1              |8              
2              |1              
3              |8              
4              |9              
5              |1              
6              |2              
7              |3              
8              |4              
8 rows selected