Subject How to execute Stored Procedure code directly from Delphi ?
Author Mario
I need to execute the ALTER PROCEDURE code at runtime using Delphi SQL
statements (I cannot execute it directly from SQL editor due to table
integrity issues). The code below produces an error: ("SQL error code
= -104 Token unknown.. SET'...) on line 2, when executed at runtime.
What would be the correct method of writing this code using Delphi SQL
statements ?
Thanks in advance. Mario

Transaction.StartTransaction;
SQL.Clear;
SQL.Add('COMMIT WORK');
SQL.Add('SET AUTODDL OFF');
SQL.Add('SET TERM');
SQL.Add('^');
SQL.Add('ALTER PROCEDURE GETSTDDEV(FIRSTDATE TIMESTAMP)');
SQL.Add('RETURNS(AVGINDEX REAL,COUNTINDEX INTEGER,STDDEV REAL)');
SQL.Add('AS');
SQL.Add('begin');
SQL.Add('select avg(xindex), count(xindex) from xtable');
...
SQL.Add('end');
SQL.Add('^');
SQL.Add('SET TERM');
SQL.Add('^');
SQL.Add('COMMIT WORK');
SQL.Add('SET AUTODDL ON');
ExecQuery;
Transaction.Commit;