初次使用PL/SQL,请问这段代码一直提示编译错误.请各位帮忙,谢谢!
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
return '0, ';
END;
执行时提示“创建的过程带有编译错误”。
我查了很多资料,好像没发现有什么语法错误的,请各位帮忙,谢谢!
------解决方案--------------------varToday := TO_CHAR(SYSDATE, 'yyMMdd ');
改成
select TO_CHAR(SYSDATE, 'yyMMdd ') into varToday from dual;
试试
------解决方案--------------------我用pl/sql试验了下,目前发现两个错误:
declare去掉;
EXCEPTION
return '0, '改成
exception
when others then
return '0, ';
------解决方案--------------------select SURNAME,SEX,TO_CHAR(BIRTHDAY, 'yyyy-MM-dd '