What does the SQLERRM Function do
2012-02-25 15:15
357 查看
What does the SQLERRM Function do?
The SQLERRM function returns the error message associated with the most recently raised error exception. This function should only be used within the Exception Handling section of your code:EXCEPTION
WHEN exception_name1 THEN
[statements]
WHEN exception_name2 THEN
[statements]
WHEN exception_name_n THEN
[statements]
WHEN OTHERS THEN
[statements]
END [procedure_name];
You could use the SQLERRM function to raise an error as follows:
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
END;
Or you could log the error to a table as follows:
EXCEPTION
WHEN OTHERS THEN
err_code := SQLCODE;
err_msg := substr(SQLERRM, 1, 200);
INSERT INTO audit_table (error_number, error_message)
VALUES (err_code, err_msg);
END;
相关文章推荐
- What does the SQLCODE Function do
- What does the PF function do in Primefaces
- Mongoose - What does the exec function do?
- What does the three dots in react do?
- what-is-the-bios-and-what-does-it-do
- What does the yield keyword do in Python?
- What Does __read_mostly In The Linux Kernel Do?
- [stackoverflow翻译] “yield” 关键字有什么用?what-does-the-yield-keyword-do
- What does the CS_CLASSDC & CS_OWNDC class style do?
- What Does The HANDLECOLLISIONS Parameter Do? [ID 966207.1]
- What does this bit-manipulating function do?
- You just DO WHAT THE FUCK YOU WANT TO
- What do you think is the role of parents in preventing crime amongst young people?
- Why do I get the error "The target GatherAllFilesToPublish does not exist"?
- [转][经典]What is the right thing to do?
- what will the goverment do in next year
- So, what does the asterisk(*) mean in AssemblyVersion("1.0.*")?
- HttpWebRequest's Timeout and ReadWriteTimeout — What do these mean for the underlying TCP connection?
- UVALive 6581 What does the fox say? (模拟)
- What does idl attribute mean in the W3C html5 standard document?