If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SQL0420N Invalid character found in a character string argument of the function INT

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-10, 08:18
aankdavid aankdavid is offline
Registered User
 
Join Date: Apr 2010
Posts: 5
SQL0420N Invalid character found in a character string argument of the function INT

I run query REFRESH TABLE DEV.MQT_AAA_APN_D_H7 on the sql tools such as toad is running well but i get errors when refresh table on db2 console.

This query MQ tables (MQT_AAA_APN_D_H7):
select DAY_ID, PRODUCT_ID, HIT, sum(sendkbytes) as SENDKBYTES, sum(receivekbytes) as RECEIVEKBYTES
from DEV.aaa_apn_d_t
WHERE day_id > cast(replace(char(current_date - 7 days),'-','') as integer) group by DAY_ID,PRODUCT_ID;

is there any suggestion to replace the cast integer?


bash-3.2$ db2 connect to mydb user myuaix using P@ssW0rd

Database Connection Information

Database server = DB2/AIX64 9.5.1
SQL authorization ID = MYUAIX
Local database alias = MYDB

bash-3.2$ db2 "REFRESH TABLE DEV.MQT_AAA_APN_D_H7"
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0420N Invalid character found in a character string argument of the
function "INTEGER". SQLSTATE=22018


thanks for the response...
Reply With Quote
  #2 (permalink)  
Old 04-27-10, 08:30
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,574
Your problem is the following expression: char(current_date - 7 days)

It will be interpreted differently on different environments.

On my system:
Code:
values (char(current_date - 7 days))

1
----------
04/20/2010

You need to standardize it so it will always return the same value: char(current_date - 7 days,ISO)

Code:
values (char(current_date - 7 days,ISO))

1
----------
2010-04-20

  1 record(s) selected.

Andy
Reply With Quote
  #3 (permalink)  
Old 04-27-10, 09:36
tonkuma tonkuma is online now
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,178
DB2 Version 9.5 for Linux, UNIX, and Windows SQL Reference, Volume 1

Chapter 3. Functions

Quote:
INTEGER

...
...

date-expression
An expression that returns a value of the DATE data type. The result is an
INTEGER value representing the date as yyyymmdd.
You can replace
cast(replace(char(current_date - 7 days),'-','') as integer)
with
INTEGER(current_date - 7 days)
Reply With Quote
  #4 (permalink)  
Old 04-28-10, 00:27
aankdavid aankdavid is offline
Registered User
 
Join Date: Apr 2010
Posts: 5
Solved

Thanks you for ARWinner
Reply With Quote
  #5 (permalink)  
Old 04-28-10, 00:29
aankdavid aankdavid is offline
Registered User
 
Join Date: Apr 2010
Posts: 5
yes! yes! ...the problem is SOLVED!!!

Last edited by aankdavid; 04-28-10 at 00:34.
Reply With Quote
Reply

Tags
integer, sql0420n, sqlstate=22018

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On