oracle 游标

create or replace function f_get_main_dis(psn IN varchar2,yybm IN varchar2,sqbm IN varchar2) return varchar2 is
  Result LONG;
  CURSOR cur_dis IS
        SELECT dic_chronic_disease.dis_name 
          FROM chronic_disease_record,dic_chronic_disease 
         WHERE chronic_disease_record.dis_no = dic_chronic_disease.dis_no
           AND people_sn = psn
           AND chronic_disease_record.client_yybm=yybm
           AND chronic_disease_record.client_sqbm = sqbm;
         
  recRow cur_dis%Rowtype;    
       
begin
       Result:='';
       FOR recRow IN cur_dis
       LOOP
          Result:=RESULT || recRow.dis_name || ',';
       END LOOP;
       --dbms_output.put_line('return'||Result);

  return(Result);
end f_get_main_dis;

你可能感兴趣的:(oracle,sql,F#)