Baiju Thakkar Posted May 16, 2019 Posted May 16, 2019 Hi I am wondering how to extract resourcename and path of the script that is currently executed. I would want to include a standard exception routine at the end of each scrip to email out the resource name and path that was being executed. Are there any system properties or any workaround to get that details like we can get username of the user under which script is being executed using CALL getproperty('CURRENT_USER_Name', l_username);
Motsu Aboshi Posted May 29, 2019 Posted May 29, 2019 You can try using CURRENT_EXCEPTION.TRACE to get the stack trace, and if needed, parse that to only return e.g the first line Or, you could try getProperty on TRANSACTION_ID, and use SYS_REQUESTS afterward to identify the resource name.
Baiju Thakkar Posted June 3, 2019 Author Posted June 3, 2019 I did tried this workaround, but i do not see any of this will return Resource ID or Path by any chance. We can get the text (Whole Script) but not the path or ID! Do you have a code to showcase how to extract path or id from Exception trace and ID by any chance
Motsu Aboshi Posted June 10, 2019 Posted June 10, 2019 I don't have access to an instance in order to provide a fully tested code snippet. My suggestion would be to catch the exception, store the message in a variable, and do something like REGEXP_EXTRACT to get the path. Less of a hack would be to use getProperty to get the TRANSACTION_ID. Even less of a hack, would be to look this up after the fact from the system tables.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now