Informix Server 10并在选择中删除CR字符 [英] Informix Server 10 and remove CR character in select

查看:207
本文介绍了Informix Server 10并在选择中删除CR字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Informix Server 10中的选择中删除CR字符.

I need to remove the CR character in a select in Informix Server 10.

功能chr在版本10中不存在,所以当我尝试这样的替换时

The function chr doesn't exist in version 10, so when I try a replace like that

REPLACE(text_column, chr(10), ' ')

我收到这样的错误:

例程(chr)无法解析. [SQL State = IX000,数据库 错误代码= -674]

Routine (chr) can not be resolved. [SQL State=IX000, DB Errorcode=-674]

函数ascii(10)也不起作用.

预先感谢

推荐答案

我没有访问 IDS 10 的权限,但是请问这是否对您有用.

I don't have access to an IDS 10 but see if this works out for you.

请记住,这是LF的示例:

LF- ASCII 代码10,换行;

LF - ASCII Code 10, Line Feed;

CR- ASCII 代码13,回车.

首先请确保您的会话具有

First be sure your session has IFX_ALLOW_NEWLINE set to true:

> EXECUTE PROCEDURE IFX_ALLOW_NEWLINE('T');

Routine executed.

>

现在让我们看一个例子:

Now let's see an example:

> CREATE TABLE tab1 (col1 CHAR(100));

Table created.

> INSERT INTO tab1 VALUES ('teste' || CHR(10) || '1');

1 row(s) inserted.

> SELECT col1 FROM tab1;



col1  teste
      1

1 row(s) retrieved.

> SELECT REPLACE(col1, '
> ', ' ') FROM tab1;



(expression)  teste 1

1 row(s) retrieved.

>

旁注:

  • the CHR function takes a a whole number in the range 0 through 255 and returns the corresponding single-byte ASCII code point.
  • the ASCII function takes a single argument of any character data type and returns the corresponding ASCII decimal code of the first character in the argument.

这篇关于Informix Server 10并在选择中删除CR字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆