Page 1 of 1

ibcscript and create procedure

Posted: Tue 16 Feb 2010 12:43
by calou
Hello,

I want to create a stored procedure with ibcscript
I enter this in the sql editor

Code: Select all

SET TERM ^^ ;
CREATE PROCEDURE P_COMPARE_TACHES
AS
/*
  You can change this template in the template editor:
  File | Preferences | Object Templates

  Procedure:

  Author   : , 
  Date     : 16/02/2010 12:43:16
  Purpose  :
  Version  :
  Modifications :
  Params
  ------
    : 
*/
declare variable ident integer;
declare variable nb integer;
declare variable nom char(30);
declare variable type_tache char(30);
declare variable societe char(30);

begin
  for select ID,NOM,TYPE_TACHE,SOCIETE from TACHE_CLIENT into :ident,:nom,:type_tache,:societe do
  begin
      select count(id) from TACHE where NOM=:nom and TYPE_TACHE=:type_tache and SOCIETE=:societe into :nb;
      if (nb=0) then
         delete from TACHE_CLIENT where ID=:ident;         
       
  end
end ^^
SET TERM ; ^^
But it doesn't work.

What should be the correct syntax?

Thanks for help

Regards

Posted: Tue 16 Feb 2010 13:20
by calou
I delete SET TERM and now it is ok

Now i want to do a grant on the procedure

Code: Select all

CREATE PROCEDURE P_COMPARE_TACHES
AS

declare variable ident integer;
declare variable nb integer;
declare variable nom char(30);
declare variable type_tache char(30);
declare variable societe char(30);

begin
  for select ID,NOM,TYPE_TACHE,SOCIETE from TACHE_CLIENT into :ident,:nom,:type_tache,:societe do
  begin
      select count(id) from TACHE where NOM=:nom and TYPE_TACHE=:type_tache and SOCIETE=:societe into :nb;
      if (nb=0) then
         delete from TACHE_CLIENT where ID=:ident;         
       
  end
end;

GRANT ALL ON P_COMPARE_TACHES TO ADMINISTRATIF
i have the error :

Dynamic SQL Error
SQL error code = -104
Token unknown - line 20, column 1
GRANT

Thanks for help

Posted: Tue 16 Feb 2010 16:13
by calou
I solved the problem by using /

Regards

Posted: Wed 17 Feb 2010 08:39
by Dimon
It is good to see that this problem has been solved.

Posted: Wed 17 Feb 2010 13:56
by tsteinmaurer
Perhaps using SET TERM is related to the other threads posted some days ago? In InterBase/Firebird speech, SET TERM is a legal construct to redefine the terminator symbol when creating stored procedures and triggers.

The slash symbol / is a Oracle thingy though.

Thought worth mentioning, as this is the IBDAC forum for InterBase and Firebird. :D

Posted: Wed 24 Feb 2010 10:02
by Dimon
We have fixed the problem fith SET TERM. The fix will be included in the next build of IBDAC.

Posted: Wed 24 Feb 2010 10:46
by calou
Thanks for the feedback

Regards