[firebase-br] Erro ao chamar Stored Procedure

Jeter Rabelo Ferreira jeter.rabelo em gmail.com
Ter Maio 23 15:00:03 -03 2006


Boa tarde,
Estou modificando uma rotina de cálculo do meu sistema para Stored
Procedure.
Eu precisava de uma função de Length() para umas das condições.
Pequei um exemplo na lista de discussão de uma função deste tipo, segue
abaixo:

CREATE PROCEDURE STRLEN (
    TEXTO VARCHAR(1000))
RETURNS (
    TAM INTEGER)
AS
DECLARE VARIABLE BUF VARCHAR(1000);
BEGIN
  TAM = 0;
  BUF = '';
  WHILE (NOT TEXTO LIKE BUF) DO
  BEGIN
    TAM = TAM + 1;
    BUF = BUF || '_';
  END
END

O Firebird cria a função corretamente, mas, na hora de chamá-la, acontece o
seguinte erro:

An error was found in the application program input parameters for the SQL
statement.
Dynamic SQL Error.
SQL error code = -804.
Function unknown.
STRLEN.

A Rotina que eu utilizo para chamar esta procedure é a seguinte:
if (id_conta_res <> '') then
begin
  EXECUTE STATEMENT strlen(ID_CONTA_RES) INTO :I_QTDE;
  if (I_QTDE = 7) then
  begin
    X_WHERE2 = X_WHERE2 || 'cx.ID_CONTA_RES=' || :id_conta_res;
    if (id_cta_indiv <> '') then
      X_WHERE2 = X_WHERE2 || 'and cx.ID_CTA_INDIV=' || :id_cta_indiv;
    end
  else
  begin
    X_WHERE2 = X_WHERE2 || 'cx.ID_CONTA LIKE ' || :id_conta_res;
    X_WHERE2 = X_WHERE2 || '%';
  end
end


Alguem poderia me ajudar?

Delphi + DBExpress + Firebird 1.5.3.4870

[]'s
Jéter Rabelo



Mais detalhes sobre a lista de discussão lista