One of my friend asked me following question.
“I want to drop two columns of a table. So I wrote a basic drop command.
“alter table t_test drop (col_name1, col_name2)”
However, If this command is called more than once. I do not want an error message. What can I do for this?”
It’s a strange request, but this will learn us how to write a non-predefined exception to solve this kind of requests. We can handle ORA-XXXXX exception as we want. We name them this numbered exceptions and handle them. I will write a post about exception types as soon as possible.
When we try to drop a column that does not exists on the table. We get following error: ORA–00904: invalid column name. It’s error number “-904”. We will use this number to define the exception.