- 论坛徽章:
- 0
|
以为自己能够根据例子进行更改,但是还是很郁闷!!
create or replace procedure GET_PAY(CYEAR STRING, ANNALS STRING) is
cursor C_CURSOR is
SELECT A.PNAME, A.BIRTHDAY,A.CARD, TO_CHAR(A.BIRTHDAY,'YYYY') AS BYEAR,
TO_CHAR(A.BIRTHDAY,'MM') AS BMONTH , TO_CHAR(A.BIRTHDAY, 'DD') AS BDAY,
(TO_CHAR(SYSDATE,'YYYY'))- TO_CHAR(A.BIRTHDAY,'YYYY') AS AGE, B.PAY*6
FROM ADMIN.ASSOCIATOR A, BASIC_PENSION B
WHERE TO_CHAR(SYSDATE,'YYYY') - TO_CHAR(A.BIRTHDAY,'YYYY') >= B.STARTAGE
AND TO_CHAR(SYSDATE,'YYYY') - TO_CHAR(A.BIRTHDAY,'YYYY') < B.ENDAGE
AND A.BOON = 1
Lv_PNAME ASSOCIATOR.PNAME%TYPE;
Lv_CARD ASSOCIATOR.CARD%TYPE;
Lv_BIRTHDAY ASSOCIATOR.BIRTHDAY%TYPE;
Lv_BYear NUMBER;
Lv_BMonth NUMBER;
Lv_BDay NUMBER;
Lv_Age NUMBER;
Lv_Pay NUMBER;
BEGIN
OPEN C_CURSOR;
LOOP
FETCH C_CURSOR into Lv_PNAME,Lv_BIRTHDAY,Lv_CARD,Lv_BYear,Lv_BMonth,Lv_BDay,Lv_Age,Lv_Pay;
EXIT WHEN C_CURSOR%NOTFOUND;
END LOOP;
CLOSE C_CURSOR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
close C_CURSOR;
end GET_PENSION;
提示我SQL命令未能正确结束??郁闷!!
因为我还需要按照出生日期来判断是否需要进入下一档的付费标准
例如,55岁3月份出生,则1月、2月的标准按照45--55标准,3到6月按照55--65标准计算
所以,SELECT语句如上。
[ 本帖最后由 大脚王 于 2007-1-22 14:15 编辑 ] |
|