Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Execute procedure on the fly
Tue, Jan 22 2013 4:25 PMPermanent Link

Hyun Ju Yong

Can elevatedb execute procedure on the fly?

Firebird can execute procedure without creating like this.

ibquery1.SQL.Text = ' execute block returns (val int)
                               as
                               begin
                                    select.... into val;
                                    suspend;
                                end';
ibquery1.open;
Tue, Jan 22 2013 8:29 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Hyun,

Yes, but in ElevateDB, that is called a Script :
Also, scripts can have parameters and return a dataset, exactly as a stored procedure.
Here is an example with parameters:

EDBScript1.SQL.Text := 'SCRIPT (IN ID1 INTEGER, IN ID2 INTEGER, OUT X INTEGER)' +
                       'BEGIN '+
                       '  DECLARE N1, N2 INTEGER ' +
                       '  EXECUTE IMMEDIATE 'SELECT N INTO ? FROM Tbl1 WHERE Id = ?' USING N1, ID1 ;
                       '  EXECUTE IMMEDIATE 'SELECT N INTO ? FROM Tbl1 WHERE Id = ?' USING N2, ID2 ;
                       '  SET X = N1 + N2 ; ' +
                       'END' ;

EDBScript1.ExecScript ;

Please take a look at this section of the manual for further details:
http://www.elevatesoft.com/manual?action=viewtopic&id=edb2&product=rsdelphiwin32&version=XE2&topic=Executing_Scripts


--
Fernando Dias
[Team Elevate]
Image