create or replace procedure pr_test1 is v_case number(3):= 100; beginif 2>1 thendbms_output.put_line('成立');elsif 4>3 thenif 7>6 thendbms_output.put_line('不成立');end if; elsif 6>5 thendbms_output.put_line('也行');elsedbms_output.put_line('也不成立');end if;case v_casewhen 1 thendbms_output.put_line('条件匹配= 1');when 100 then dbms_output.put_line('条件匹配 = 100');elsedbms_output.put_line('条件不匹配');end case;casewhen 8>7 thendbms_output.put_line('成立');when 9>8 thendbms_output.put_line('也成立');elsedbms_output.put_line('都不成立');end case;<<loop1>>loopv_case := v_case - 1;dbms_output.put_line('v_vase ='|| v_case);--if(v_case = 90) then--dbms_output.put_line('退出循环');exit loop1 when v_case = 90;-- end if;end loop;dbms_output.put_line('v_vase ='|| '_________');for inx in reverse 1 ..10 loop v_case := v_case + inx;dbms_output.put_line('v_vase ='|| v_case);end loop;while v_case>80loopv_case := v_case - 1;dbms_output.put_line('v_vase ='|| v_case);end loop; end pr_test1;
create or replace procedure pr_test2(v_nl in varchar2 default'12') is beginupdate t_hq_ryxx set ruzrq = sysdate where nianl = v_nl;commit;end pr_test2;
create or replace procedure pr_test3(v_nl in varchar, v_xx in out varchar2) is beginselect xingm into v_xx from t_hq_ryxx where nianl = v_nl and bum = v_xx;exceptionwhen no_data_found thendbms_output.put_line('查不着');when others thendbms_output.put_line('查找出错'); end pr_test3;
create or replace procedure pr_test4(v_nl in varchar2) isv_xm t_hq_ryxx.xingm%type;beginv_xm :='101';pr_test3(v_nl,v_xm );dbms_output.put_line('v_xm ='||v_xm);end pr_test4;
create or replace procedure pr_test5 is beginupdate t_hq_ryxx set bum = '101' where bum is null;commit;if sql%rowcount > 0 thendbms_output.put_line('更新'|| sql%rowcount ||'条记录');elsedbms_output.put_line('更新0条记录'); end if; end pr_test5;