title: IBM DB2 error sql code-724 & sql state 54038
body: <p>I was trying to insert some sample data to the table but the db2 command line processor return this message "DB21034E  The command was processed as an SQL statement because it was not a
  valid Command Line Processor command.  During SQL processing it returned:
  SQL0723N  An error occurred in a triggered SQL statement in trigger
  "EDWIN.CALLCQ".  Information returned for the error includes <code>SQLCODE "-724"</code>,
  <code>SQLSTATE "54038"</code> and message tokens "EDWIN.CHKQUANTITY|PROCEDURE ".
  SQLSTATE=09000"</p>
  
  <p>Here is my procedure</p>
  
  <pre><code>create procedure chkQuantity (Cart_ID int,Food_ID int, Food_Quantity int)begin declare c cursor with return for select sum(Food_Quantity) from Cart_details group by Cart_ID;open c; If(Food_Quantity &lt;= 10)then insert into cart_details(Cart_ID,Food_ID,Food_Quantity) values (Cart_ID , Food_ID ,Food_Quantity);Else signal sqlstate'45000' set message_text = '1 Cart Maximum order only 10 food Quantity' ;delete from cart_details where cart_details_id=cart_details_id; end if;close c; end
  </code></pre>
  
  <p>trigger</p>
  
  <pre><code>create trigger callCQ after insert on cart_details referencing new as N for each row mode db2sql call chkQuantity(N.Cart_ID, N.Food_ID, N.Food_Quantity)
  </code></pre>
  
  <p>table</p>
  
  <pre><code>create table Cart_Details(Cart_Details_ID int not null primary key ,Cart_ID int , Foreign Key(Cart_ID) references Cart,Food_ID int,foreign key(Food_ID) references Food, Food_quantity int check(food_quantity &lt;= 10))
  </code></pre>