PLS-00225: subprogram or cursor reference is out of scope
504014Sep 25 2008 — edited Feb 24 2012I am trying to create a PL/SQL program to extract values from a table that has an XML data type. I created the SQL to extract the elements but when I put it into a PL/SQL program I get an error that points to a line in the SQL code that runs fine on it’s own.
I stripped the PL/SQL code down to the simplest from in order to debug
DECLARE
cursor cur_asset_info IS
SELECT extract(value(a1), '//ASSET_ID[1]/text()').getStringVal() AS "ASSET_ID",
extract(value(a1), '//ASSET_ID[2]/text()').getStringVal() AS "IP_ADDRESS",
extract(value(a1), '//IDENTIFIER/text()').getStringVal() AS "DB_IDENTIFIER",
extract(value(a1), '//PARENT_KEY/text()').getStringVal() AS "PARENT_KEY"
FROM scanxml_tbl p,
table(xmlsequence(extract( p.object_value, '/IMPORT_FILE/ASSET')))a1;
BEGIN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END
When I run this I get:
Error report:
ORA-06550: line 8, column 35:
PLS-00225: subprogram or cursor 'P' reference is out of scope
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
I am not exactly sure why I get the error.
Thanks,
Chris