以下查询适用于数值数据类型(int、bigint 等)。我想做同样的事情,但将其应用于 varchar。这可能吗?如何?
CREATE SEQUENCE acct_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO CYCLE
CACHE 24
;
SELECT accntnum AS new_acct, old_acct
FROM FINAL TABLE (
UPDATE accounts INCLUDE(old_acct INT)
SET accntnum = NEXT VALUE FOR acct_seq, old_acct = accntnum
)
ORDER BY old_acct;
就行UPDATE accounts INCLUDE(old_acct INT)
而不是 int 我想使用VARCHAR(size)
. 大小将在 4 到 100 之间。