我已经提供了全局变量& S_NAME,& R_ID,我希望在oracle存储过程中使用kpi_log
表的游标查询。此全局变量将从kpi_chk
表中获取所有必需的输入值,其中我有列名和id,并将其传递给kpi_log
表。我之前没有使用全局变量,甚至不知道如何使用它。
CREATE OR REPLACE PROCEDURE TEST_CHK
(IN_L_ID OUT NUMBER)
AS
CURSOR STA_CHECK IS
Select NAME, ID FROM KPI_LOG where NAME = [here i have to use gloabal variable] and ID = [here i have to use gloabal variable];
BEGIN
...
END TEST_CHK;
答案 0 :(得分:1)
如果变量中有值,请将其作为输入参数
CREATE OR REPLACE PROCEDURE TEST_CHK
(IN_L_ID OUT NUMBER, S_NAME VARCHAR2(50),R_ID VARCHAR2(50) )
AS
CURSOR STA_CHECK IS
Select NAME, ID FROM KPI_LOG where NAME = S_NAME and ID =R_ID;
BEGIN
...
END TEST_CHK;