Skip Headers

Oracle® OLAP DML Reference
10g Release 1 (10.1)

Part Number B10339-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

CHANGEBYTES

The CHANGEBYTES function changes one or more occurrences of a specified string in a text expression to another string.

Return Value

TEXT

Syntax

CHANGEBYTES(text-expression oldtext newtext [number])

Arguments

text-expression

The expression in which bytes are to be changed. When text-expression is a multiline TEXT value, CHANGEBYTES preserves the line breaks in the returned value.

oldtext

A text expression that contains one or more bytes that will be changed.

newtext

A text expression that contains one or more bytes that will replace oldtext.

number

An INTEGER that represents the number of times oldtext should be replaced with newtext when oldtext appears more than once in text-expression. The default is to change all occurrences of oldtext.

Notes


Single-Byte Characters

When you are using a single-byte character set, you can use CHANGECHARS instead of CHANGEBYTES.


NTEXT Data Type

This function does not accept NTEXT arguments, because it is oriented toward byte-manipulation instead of character manipulation. It always returns values of type TEXT. When you must use this function on NTEXT values, use the CONVERT or TO_CHAR function to convert the NTEXT value to TEXT.


Replacing Bytes in a Text Value

You can use REPLBYTES to replace bytes in a text value beginning at a certain byte.

Examples

Example 8-42 Changing Text Values Using Bytes

This example shows how to change one instance of a portion of a text value.

The statement

SHOW CHANGEBYTES('Hello there, Joe\nHello there, Jane', 
   'there', - 'to you', 1)

produces the following output.

Hello to you, Joe
Hello there, Jane