Raj*_*esh 51 sql postgresql-9.1
如何在将新行插入表中时调用postgresql序列?
我想做这样的事情
insert into biz_term(
biz_term_id,
biz_term_name,
)
values(SELECT nextval(idsequence)',
'temp'
);
Run Code Online (Sandbox Code Playgroud)
如何做到这一点?我想这样做,因为当我试图在biz_term表中插入新记录时,序列-idsequence不会被直接调用.任何解决方案?
a_h*_*ame 98
你几乎得到了它.你不需要那里的SELECT:
insert into biz_term(
biz_term_id,
biz_term_name,
)
values(
nextval('idsequence'),
'temp'
);
Run Code Online (Sandbox Code Playgroud)
您没有将biz_term_id指定为serial(或bigserial)自动为您处理的任何原因?