4. SQL Statements : INQUIRE_SQL : INQUIRE_SQL Example
Share this page                  
Execute some database statements, and handle errors by displaying the message and aborting the transaction.
exec sql whenever sqlerror goto err_handle;

exec sql select name, sal
    into :name, :sal
    from employee
    where eno = :eno;

if name = 'Badman' then
    exec sql delete from employee
        where eno = :eno;
else if name = 'Goodman' then
    exec sql update employee set sal = sal + 3000
        where eno = :eno;
end if;

exec sql commit;



exec sql whenever sqlerror continue;
exec sql inquire_sql (:err_msg = errortext);
print 'INGRES error: ', sqlca.sqlcode;
print err_msg;
exec sql rollback;