2012-11-01 99 views
-2

我是否正確處理下面的過程,有一些編譯錯誤,有人可以幫我解決我所犯的錯誤。警告:編譯錯誤的過程

create or replace PROCEDURE CRangeproc(in_termid IN VARCHAR2,in_cardno IN VARCHAR2,outcount OUT NUMBER,outissu OUT VARCHAR2,outacq OUT VARCHAR2,CIssuer OUT SYS_REFCURSOR,CAcquirer OUT SYS_REFCURSOR) 
AS 
BEGIN 
select count(*) into outcount from cardrangetable where PAN_LOW <= in_cardno AND PAN_HIGH >= in_cardno and terminal_id = in_termid; 
if outCount = 1 then 
select ISSUERTABLEID into outissu,ACQUIRERTABLEID into outacq from cardrangetable where PAN_LOW <= in_cardno AND PAN_HIGH >= in_cardno and terminal_id = in_termid; 
Open CIssuer FOR 
select * from Issuer_tble where TERMINAL_ID = in_termid and ISSUERTABLEID = outissu; 
CLOSE CIssuer; 
Open CAcquirer FOR 
select * from ACQUIRERTABLE where TERMINAL_ID = in_termid and ACQUIRERID = outacq; 
CLOSE CAcquirer; 
end if; 
End CRangeproc; 

三江源

+0

什麼是編譯錯誤?我們不是心靈感應,沒有模式對象,我們無法爲自己編譯代碼。 – APC

回答

0

喜在這一部分,我看到一些錯誤

if Outcount = 1 then 
select Issuertableid 
    into Outissu, Acquirertableid 
    into Outacq 
from Cardrangetable 
where Pan_Low <= In_Cardno 
    and Pan_High >= In_Cardno 
    and Terminal_Id = In_Termid; 

它應該是這樣的

if Outcount = 1 then 
select Issuertableid, Acquirertableid 
    into Outissu, Outacq 
from Cardrangetable 
where Pan_Low <= In_Cardno 
    and Pan_High >= In_Cardno 
    and Terminal_Id = In_Termid; 

並打開/關閉使用不當(也許你試圖使用遊標)

open Cissuer for 
    ------ 
close Cissuer; 
open Cacquirer for 
    ---- 
close Cacquirer; 
+0

我在遇到符號「THENSELECT」時期待以下其中一種和 遇到符號「OPEN」 我在這裏沒有得到wats的問題,請幫助 – 1001

0

它是每個SELECT語句的一個INTO子句。您不應該在此功能中關閉REF CURSOR。消耗它們的程序需要處理它們。

這是你的代碼應該喜歡什麼:

create or replace PROCEDURE CRangeproc 
    (in_termid IN VARCHAR2 
    ,in_cardno IN VARCHAR2 
    ,outcount OUT NUMBER 
    ,outissu OUT VARCHAR2 
    ,outacq OUT VARCHAR2 
    ,CIssuer OUT SYS_REFCURSOR 
    ,CAcquirer OUT SYS_REFCURSOR) 
AS 
BEGIN 
    select count(*) 
    into outcount 
     from cardrangetable 
    where PAN_LOW <= in_cardno 
    AND PAN_HIGH >= in_cardno 
    and terminal_id = in_termid; 

    if outCount = 1 then 
     select ISSUERTABLEID,ACQUIRERTABLEID 
     into outissu, outacq 
       from cardrangetable 
     where PAN_LOW <= in_cardno 
     AND PAN_HIGH >= in_cardno 
     and terminal_id = in_termid; 
     Open CIssuer FOR 
      select * from Issuer_tble 
          where TERMINAL_ID = in_termid 
          and ISSUERTABLEID = outissu; 
     Open CAcquirer FOR 
      select * from ACQUIRERTABLE 
          where TERMINAL_ID = in_termid 
          and ACQUIRERID = outacq; 
    end if; 
End CRangeproc; 

我認爲你需要學會使用回車來提高你的代碼的佈局。