5. Embedded QUEL : Program Status Information : The Inquire_ingres Statement
 
Share this page                  
The Inquire_ingres Statement
An example of the use of the inquire_ingres statement follows:
begin program
## rcount, err_no   integer
## errmsg          character_string(256)
## ingres   "personnel"
## append to employee (empnum = 12, 
##  empname = "john smith", salary = 10000)
## /* find out if an error occurred while appending */
## inquire_ingres (rcount = rowcount, err_no = errorno,
## errmsg = errortext)
## /* if error occurred, print its number and message */
  if err_no > 0 then      print "ingres error", errorno, "occurred"
    print errmsg
## /* tell the user whether or not a row was added */
 else if rcount > 0 then
    print "row successfully appended"
 else
    print "integrity violation or duplicate record"
 end if
## exit
end program
The rowcount value is useful for detecting integrity violations.