begin ... update id_tbl set id=id+1 where to_char(l_date,'yymmdd')=to_char(sysdate,'yymmdd'); if sql%rowcount = 0 then --sql%rowcount返回最近一句dml更新的纪录行数, --如果=0则表示没有任何纪录被更新 ... else ... end if; ... end;
我现在用sql%rowcount用用看,发现报错说: ERROR: ORA-00972: 标识过长!这个错在那里?? ////////////////////////// declare newid number(3); begin update id_tbl set id=id+1 where to_char(l_date,'yymmdd')=to_char(sysdate,'yymmdd'); if SQL%ROWCOUNT=0 then insert into id_tbl"(1,'232','dfd'); elsif sql%rowcount=1 then select id into newid from id_tbl; insert into logon_tbl values('A'||to_char(sysdate,'yymmdd')||to_char(newid,'fm000'),'232',sydate); else rollback; end if; end;
update ... set ...show err
--注意语法 --为改动 declare newid number(3); begin update id_tbl set id=id+1 where to_char(l_date,'yymmdd')=to_char(sysdate,'yymmdd'); if SQL%ROWCOUNT=0 then insert into id_tbl values (1,'232','dfd'); ----- elsif sql%rowcount=1 then select id into newid from id_tbl; insert into logon_tbl values ('A'||to_char(sysdate,'yymmdd')||to_char(newid,'fm000'),'232',sysdate);---- else rollback; end if; end;
...
update id_tbl set id=id+1
where to_char(l_date,'yymmdd')=to_char(sysdate,'yymmdd');
if sql%rowcount = 0 then
--sql%rowcount返回最近一句dml更新的纪录行数,
--如果=0则表示没有任何纪录被更新
...
else
...
end if;
...
end;
还有帮我澄清一下概念:oracle中的procedure是不是叫存储过程啊,主要我SQL server用惯了!
ERROR:
ORA-00972: 标识过长!这个错在那里??
//////////////////////////
declare
newid number(3);
begin
update id_tbl set id=id+1
where to_char(l_date,'yymmdd')=to_char(sysdate,'yymmdd');
if SQL%ROWCOUNT=0 then
insert into id_tbl"(1,'232','dfd');
elsif sql%rowcount=1 then
select id into newid from id_tbl;
insert into logon_tbl values('A'||to_char(sysdate,'yymmdd')||to_char(newid,'fm000'),'232',sydate);
else
rollback;
end if;
end;
declare
newid number(3);
begin
update id_tbl set id=id+1
where to_char(l_date,'yymmdd')=to_char(sysdate,'yymmdd');
if SQL%ROWCOUNT=0 then
insert into id_tbl values (1,'232','dfd'); -----
elsif sql%rowcount=1 then
select id into newid from id_tbl;
insert into logon_tbl values ('A'||to_char(sysdate,'yymmdd')||to_char(newid,'fm000'),'232',sysdate);----
else
rollback;
end if;
end;
* --这里多了个'"'