CREATE OR REPLACE function SqGetData(ppid IN VARCHAR2) RETURN VARCHAR2 IS
DECLARE
varResult VARCHAR2(1024);
varBloodNo VARCHAR2(32);
varSex VARCHAR2(32);
varSexN VARCHAR2(32);
varName VARCHAR2(32);
varBirthday VARCHAR2(32);
varPassportid VARCHAR2(32);
varExamdate VARCHAR2(32);
varToday VARCHAR2(32);
varTodayN VARCHAR2(32);
BEGIN
varToday := TO_CHAR(SYSDATE, 'yyMMdd ');
varTodayN := TO_CHAR(SYSDATE, 'yyyy-MM-dd ');
varBloodNo := varToday || ppid;
select SURNAME,SEX,TO_CHAR(BIRTHDAY, 'yyyy-MM-dd '),PASSPORT_ID,TO_CHAR(EXAM_DATE, 'yyyy-MM-dd ') into varName,
varSex, varBirthday, varPassportid, varExamdate from EXAM_CXDJ as a, EXAM_RECORD as b where a.BLOOD_NO = varBloodNo and
a.EXAM_NO = b.EXAM_NO;
IF varSex = '0 ' THEN
varSexN := '男 ';
ELSE
varSexN := '女 ';
END IF;
varResult := '1, '||varName|| ', '||varSexN || ', '||varBirthday|| ', '|| 'ID0,ID0,ID0,ID0,ID0,ID0,ID0, , ' || varPassportid
|| ', '||varExamdate|| ', '||varTodayN|| ', , ,ID0,ID0, , ';
return varResult ;
EXCEPTION