How to check if the Object is valid or not?
1002358May 20 2013 — edited May 21 2013I have a scenario in my Stored Procedure, where the functions looks for an User_Object, and if found (=1), then it execute.
ex:
IF TEXISTS('LAB_IN') = 1 THEN
FOR x IN (SELECT COLUMN_NAME, SRC_COL, SRC_TBL, COLUMN_PREFX, COLUMN_STRING_OPP, DEST_TABLE FROM L_UTIL_SRC WHERE SRC_TBL = 'L')
LOOP
VCAT:=CASE WHEN ISCAT>0 THEN REPLACE(x.DEST_TABLE, 'UTIL_', '') ELSE '' END;
vblJOB := '';
vblJOB := vblJOB || 'CREATE OR REPLACE PROCEDURE SP_' ||x.DEST_TABLE||' AS ';
vblJOB := vblJOB || 'PRAGMA AUTONOMOUS_TRANSACTION; ';
vblJOB := vblJOB || 'vblQueryName VARCHAR2(150); ';
..........
..........
..........
My question is, what if the object (LAB_IN) is not valid. Or if any changes have been made to it. How can i make this Function NOT execute, if the object is not Valid.... and shows error message without proceeding further...
Any suggestions/comments, would apprecaite it......
Thanks!