1.ORACLE
create or replace procedure proc_test (v_pat_no in varchar2,
cv_1 out sys_refcursor) as
v_patient_id varchar2(12);
v_times number;
tempsize number;
begin
select count(1) into tempsize
from zy_actpatient
where inpatient_no = v_pat_no
and substr(patient_id, 12, 1) = '0'
and nvl(visit_type, '0') <> 'XX';
if tempsize >0 then
select patient_id, admiss_times
into v_patient_id, v_times
from zy_actpatient
where inpatient_no = v_pat_no;
else
select '',''into v_patient_id, v_times from dual;
end if;
open cv_1 for
select a.* from a ;
end;