Determine The State Of The Error
September 13, 2016 Ted Holt
The SQL Procedures Language (SQL PL) has an effective error-handling mechanism–condition handlers. When a statement returns a certain SQL state or a certain type of exception, the condition handler takes control. However, determining which SQL state to test for can be problematic. Here are two ways. Let’s start with a simple stored procedure. Create or replace procedure CreatePlants begin create table plants ( ID dec(3), Location varchar(16), primary key (ID)); label on table plants is 'Plant master'; insert into plants values ( 1, 'Lost Angeles'), ( 2, 'New Yolk'), ( 3, 'Last Vegas'); end What could go wrong? Well, the |