Oracle程序,请大家看看!!

Oracle程序,请大家看看!!

大家好!我编了个程序,不知道好不好,请大家看看。我的ORACLE好象有问题所以我没有试。有毛病请告诉我,谢谢了!!!

CREATE OR REPLACE FUNCTION smallto big (smallmoney VARCHAR2)
RETURN VARCHAR2 AS
bigwrite VARCHAR2(2);
bignum VARCHAR2(2);
rmb VARCHAR2(2);
moneyplace NUMBER;
dotplace NUMBER;
moneynum NUMBER;
myexception EXCEPTION;
BEGIN
dotplace :=INSTR(smallmoney ,'.');
IF (LENGTH(smallmoney)>14)
OR ((LENGTH(smallmoney)>12) AND (dotplace =0)) THEN
RAISE myexception;
END IF;
IF dotplace =0 THEN
moneyplace :=0;
ELSE
moneyplace :=dotplace - LENGTH(smallmoney);
END IF;
FOR moneynum IN 1..LENGTH(smallmoney) LOOP
IF moneynum <> dotplace THEN
CASE SUBSTR(smallmoney,moneynum,1)
WHEN '1' THEN bignum :='壹';
WHEN '2' THEN bignum :='贰';
WHEN '3' THEN bignum :='叁';
WHEN '4' THEN bignum :='肆';
WHEN '5' THEN bignum :='伍';
WHEN '6' THEN bignum :='陆';
WHEN '7' THEN bignum :='柒';
WHEN '8' THEN bignum :='捌';
WHEN '9' THEN bignum :='玖';
WHEN '0' THEN bignum :='零';
END CASE;
CASE moneyplace
WHEN '-2' THEN rmb :='分';
WHEN '-1' THEN rmb :='角';
WHEN '0'  THEN rmb :='元';
WHEN '1'  THEN rmb :='拾';
WHEN '2'  THEN rmb :='佰';
WHEN '3'  THEN rmb :='仟';
WHEN '4'  THEN rmb :='万';
WHEN '5'  THEN rmb :='拾';
WHEN '6'  THEN rmb :='佰';
WHEN '7'  THEN rmb :='仟';
WHEN '8'  THEN rmb :='亿';
WHEN '9'  THEN rmb :='拾';
WHEN '10' THEN rmb :='佰';
WHEN '11' THEN rmb :='仟';
END CASE;
moneyplace := moneyplace+1;
IF bigwrite IS NULL THEN
bigwrite := bignum||rmb;
ELSE
bigwrite := bignum||rmb||bigwrite;
END IF;
END IF;
END LOOP;
RETURN bigwrite;
EXCEPTION
WHEN myexception THEN
DBMS_OUTPUT.PUT_LINE('长度不能大于14或整数位不大于12');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('不是有效钱数');
END;
DECLARE
money VARCHAR2(10);
BEGIN
money :=smalltobig('123.67');
DBMS_OUTPUT.PUT_LINE(money);
END;
/      
LINE/COL ERROR
-------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
28/13    PLS-00103: Encountered the symbol "CASE" when expecting one of the following:       begin declare exit for goto if loop mod null pragma raise     return select update while <an identifier>     <a double-quoted delimited-identifier> <a bind variable> <<     close current delete fetch lock insert open rollback     savepoint set sql execute commit forall     <a single-quoted SQL string>  The symbol "CASE" was ignored.      
请具体说说。我运行了好象无问题耶!      
LINE/COL|ERROR
--------|-----------------------------------------------------------------
23/1    |PLS-00103: Encountered the symbol "CASE" when expecting one of
        |the following:
        |begin declare exit for goto if loop mod null pragma raise
        |return select update while <an identifier>
        |<a double-quoted delimited-identifier> <a bind variable> <<
        |close current delete fetch lock insert open rollback
        |savepoint set sql execute commit forall
        |<a single-quoted SQL string>
        |The symbol "CASE" was ignored.

24/1    |PLS-00103: Encountered the symbol "WHEN" when expecting one of
        |the following:
        |:= . ( % ;


以上是在我的机器上(RH Linux 7.3 + Oracle 8.1.6)运行时的错误信息。
PL/SQL好象不支持CASE语句。      
你是不是用的8i
我用的是9i