Subject Re: [firebird-support] function in stored procedure
Author Helen Borrie
At 12:42 PM 13/08/2003 +0700, you wrote:
>I want to know how to get
>1. row count in select process

select count(*) from ...
(not recommended unless it's restricted or aggregated)

>2. row affected in insert/update/delete process

Depends on version. The context variable ROW_COUNT is available in
Firebird 1.5. Otherwise, keep your own counter and do your DML in a loop.

>3. null value

There is no such thing as "null value". A data item either has a value or
it is null. Null is a state, not a value.

>4. if error occur (primary key /foregn key)
>in stored procedure, so i can send it to return parameter with my
>error message

If a SP fails, it won't return any parameters, but an error status array
instead. So use exceptions to trap error conditions.

If you actually handle error conditions inside the SP and "swallow" them
somehow, you could maintain some useful values in output variables
(parameters), e.g. count of successful and unsuccessful operations.

In 1.5, you can use the EXCEPTION feature to pass a run-time string back to
the client in the error status array.