years of industry experience as developer, cloud architect and data analyst • PL/SQL evangelist • Life is easy (or tough) when you support Arsenal FC, read PG Wodehouse and eat Mangoes (! wrong season !) Shashank Barki / @shankbarki
stages of program execution. • A program call stack includes the nested information of the referenced subprograms. • DBMS_UTILITY.FORMAT_CALL_STACK function or UTL_CALL_STACK • Issue with the FORMAT_CALL_STACK output is the inability to extract the drill-down up to local routine information and use it for debugging tasks. Tracking coding information (contd.)
error stack. • From 12C onwards • The structured call stack output allows developers to extract the information and use it for debug purposes. Tracking coding information (contd.)
and SQLCODE !! • PL/SQL programs invoke routines, and it may happen that a routine call fails with an exception. • The exception propagates to the calling block and traverses through multiple blocks in search of its handler. To track the path of propagating exceptions – 1. FORMAT_ERROR_BACKTRACE function from DBMS_UTILITY 2. UTL_CALL_STACK package
identifiers, delimiters, and comments. • All items that are declared in a PL/SQL program as variables, cursors, constants, and subprogram names are identifiers. • Identifiers can be reserved words (such as BEGIN and END), predefined (declared globally within STANDARD package), or quoted. • USER_IDENTIFIERS • The USER_IDENTIFIERS dictionary view reports the usage of identifiers in a PL/SQL program unit. • The view includes information about an identifier's name, its type, and usage by line number in a PL/SQL program.
PL/SQL program. • The identifier details are stored in the SYSAUX tablespace • Queried from the USER_IDENTIFIERS dictionary view • PL/Scope tool from SQL Developer. PLSCOPE_SETTINGS PARAMETER • The compilation parameter PLSCOPE_SETTINGS enables the collection of identifier data in a PL/SQL program. • By default, the parameter is disabled (IDENTIFIERS:NONE). • It should be set to IDENTIFIERS:ALL in order to enable identifier tracking.
enables the extraction of object metadata from database dictionaries that can be optionally manipulated and re-executed on a database server. • The package is owned by SYS whose public synonym is used by all users. • A user with SELECT_CATALOG_ROLE can directly access the DBMS_METADATA package.