Search code examples
firebirdfirebird2.5

How to use non-ASCII-chars in procedure definitions in Firebird 2.5 / error "Malformed string"


I try to create a procedure that contains non-ASCII-chars in Firebird 2.5.9 but I always get the following error:

Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-STORE RDB$PROCEDURES failed
-Malformed string

Here is, what I am trying to do:

isql -user admin -password masterkey

create database "chartest.fdb" default character set win1252

SET NAMES WIN1252;

SET TERM ^ ;
CREATE PROCEDURE PROC_VAL_TO_TEXT (AVAL INTEGER )
RETURNS (RESULT VARCHAR(20) ) AS
begin
  if (aval = 0) then
    result = 'natürlich';
  else
    result = 'niemals';
  suspend;
end^
SET TERM ; ^

In Firebird 2.0 this is working fine. Why doesn't this work in 2.5 and what can I do to avoid the error?


Solution

  • "SET NAMES" command must be used before "CREATE DATABASE" or "CONNECT" commands to have effect. Also character set in it must exactly match real encoding of the script.