Pessoal, estou tentando substituir uma UDF que usava com o firebird 2.1, pois estou migrando para o firebird 2.5.
No firebird 2.5 não conseguí de forma alguma fazer esta UDF funcionar, então estou tentando outras formas mas está difícil e nem sei se o que estou tentando fazer existe. O problema é o seguinte:
Eu criei a seguinte stored procedure no firebird:
SET TERM ^ ;
CREATE OR ALTER PROCEDURE F_CODIFONPT_BR (
i_string varchar(500))
returns (
c_string varchar(500) collate pxw_intl850)
as
begin
C_STRING = :I_STRING;
suspend;
end^
SET TERM ; ^
Pois bem, estou tentando usar da seguinte forma :
select PR0100.C_COD_PRODUTO, PR0100.C_DESC_PRODUTO, PR0100.C_MODELO_PRODUTO, PR0100.C_TIPO_CODIGO_PRODUTO,
PR0100.C_VALOR_UNITARIO_PRODUTO, PR0100.C_QTD_ESTOQUE, PR0100.C_VALOR_CUSTO_PRODUTO,
(PR0100.C_VALOR_UNITARIO_PRODUTO - (PR0100.C_VALOR_UNITARIO_PRODUTO * C_PERC_DESCONTO_A_PRODUTO) / 100) as
C_VALOR_UNITARIO_PRODUTO_A, (PR0100.C_VALOR_UNITARIO_PRODUTO - (PR0100.C_VALOR_UNITARIO_PRODUTO *
C_PERC_DESCONTO_B_PRODUTO) / 100) as C_VALOR_UNITARIO_PRODUTO_B, (PR0100.C_VALOR_UNITARIO_PRODUTO -
(PR0100.C_VALOR_UNITARIO_PRODUTO * C_PERC_DESCONTO_C_PRODUTO) / 100) as C_VALOR_UNITARIO_PRODUTO_C,
PR0100.C_USA_ESTOQUE_PRODUTO, PR0100.C_PERC_LUCRO_PRODUTO, PR0100.C_ATIVO_PRODUTO
from PR0100
where F_CODIFONPT_BR(C_DESC_PRODUTO) LIKE F_CODIFONPT_BR('%' || 'teste' || '%') and
(PR0100.C_USA_ESTOQUE_PRODUTO = 'N' or
(PR0100.C_QTD_ESTOQUE > 0)) and
C_COD_PRODUTO <> '000000000000000'
order by C_DESC_PRODUTO
Porém preciso usar assim, pois irei implementar na procedure F_CODIFONPT_BR as trocas de acentos, porém ao executar o sql dá 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.
F_CODIFONPT_BR.
Como consigo resolver ???