警告:编译错误的过程
Posted
技术标签:
【中文标题】警告:编译错误的过程【英文标题】:Warning:Procedure with compilation errors 【发布时间】:2012-11-01 11:32:42 【问题描述】:我是否以正确的方式处理以下过程,有一些编译错误,有人可以帮我解决我所做的错误。
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;
谢谢
【问题讨论】:
什么是编译错误?我们不是心灵感应的,没有您的架构对象,我们无法为自己编译您的代码。 【参考方案1】:您好,在这部分我看到了一些错误
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;
【讨论】:
我遇到了符号“THENSELECT”,当期待以下之一并遇到符号“OPEN”我没有得到这里的问题,请帮助【参考方案2】:每个 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;
我认为您需要学习使用回车来改进代码的布局。
【讨论】:
以上是关于警告:编译错误的过程的主要内容,如果未能解决你的问题,请参考以下文章