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ã‚’è¿”ã?—ã?¾ã?™ã€‚
例:
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