Declare
Vrowcount number;
Vtotal number:=0;
V_createSQL varchar2 (2000);
Cn number:=0;
The begin
V_createSQL:='create table TBSJ_LOG
(
Id NUMBER (10),
Pr_name VARCHAR2 (50),
Table_name VARCHAR2 (50),
PCDM VARCHAR2 (14),
The message VARCHAR2 (200),
Step NUMBER (3),
Update_time DATE default sysdate
) ';
Select count (1) into cn from all_tables where TABLE_NAME='TBSJ_LOG' and OWNER='YLH';
If cn=0 then
The execute immediate v_createSQL;
End the if;
For I in 1.. 15001/5000 + 1 loop
The delete from ypml_x_2018_01_cs where rownum<=5000;
Vrowcount: rowcount=SQL %;
Vtotal:=vtotal + 1;
Insert into TBSJ_LOG
(message, update_time)
Values
(to_char (vrowcount) | | 'data deleted, sysdate);
commit;
end loop;
end;
When I was in the implementation of the statement, suggesting TBSJ_LOG does not exist, but in front of create TBSJ_LOG statement, please help look at it?
CodePudding user response:
Insert into TBSJ_LOG, this sentence is written in dynamic,