473,788 Members | 3,078 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TRANSLATE function

Hi,
Does anybody know why i get this error:
SQL0176N The second, third or fourth argument of the TRANSLATE scalar
function is incorrect. SQLSTATE=42815

with this query:
SELECT TRANSLATE(p.men o,
'aaaaccdeeeiill nnoooorrsstuuuu yzzAAAACCDEEEII LLNNOOOORRSSTUU UUYZZ',
'áâãäæèïéìëíîåµ ñòóôöõàø¶¹»úüûù ý¼¾ÁÂÃÄÆÈÏÉÌËÍΠťÑÒÓÔÖÕÀئ©«ÚÜ ÛÙݬ®')
FROM oa.pracovnik p;

---
CREATE TABLE oa.pracovnik (
...
meno CHARACTER(20),
...
);

Thanks in advance.

Adam Kovari
Jul 1 '08 #1
4 10659
What platform and DB2 Version/Release are you using?

Here is a result on DB2 for Windows V9.1.
connect to SAMPLE user db2admin using ********;
----------------------------------------------------------
Database Connection Information

Database server = DB2/NT 9.1.2
SQL authorization ID = DB2ADMIN
Local database alias = SAMPLE

A JDBC connection to the target has succeeded.
-------------------- Commands Entered --------------------
CREATE TABLE oa.pracovnik (
meno CHARACTER(20)
);
----------------------------------------------------------
DB20000I The SQL command completed successfully.

-------------------- Commands Entered --------------------
SELECT TRANSLATE(p.men o,
'aaaaccdeeeiill nnoooorrsstuuuu yzzAAAACCDEEEII LLNNOOOORRSSTUU UUYZZ',
'áâãäæèïéìëíîåµ ñòóôöõàø¶¹»úüûù ý¼¾ÁÂÃÄÆÈÏÉÌËÍΠťÑÒÓÔÖÕÀئ©«ÚÜ ÛÙݬ®')
FROM oa.pracovnik p;
----------------------------------------------------------

1
--------------------

0 record(s) selected.
Jul 1 '08 #2
On Jul 1, 9:42 pm, "kovaria...@gma il.com" <kovaria...@gma il.com>
wrote:
Hi,
Does anybody know why i get this error:
SQL0176N The second, third or fourth argument of the TRANSLATE scalar
function is incorrect. SQLSTATE=42815

with this query:
SELECT TRANSLATE(p.men o,
'aaaaccdeeeiill nnoooorrsstuuuu yzzAAAACCDEEEII LLNNOOOORRSSTUU UUYZZ',
'áâãäæèïéìëíîåµ ñòóôöõàø¶¹»úüûù ý¼¾ÁÂÃÄÆÈÏÉÌËÍΠťÑÒÓÔÖÕÀئ©«ÚÜ ÛÙݬ®')
FROM oa.pracovnik p;

---
CREATE TABLE oa.pracovnik (
...
meno CHARACTER(20),
...
);
I don't know the answer and I don't have the time to figure it out
right now, but you can use db2 to get more info about the error:

[lelle@53dbd181 ~]$ db2 "? SQL0176N"

SQL0176N The second, third or fourth argument of the TRANSLATE scalar
function is incorrect.

Explanation:

The statement is not correct for one or more of the following
reasons:
* The translate scalar function does not allow replacement of a
character by another character which is encoded using a different
number of bytes. For example, a single-byte character cannot be
replaced with a double-byte character nor can a double-byte
character
be replaced with a single-byte character.
* The second and third arguments of the translate scalar function
must
end with correctly formed characters.
* The fourth argument of the translate scalar function must be a
correctly formed single-byte character if the first argument is
CHAR
or VARCHAR.
* The fourth argument of the translate scalar function must be a
correctly formed double-byte character if the first argument is
GRAPHIC or VARGRAPHIC.

The statement cannot be processed.

User response:

Ensure that the second, third, and fourth arguments of the translate
scalar function have correct values.

/Lennart
Jul 1 '08 #3
Thank you for your effort.
I'm using DB2 Express-C 9.5 on Windows XP 32.
I' ve found, just a minut ago, that it works on databases with
codepage 1250, but not with utf-8, therefore i have converted my
database.

Thank you very much!

On 1. Júl, 22:13 h., Tonkuma <tonk...@fiberb it.netwrote:
What platform and DB2 Version/Release are you using?

Here is a result on DB2 for Windows V9.1.
connect to SAMPLE user db2admin using ********;
----------------------------------------------------------
* *Database Connection Information

*Database server * * * *= DB2/NT 9.1.2
*SQL authorization ID * = DB2ADMIN
*Local database alias * = SAMPLE

A JDBC connection to the target has succeeded.
-------------------- Commands Entered --------------------
CREATE TABLE oa.pracovnik (
* * * * meno * * * * * *CHARACTER(20)
);
----------------------------------------------------------
DB20000I *The SQL command completed successfully.

-------------------- Commands Entered --------------------
SELECT TRANSLATE(p.men o,
'aaaaccdeeeiill nnoooorrsstuuuu yzzAAAACCDEEEII LLNNOOOORRSSTUU UUYZZ',
'áâãäæèïéìëíîåµ ñòóôöõàø¶¹»úüûù ý¼¾ÁÂÃÄÆÈÏÉÌËÍΠťÑÒÓÔÖÕÀئ©«ÚÜ ÛÙݬ®')
FROM oa.pracovnik p;
----------------------------------------------------------

1
--------------------

* 0 record(s) selected.
Jul 1 '08 #4
Thanks, already solved.

On 1. Júl, 22:20 h., Lennart <Erik.Lennart.J ons...@gmail.co mwrote:
On Jul 1, 9:42 pm, "kovaria...@gma il.com" <kovaria...@gma il.com>
wrote:


Hi,
Does anybody know why i get this error:
SQL0176N *The second, third or fourth argument of the TRANSLATE scalar
function is incorrect. *SQLSTATE=42815
with this query:
SELECT TRANSLATE(p.men o,
'aaaaccdeeeiill nnoooorrsstuuuu yzzAAAACCDEEEII LLNNOOOORRSSTUU UUYZZ',
'áâãäæèïéìëíîåµ ñòóôöõàø¶¹»úüûù ý¼¾ÁÂÃÄÆÈÏÉÌËÍΠťÑÒÓÔÖÕÀئ©«ÚÜ ÛÙݬ®')
FROM oa.pracovnik p;
---
CREATE TABLE oa.pracovnik (
* *...
* * * * meno * * * * * *CHARACTER(20),
* *...
);

I don't know the answer and I don't have the time to figure it out
right now, but you can use db2 to get more info about the error:

[lelle@53dbd181 ~]$ db2 "? SQL0176N"

SQL0176N *The second, third or fourth argument of the TRANSLATE scalar
* * * function is incorrect.

Explanation:

The statement is not correct for one or more of the following
reasons:
* *The translate scalar function does not allow replacement of a
* *character by another character which is encoded using a different
* *number of bytes. For example, a single-byte character cannot be
* *replaced with a double-byte character nor can a double-byte
character
* *be replaced with a single-byte character.
* *The second and third arguments of the translate scalar function
must
* *end with correctly formed characters.
* *The fourth argument of the translate scalar function must be a
* *correctly formed single-byte character if the first argument is
CHAR
* *or VARCHAR.
* *The fourth argument of the translate scalar function must be a
* *correctly formed double-byte character if the first argument is
* *GRAPHIC or VARGRAPHIC.

The statement cannot be processed.

User response:

Ensure that the second, third, and fourth arguments of the translate
scalar function have correct values.

/Lennart
Jul 1 '08 #5

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

Similar topics

1
11167
by: Joe | last post by:
Hi all Is there a TSQL function like Oracle's Translate function? Where: Translate('13,000 Miles','abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ, ',' ') would return '13000'? I'm trying to extract a number from a string. REPLACE doesn't quite do what I want.
1
8065
by: David Furey | last post by:
Hi I have an XML documnet and a XSLT document as shown below THe XSLT document brings back a filtered docmument that has the VendorName that starts with a particular sub-string This works as expected with alphabet and number characters and the ' (single quote &apos; entity) character but does not work if a double quote character " is part of the string to filter on This returns all Vendor Names that begin with A (either case)
1
2533
by: kennethfine | last post by:
I'm transitioning from ASP development, please excuse these basic questions. One thing I did often in ASP was create a "translate" function to render one string to another, strip out excess carriage returns, etc. I want to do the same thing in ASP.NET. I have a mail component that will accept HTML, but it requires all HTML to be listed on a single line. It takes the syntax: msgObj.BodyParts.Add(" <html markup here> "),
6
2783
by: bobueland | last post by:
The module string has a function called translate. I tried to find the source code for that function. In: C:\Python24\Lib there is one file called string.py I open it and it says
3
12396
by: Mehmet Baserdem | last post by:
Hi all, I am trying to remove all blank chars in middle of the string "text1 text2 text3 text3 text4" with following stmt: VALUES(translate('text1 text2 text3 text3 text4' , '' ,' ' ))
4
1782
by: Jo | last post by:
Which scalar function would be suitable for me to extract the date out of the following string: "060618154449" Thanks a lot for any advice.
1
2561
by: =?Utf-8?B?R2F1cmF2?= | last post by:
Hi, I am using the Translate() function in one of the .XSLT file to remove the spaces, like this: <xsl:for-each select=".//Illustration"> <xsl:value-of select="translate(./@illusName, ' ', '')"/> …. This works fine with command line msxsl and XML editors like XMLSpy. However, if you use .NET's
3
649
by: muybluie | last post by:
Hello All, I am trying something so simple, I have no idea why it doesn't work! create table test1 (c1 VARCHAR(16)); insert into test1 values( '12154846' ); select translate(c1, '5', 'A') from test1; You'd think I would get a modified version of the string in column c1, but nothing happens. The select statement returns the string
4
2515
by: Terry Reedy | last post by:
Cédric Lucantis wrote: 'ae' I do not claim this to be better than all the other methods, but this pair can also translate while deleting, which others cannot.
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.