sql - How can I assign a return value from a procedure to a new variable in Firebird? -


this procedure calling:

set term # ; create procedure f_rating(budget int)  returns (final_result varchar(5)) begin  if (budget <= 500000) final_result = 'low';  else if (budget <= 850000) final_result = 'mid';  else if (budget <= 1200000) final_result = 'high';  else if (budget > 1200000) final_result = 'ultra'; end # commit work # 

i calling inside trigger:

set term # ; create trigger tr_department_rating_insert department_tester after insert begin  select result f_rating(new.budget) :temp_rating;   update department_rating     set occurrences = occurrences + 1     rating = temp_rating; end #  commit work # 

i'm pretty sure dumb syntax error can't figure out.

the f_rating not selectable stored procedure (it doesn't have suspend in it) syntax call execute procedure <name> returning_values(<params>);, ie

set term # ; create trigger tr_department_rating_insert department_tester after insert begin  execute procedure f_rating(new.budget) returning_values(:temp_rating);   update department_rating     set occurrences = occurrences + 1     rating = temp_rating; end #  commit work # 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -