Statement of Oracle loop: declarex number: = 5; begin -- X: = 0; loopx: = x + 1;/* If (x = 10) Then exit; end if; */exit when x = 10; dbms_output.put_line ('X = '| X); End loop; dbms_output.put_line ('outer'); end;/define declarex number: = 5; beginwhile x <10 loopx: = x + 1; dbms_output.put_line ('X = '| X); End loop; dbms_output.put_line ('outer'); end; /----------------------------- beginfor X in 2 .. 10 loopdbms_output.put_line ('X = '| X); End loop; end;/------------------------------- declarex number: = 5; begin <
> -- Mark X: = x + 1; dbms_output.put_line ('X = '| X); If x <10 Then goto label1; end if; end; /------------- Exception Handling exceptionwhen .. then... common system exceptions: dup_val_on_indexno_data_foundtoo_many_rowsvalue_errorzero_dividee.g.: declareva varchar2 (20); beginselect A into VA from ABC where f_nvar = 'abc'; dbms_output.put_line (VA); exceptionwhen no_data_found values ('data not found '); end; ----------------------- declareva varchar2 (20); vi integer; beginselect A into VA from ABC where f_nvar = 'min min wan'; dbms_output.put_line (VA); VI: = 1/0; exceptionwhen no_data_found partition ('data not found '); when others thendbms_output.put_line ('Other questions'); end; ----------------- declareva varchar2 (20); vi integer; e exception; beginselect A into VA from ABC where f_nvar = '文 '; dbms_output.put_line (VA); -- VI: = 1/0; Raise E; predictionwhen no_data_found locate ('unfound data '); when e encode ('problem A'); when others thendbms_output.put_line ('Other questions'); end; ------------------- composite variable: record type type_name is record (variable_name datatype, variable_name datatype ,...); ----------- declare myrec ABC % rowtype; beginselect * into myrec from ABC where a = 'aaa'; dbms_output.put_line (myrec. A | myrec. B | myrec. c); end; ------------------- row_number () function and select row_number () over (order by a) SA, a, B, c, f_nvar from abcselect * from ABC where rownum <10 declare myrec ABC % rowtype; beginselect * into myrec from ABC where a = 'aaa11123 'and rownum <2; dbms_output.put_line (myrec. A | myrec. B | myrec. c | myrec. f_nvar); end; begin a simple stored procedure: Create or replace procedure proc_show_abc_by_a (PA varchar2) ASFA varchar2 (20); beginselect A into fa from spark. ABC where a = PA; dbms_output.put_line (FA); end;/------------------------------------- create or replace public synonym myabc for spark. ABC; ------------------------------------- sequence create sequence myseqstart with 1 increment by 1 ordernocycle;