473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

different chr(0) handling in v7.2 and v8?

hallo!

given the following table

create table s2 (a_key integer, a_varchar varchar(200))

for testing i have some scripts which makes inserts of chr(0) values like

insert into s2 (a_key, a_varchar) values (1, 'bla'||chr(0)||'bla2')

when i do this on a v7.2 database and i select it with a cli
application, then i get the 0 byte on the correct position. by the way a
select from the command line (db2cmd: db2 select * from s2) returns only
'bla' as value of the a_varchar column.

when i do this on v8 database, the cli application gets a 0x20 byte
value on the position of the 0 byte that means it gets a blank on the
position of the 0 byte. in this case the command line also returns the
wrong string with the blank instead of the 0 byte.

how can i get the old behavior?

thanks
andreas lederer

Nov 12 '05 #1
2 4728
alederer wrote:
hallo!

given the following table

create table s2 (a_key integer, a_varchar varchar(200))

for testing i have some scripts which makes inserts of chr(0) values like

insert into s2 (a_key, a_varchar) values (1, 'bla'||chr(0)||'bla2')

when i do this on a v7.2 database and i select it with a cli
application, then i get the 0 byte on the correct position. by the way a
select from the command line (db2cmd: db2 select * from s2) returns only
'bla' as value of the a_varchar column.

when i do this on v8 database, the cli application gets a 0x20 byte
value on the position of the 0 byte that means it gets a blank on the
position of the 0 byte. in this case the command line also returns the
wrong string with the blank instead of the 0 byte.

how can i get the old behavior?

thanks
andreas lederer


From the Db2 documentation (Version 8 incompatibilities with previous
releases):

|Change

|CHR(0) returns a blank (X'20') instead of the character with code
|point X'00'.

|Symptom

|Output from the CHR function with X'00' as the argument returns
|different results.

|Explanation

|String handling when invoking and returning from user-defined functions
|interprets X'00' as end of string.
|Resolution
|Change the application code to handle the new output value.
|Alternatively, define a user-defined function that returns CHAR(1) FOR
|BIT |DATA which is sourced on the SYSFUN CHR function, and place this
|function |before SYSFUN on the SQL path.

Jan M. Nelken
Nov 12 '05 #2
Documented change

http://publib.boulder.ibm.com/infoce...help/index.jsp

Version 8 incompatibilities with previous releases
Output from CHR function

Output from CHR function
| Windows UNIX

|Change
|CHR(0) returns a blank (X'20') instead of the character with code |point
X'00'.

|Symptom
|Output from the CHR function with X'00' as the argument returns |different
results.

|Explanation
|String handling when invoking and returning from user-defined functions
|interprets X'00' as end of string.

|Resolution
|Change the application code to handle the new output value. |Alternatively,
define a user-defined function that returns CHAR(1) FOR BIT |DATA which is
sourced on the SYSFUN CHR function, and place this function |before SYSFUN
on the SQL path.

PM


"alederer" <al******@gmx.at> a écrit dans le message de
news:40********@e-post.inode.at...
hallo!

given the following table

create table s2 (a_key integer, a_varchar varchar(200))

for testing i have some scripts which makes inserts of chr(0) values like

insert into s2 (a_key, a_varchar) values (1, 'bla'||chr(0)||'bla2')

when i do this on a v7.2 database and i select it with a cli
application, then i get the 0 byte on the correct position. by the way a
select from the command line (db2cmd: db2 select * from s2) returns only
'bla' as value of the a_varchar column.

when i do this on v8 database, the cli application gets a 0x20 byte
value on the position of the 0 byte that means it gets a blank on the
position of the 0 byte. in this case the command line also returns the
wrong string with the blank instead of the 0 byte.

how can i get the old behavior?

thanks
andreas lederer

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bill Davy | last post by:
To make life easier for my users, I'd like to colour my prompt string (as handed to raw_input()) a different colour to that produced by print. I'm using Python 2.4.1 and IDLE 1.1.1 on Windows XP. ...
0
by: BillLi | last post by:
Hi, I have the following piece of ASP code ====================================================== csiPCKTD=chr(169) csiPCKTS=chr(174) ' Set XArray with Data object csiSDataTrsfr="G" &...
2
by: Dave | last post by:
I'm getting different results when I display a value in the Output window as opposed to the Immediate window. Why? Code to recreate problem: 'Purpose: Get different results from Output...
6
by: C L Humphreys | last post by:
Hi, I'm trying to concatenate address fields and insert a LF&CR after each line. The SQL I use is based on select address1 & chr(10) & chr(13)& address2 & chr(10) & chr(13)& address3 & ...
2
by: paddy_nyr | last post by:
I converted an Access 97 db to Access 2002 db and I now get the following error message when I try and run a query. Thanks Here's my query. SELECT DISTINCTROW tblCo_Info.Co_id, & Chr(13) &...
1
by: jdph40 | last post by:
I am trying to enter text to look like paragraphs in a text box on a report, making it look like a memo. I enter (Chr$(13) & Chr$(10) & Chr$(10)) to insert a carriage return and 2 line breaks, but...
9
by: me | last post by:
I am working as an intern at a place using Access 2003 code builder. Looking at the cold of the old project t(hat we are redoing), I see Chr(39) Chr(91) Chr(45) Chr(93)
3
by: Benjamin Hell | last post by:
Hi! I have a problem with the cx_Oracle module (Oracle database access): On a computer with cx_Oracle version 4.1 (Python 2.4.3, Oracle 10g) I can get query results consisting of strings...
11
!NoItAll
by: !NoItAll | last post by:
I need to search a buffer for a string of characters. The buffer is essentially a binary file (it's an image) and contains lots of chr(0) characters. The string I need to locate also contains...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.