-Three Forms of loop (1). LOOP (2). While ... Looop (3). For ... LOOP1. Basic Loop statement set Serveroutput on;--exit ... when end loop declare v_value number (8): =-3; BEGIN <<value_loop>>-loop tag loop dbms_output.put_line (' V_value = ' | | v_value); V_value: = v_value+1; EXIT Value_loop when V_value > 3; END LOOP; Dbms_output.put_line (' Loop loop is over! ‘); end;--If ... exit end loop declare v_value number (8): =-3; BEGIN <<value_loop>> Loop Dbms_output.put_line (' Value: ' | | v_value); V_value: = V_value +1; IF v_value > 3 then Dbms_output.put_line (' value was larger than 3, current value is ' | | v_value); EXIT Value_loop; END IF; END LOOP Value_loop; Dbms_output.put_line (' Loop is end '); End;2.while. Loop structure itself can end the loop declare v_value number (8): =-3; BEGIN <<while_loop>> while (V_value < 4) loop Dbms_output.put_line (' value is ' | | v_value); V_value: = V_value + 1; END LOOP While_loop; Dbms_output.put_line (' While loop iS end '); End;3. For ... The loop structure can traverse a range integer begin for V_value IN-3..3 LOOP dbms_output.put_line (' value is ' | | v_value); END LOOP; Dbms_output.put_line (' For loop is End '); end;--Oracle Time Sysdate system time systimestamp the current system timestamp Current_timestamp related to the time zone setting, the returned seconds are system, and the returned date and time are converted according to the time zone. Current_date Is the rounding of the Current_timestamp exactly to the second. Select Sysdate,systimestamp,current_date,current_timestamp from dual;--oracle sequence create SEQUENCE Seq_tt_trms_car_task START with 1INCREMENT by 1NOMAXVALUEMINVALUE 1NOCYCLENOCACHEcurrval: Returns the current value of sequence Nextval: Returns the value of the increment sequence, Then return the value of sequence select Seq_tt_trms_car_task.currval from dual; SELECT Seq_tt_trms_car_task.nextval from dual;--sql%rowcount the number of rows affected by the Oracle variable
Oracle Syntax Logging