Is there a way/ a command that will verify when running a package that it is pulling a variable from a cursor?
I have a package that I am running a cursor that I run the statement manually and it pulls what I need. I run the package and its not pulling a variable.
CURSOR dbvalue_cur IS
SELECT ABC_ACCOUNT_A,
ABC_ACCOUNT_B,
ABC_A_PREM_LOC,
ABC_A_SERV_CLASS,
ABC_B_PREM_LOC,
ABC_B_SERV_CLASS,
ABC_A_CUST_COUNT,
ABC_A_REP_CON,
ABC_B_CUST_COUNT,
ABC_B_REP_CON,
ABC_A_ASVC,
ABC_B_ASVC,
ABC_REV_IND
FROM DEF, ABC
WHERE utrglcl_code = ABC_glcl_code
AND utrglcl_code = d_GLCLASS_CODE;
dbValue dbvalue_cur%ROWTYPE;
BEGIN
d_returnFieldsJSON := '';
U$_OL_PROPERTY_DB.returnFieldsTable := U$_OL_PROPERTY_DB.emptyReturnFieldsTable;
d_GLCLASS_CODE := NVL(U$_OL_PROPERTY_DB.getPageCacheValue('UTRGLCL_CODE'), 'NULL');
/*******************************************
** VALIDATION LOGIC START
*******************************************/
Open dbvalue_cur;
FETCH dbvalue_cur INTO dbValue;
I tried running cursor statement manually.
You said you ran that SELECT
statement manually and it returned some rows. It means that WHERE
clause made it happen. It looks as
WHERE utrglcl_code = ABC_glcl_code
AND utrglcl_code = d_GLCLASS_CODE;
which means that utrglcl_code
has to be equal to both ABC_glcl_code
and d_GLCLASS_CODE
.
We don't know value of ABC_glcl_code
(you didn't post that piece of code), while
d_GLCLASS_CODE
equals NVL(U$_OL_PROPERTY_DB.getPageCacheValue('UTRGLCL_CODE'), 'NULL')
.
Are you sure that getPageCacheValue
returned valid value? Looks strange, though; you're applying NVL
function which - in case that getPageCacheValue
returns null
sets d_GLCLASS_CODE
to 'NULL'
, a string.
If I were you, I'd check what's going on with these two variables. The simplest way to do that is to display them; enable serveroutput and then
<snip>
dbms_output.put_line('ABC_glcl_code = ' || ABC_glcl_code);
dbms_output.put_line('d_GLCLASS_CODE = ' || d_GLCLASS_CODE);
Open dbvalue_cur;
FETCH dbvalue_cur INTO dbValue;
What do you see? What happens when you put values (that are displayed) into select
statement's where
clause?