Subject Re: [IBO] What component?
Author Paul Vinkenoog
Hi Rafael,

> I have to execute this script thougth IBO ... but I donĀ“t know what
> component I have to use ...

TIB_Script. But the procedure needs a little cleaning up too:

Before CREATE PROCEDURE, insert this line:

set term ^;

> create procedure testejosi
> as
> DECLARE varCount integer;

I think this should be DECLARE VARIABLE. But if DECLARE alone is
enough, that's good news for me ;-)

> begin
> SELECT Count(*) FROM Conta WHERE NomeConta = 'gugu' into varcount;
> if (varCount <= 0) then
> INSERT INTO Conta (NomeConta,IsAtiva) VALUES ('gugu', 1);

You can do this better (faster) like this:

if ( not exists ( select * from Conta where NomeConta = 'gugu' ) )
then insert into Conta( NomeConta, IsAtiva ) values ( 'gugu', 1 );

This also means that you can drop the varCount variable.

> suspend;

The SUSPEND should be removed: this procedure doesn't return any
dataset rows, so there's nothing for the caller to fetch.

> end;

Change this to:

end^

After that, insert these two lines:

set term ;^
commit;

> execute procedure TESTEJOSI;
> drop procedure TESTEJOSI;


Greetings,
Paul Vinkenoog