oracle的stored procedure 問題 |
答題得分者是:Fishman
|
narcysion
一般會員 發表:54 回覆:18 積分:14 註冊:2003-03-14 發送簡訊給我 |
我使用的oracle是8.15,我要寫一段Stored Procedure,但總是出現下面錯誤,請各位高手幫我看一下好嗎?
錯誤訊息為:PLS-00103:Encountered the symbol "sp_test" when expecting one of the following :if 程式碼如下:
create or replace procedure SP_test
as
v_MM Integer;
v_CurDate varchar2(6);
v_Code varchar2(15);
begin
delete from RunCardWK;
delete from RunCard_listWK;
commit;
select v_Code SubStr(v_CurDate,2,1)into v_Code FROM DUAL;
if v_MM < 10 then
select v_Code SubStr(v_CurDate,4,1)into v_Code from dual;
else if v_MM = 10 then
select v_Code 'A' into v_Code from dual;
else if v_MM = 11 then
select v_Code 'B' into v_Code from dual;
else if v_MM = 12 then
select v_Code 'C' into v_Code from dual;
end if;
end SP_test;
|
Fishman
尊榮會員 發表:120 回覆:1949 積分:2163 註冊:2006-10-28 發送簡訊給我 |
Hi:
CREATE OR REPLACE PROCEDURE SP_TEST AS V_MM INTEGER; V_CURDATE VARCHAR2(6); V_CODE VARCHAR2(15); BEGIN DELETE FROM RUNCARDWK; DELETE FROM RUNCARD_LISTWK; COMMIT; SELECT V_CODE SUBSTR(V_CURDATE,2,1)INTO V_CODE FROM DUAL; IF V_MM < 10 THEN SELECT V_CODE SUBSTR(V_CURDATE,4,1)INTO V_CODE FROM DUAL; ELSIF V_MM = 10 THEN SELECT V_CODE 'A' INTO V_CODE FROM DUAL; ELSIF V_MM = 11 THEN SELECT V_CODE 'B' INTO V_CODE FROM DUAL; ELSIF V_MM = 12 THEN SELECT V_CODE 'C' INTO V_CODE FROM DUAL; END IF; END SP_TEST;-------------------------------- 小弟才疏學淺,若有謬誤請不吝指教 --------------------------------
------
Fishman |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |