我想问如何实现这一点,我必须将相同的值插入到同一个表中,这将多次创建唯一的ID。
INSERT INTO EmailListTable
( ID,
EmailIndctr,
TimeStamp)
VALUES
(SEQ_ID.NEXTVAL,
0,
SYSDATE)
但是我希望 Insert 语句发生 100 倍,这可能吗?
使用行生成器技术之一;一个简单的就是这样:
SQL> create table emaillisttable(id number, emailindctr number, timestamp date);
Table created.
SQL> create sequence seq_id;
Sequence created.
以及查询本身:
SQL> insert into emaillisttable (id, emailindctr, timestamp)
2 select seq_id.nextval, 0, sysdate
3 from dual
4 connect by level <= 5;
5 rows created.
SQL> select * from emaillisttable;
ID EMAILINDCTR TIMESTAMP
---------- ----------- -------------------
1 0 04.04.2024 22:31:55
2 0 04.04.2024 22:31:55
3 0 04.04.2024 22:31:55
4 0 04.04.2024 22:31:55
5 0 04.04.2024 22:31:55
SQL>