我已经提供了全局变量&S_NAME,&R_ID我想在oracle存储过程中使用它来对kpi_log
表进行游标查询。这个全局变量将从我有列名和 id 的kpi_chk
表中获取所有必需的输入值,并将其传递给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;
如果变量中有值,请将其作为输入参数
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;