Return error code and error message when running a procedure
634367Oct 20 2010 — edited Oct 22 2010Hi all
I need to run an oracle stored procedure in a job and I would like to know how to call it and how to trap an error code when the procedrue faiils. The equivalent of sys.exit(1) in Python
These areError trapping source code examples for .net and Python. How can I do something similar with an Oracle procedure?
Module Module1
Sub Main()
Try
‘<your code>
Catch ex As Exception
System.Environment.ExitCode = 1 'General Exception Error
Console.WriteLine(ex.Message)
End Try
End Sub
End Module
Method 2
Example of Error trapping in Python:
# Python sample of a function that calls the Trap.cmd command
import win32api, os, sys
def CreateErrorFlag(aJobName):
try:
commandLine = "C:\Trigger\trap.cmd " + aJobName
aresult = os.system(commandLine)
if aresult > 0:
sys.exit(1)
except:
return (aresult)
print "error"
sys.exit(1)
CreateErrorFlag("J123456")