Hello Thomas,
I'm using Varchar BYTE column to store array of bytes.
Inside my trigger I code some Integer columns into my array of bytes.
So, when my Int column has value 0 I need to code it as x'00' in my array.
Can you suggest some way how to obtain it.
Thank you for everything.

Regards, Dusan

On Wed, 14 Apr 2004 14:50:45 +0200, Anhaus, Thomas <[EMAIL PROTECTED]> wrote:

Hi Dusan
neither you are doing something wrong nor this is a bug. It's just the behavior of
MaxDB concerning truncation of column values depending on datatypes.
In case of [VAR]CHAR and UNICODE the blank is truncted, in all other cases
x'00' is truncated. This means that before any function is applied to a column value,
this value will be truncated.
In your case the variables byteDistLo and byteDistHi are truncated before the
concat function is applied. This explains the result of your db-procedure.
The reason for this behavior is the fact that MaxDB supports columns
of fixed length, where the real length provided by the application is not stored in
the database. If you store the values x'010100' and 'x'0101' into a table and
compare them via a search condition, the values are equal.


Best Regards,
Thomas

-----Original Message-----
From: Dusan Kolesar [mailto:[EMAIL PROTECTED]
Sent: Mittwoch, 14. April 2004 10:31
To: SAP DB mailing list
Subject: Varchar BYTE concatenation problem


Hello,


I have a problem with Varchar BYTE concatenation.

CREATE TABLE "ADMIN"."TEST"
(
   "VC" Varchar (50) BYTE
)
//
CREATE DBPROC TESTVC AS
   VAR
     msg        Varchar(100) BYTE;
     byteDistLo Varchar(1) BYTE;
     byteDistHi Varchar(1) BYTE;
BEGIN
   SET byteDistLo  = x'00';
   SET byteDistHi  = x'00';

   SET msg = x'91' || x'00' || byteDistLo  || byteDistHi  || x'ff';
   INSERT ADMIN.TEST (VC) VALUES (:msg);
END;
//
CALL TESTVC

I expect '91000000ff' in the TEST table, but I get '9100ff'
Is it bug, or am I doing something wrong ??

Regards, Dusan

-- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to