Subject Re: [firebird-support] Re: Calling procedure from trigger
Author Martijn Tonies
Hi Michael,


> Yes it actually gave my a little problem.
>
> I have made a small stored procedure like this (called test):
>
> begin
> ii = 0;
> while (ii < strlen(in_p)) do
> begin
> if (substr(In_P,ii,ii)='ø') then
> begin
> out_p = 'Ø';
> end
> else
> begin
> out_p = substr(In_P,ii,ii);
> end
> ii = ii + 1;
> end
> suspend;
> end
>
> Where II is a variable as integer
> in_p is varchar(30)
> out_p is varchar(30)
> This procedure get generated OK.
>
> when I define a trigger like this:
>
> if (new.varenavn1 <> old.varenavn1) then
> begin
> new.uniktvarenavn1 = test(new.varenavn1);
> end;
>
> it tells me, that test is an unknown FUNCTION.

A procedure is a procedure and should be treated as such.

This procedures has one output parameter that you're
not using. Use:

execute procedure TEST (new.varenavn1) RETURNING_VALUES new.uniktvarenavn1;

> Besides that I would like to be able to do this in SQL:
>
> Update MyTable set
> MyVarChar = MyVarChar + SomeCharValue
>
> But thats not posible or is it ?

Sure it is - but you should use Concatenate - the double pipe symbol:

MyVarChar = MyVarChar || SomeCharValue;


With regards,

Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com