在 Oracle 过程中声明变量
Declaring variables inside an Oracle procedure
mystrtID 的声明存在一些问题。我正在尝试实现分页,需要 select 从起始 ID
开始的范围
create or replace procedure GET_WORKFLOW_Range(p_Dataset OUT
Sys_Refcursor,
strtID IN integer,
quantity IN integer)
as
BEGIN
mystrtID:= strtID;
IF mystrtID = 0 Then
mystrtID := 2147483647;
end IF;
Open p_Dataset For
Select WKF_ID,
WKF_WORKFLOW_ID,
WKF_WORKFLOW_NAME,
WKF_WORKFLOW_VERSION,
WKF_WORKFLOW_SCHEMA
FROM CTS.WKF_WORKFLOW_MASTER
WHERE WKF_WORKFLOW_ACTIVE = '1' AND
WKF_ID < mystrtID AND
ROWNUM <= quantity
ORDER BY WKF_ID DESC;
END GET_WORKFLOW_Range;
只需在 as
之后用 integer
、number
之前 BEGIN
等适当的类型定义 mystrtID
:
mystrtID integer;
mystrtID 的声明存在一些问题。我正在尝试实现分页,需要 select 从起始 ID
开始的范围 create or replace procedure GET_WORKFLOW_Range(p_Dataset OUT
Sys_Refcursor,
strtID IN integer,
quantity IN integer)
as
BEGIN
mystrtID:= strtID;
IF mystrtID = 0 Then
mystrtID := 2147483647;
end IF;
Open p_Dataset For
Select WKF_ID,
WKF_WORKFLOW_ID,
WKF_WORKFLOW_NAME,
WKF_WORKFLOW_VERSION,
WKF_WORKFLOW_SCHEMA
FROM CTS.WKF_WORKFLOW_MASTER
WHERE WKF_WORKFLOW_ACTIVE = '1' AND
WKF_ID < mystrtID AND
ROWNUM <= quantity
ORDER BY WKF_ID DESC;
END GET_WORKFLOW_Range;
只需在 as
之后用 integer
、number
之前 BEGIN
等适当的类型定义 mystrtID
:
mystrtID integer;