Search code examples
mysqlsqlblock

Firebird EXECUTE BLOCK on MySQL


How to use Firebird execute block statement on MySQL?

execute block
as
declare i int = 0;
begin
  while (i < 128) do
  begin
    insert into AsciiTable values (:i, ascii_char(:i));
    i = i + 1;
  end
end

Solution

  • You meant Firebird execute block similar thing in MySQL; if yes then wrap your posted code inside a stored procedure like below which will do the work

    create procedure usp_test
    as
    begin
    declare i int = 0;
      while (i < 128) do
      begin
        insert into AsciiTable values (:i, ascii_char(:i));
        i = i + 1;
      end
    end