Subject Re: how to form a stored prodecure
Author Adam
--- In firebird-support@yahoogroups.com, "naciye_uzun"
<naciye_uzun@y...> wrote:
>
> hi, Im very new about databases and firebird. Im using IBexpert and I
> want to write a stored prodecure by using it. but I cant do. is it
> possible? please help me (I will be pleased if there is a example)
> thank you very much..
>

The language used to define stored procedures and triggers is called
PSQL. Search for IB6 LangRef.pdf. Although for interbase 6, it is 99%
accurate for Firebird and enough to get started.

There are two types of stored procedures, executable and selectable.
An executable stored procedure can return either nothing or a single
set of values. Selectable stored procedures are able to return many
records (a bit like a table).

The syntax for calling is like:

EXECUTE PROCEDURE MYPROC(1,2,3)

OR

SELECT * FROM MYPROC(1,2,3)

Stored procedures use ; internally, so the main trick is to use SET
TERM to change the termination character. (This works in iSQL, dont
know about IBExpert).

For example, here is a soundex implementation using a selectable
stored procedure.

http://www.fbtalk.net/viewtopic.php?id=182

Stored procedures are atomic. Either the entire procedure completes,
or the procedure code is undone. This allows you to use exceptions (or
catch them or ignore them).

Adam