--1. Determine if the table exists, or drop table if present--2. Create a table--3. Inserting 1W data--4. Commit once per 1K articleDeclarev_tablevarchar2(222):='STUDENT';--Table nameV_table_exists Number:=0;--if it is greater than 0, the table existsV_sql_createvarchar2(2222);--CREATE TABLE SQLV_number Number:=500000;--the inserted datav_id Number:=0;--ID fieldV_age Number:=100000;--Age FieldV_i Number:=0;--record the number of inserted barsV_start_timevarchar2( A);--Execute command start timeV_end_timevarchar2( A);--Execute command End timeV_exec_timevarchar( A);begin --determine if the table exists, if there is the most deleted SelectTo_char (Sysdate,'YYYY-MM-DD Hh24:mi:ss') intoV_start_time fromdual; Select Count(1) intoV_table_exists fromtabwhereTname=Upper('Student'); ifV_table_exists> 0 Then ExecuteImmediate'drop table'||V_table||'Purge'; Dbms_output.put_line ('drop table'||V_table||'sucessfuly'); ElseDbms_output.put_line ('Table'||V_table|| 'is not exists'); End if; --CREATE TABLE StudentV_sql_create:='CREATE TABLE'||V_table||'(ID number,age number)'; Executeimmediate v_sql_create; Commit; --Insert data to studentLoopExit whenV_number<=0; V_number:=V_number-1; Insert intoStudentValues(V_id,v_age); V_ID:=v_id+1; V_age:=V_age+1; V_i:=V_i+1; --commit/10000 Line Data ifMoD (V_i,10000)=0 Then SelectTo_char (Sysdate,'YYYY-MM-DD Hh24:mi:ss') intoV_exec_time fromdual; Dbms_output.put_line (V_i||' '||v_exec_time); Commit; End if; EndLoop; SelectTo_char (Sysdate,'YYYY-MM-DD Hh24:mi:ss') intoV_end_time fromdual; Dbms_output.put_line ('Execute sucess'||V_start_time||' -'||v_end_time);End;/
PL/SQL Declare loop if