var
i:integer;
begin
i:=ADOQuery1.RecordCount;
i:=i+1;
with ADOQuery1 do
begin
append;
fieldbyname('id').asinteger:=i;
fieldbyname('danwei').asstring:='tstring';
post;
end;
end;
i:integer;
begin
i:=ADOQuery1.RecordCount;
i:=i+1;
with ADOQuery1 do
begin
append;
fieldbyname('id').asinteger:=i;
fieldbyname('danwei').asstring:='tstring';
post;
end;
end;
select @id = max(field_id) from table
@id = @id + 1
insert into table values (@id,@corpname)OK?
declare @name //name 指单位
INSERT INTO TABLE VALUES (@NAME)
则插入一条记录序号自加1。
create or Replace procedure InsertTB(
P_DWMC Char,--单位名称
P_DWID OUT NUMBER
) as
v_DWID Number;--单位序号
begin
select NVL(max(DWID),0) into V_DWID from DW;
V_DWID:=V_DWID+1;
Insert Into DW
Values(V_DWID,P_DWMC);
COMMIT;
P_DWID:=V_DWID;
exception
when Others then NULL;
end;
是不是标识设为“是”,然后在标识递增量设为“1”呢?