473,395 Members | 1,622 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,395 software developers and data experts.

Sqlstate 22007 Sqlcode -181

1
I am trying to construct an SQL statment and pass it to an i5. However I keep getting the above error message. At its simplest I am trying to convert an 8 0 numeric field in the format 20070817 to a date so that I can subtract a number of days. The statement consists of:

Cast((SUBSTR(CHAR(OHDATE),7,2)||'/'|| SUBSTR(CHAR(OHDATE),5,2) ||'/'|| SUBSTR(CHAR(OHDATE),3,2)) As date)

I have also tried:

Date(SUBSTR(CHAR(OHDATE),7,2)||'/'|| SUBSTR(CHAR(OHDATE),5,2) ||'/'|| SUBSTR(CHAR(OHDATE),3,2))

Both these conversions work fine when I paste them into Interactive SQL (strsql) on the i5 i.e

Cast(SUBSTR(CHAR(OHDATE),7,2)||'/'|| SUBSTR(CHAR(OHDATE),5,2)
||'/'|| SUBSTr(CHAR(OHDATE),3,2) As Date ) from orhead
SELECT statement run complete.

CAST function
30/06/07
30/06/07
30/06/07
30/06/07
30/06/07
30/06/07

Has anyone any ideas?

Thanks
Aug 17 '07 #1
1 7756
kestrel
1,071 Expert 1GB
Welcome to The Scripts!
Im going to move this to the SQL forum. Have a nice day!

--
Kestrel
Aug 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jean-Marc Blaise | last post by:
Dear all, Could you explain why some SQL messages do not possess a SQLSTATE ? Why not transmitting the SQLSTATE of the original <sqlcode>, for example if you get a -911 on a RUNSTATS ? ...
0
by: SKC | last post by:
What I did before problem occured? Ans : When I REVOKE teh EXECUTE from a STORED PROCS called (SP1). and then re GRANTED the EXECUTE permission to SP1. SP1 is a SQL procedure on version 8 UDB....
4
by: Bob Stearns | last post by:
Given the DDL: CREATE TABLE JOHNTEST.TASK_LIST ( TASK BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1, CACHE 20) NOT NULL, PRI CHAR(1) NOT NULL, SUBP...
1
by: xf wang via DBMonster.com | last post by:
when i call db2 store producedure,db2 throws exception whose sqlstate is identical t0 38503.I find information as follows: DB2 does check for certain types of limited actions that erroneously...
1
by: tmugavero | last post by:
Hello, This is my first time starting a topic here so I hope this is the right place. I am having problems running SQL queries on a Version 8 DB2 database for Windows Server using the type 4...
2
by: Richard | last post by:
Our web programmer was looking in his application log an found the following error: 2006-08-31 16:33:35,129 ERROR org.hibernate.util.JDBCExceptionReporter - < SQL0723N An error occurred in a...
5
by: misterutterbag | last post by:
Stack trace below. Only happens in WebSphere 6.0. DB2 v 8.2. FP12. Only against 1 database. I have other databases in this database instance, but they don't seem to have this problem. ...
0
by: Dagmar Zahorska | last post by:
Hi, Could you pls. advice me how to get rid of this error? I query a table with date formats 'yyyy-mm-dd' originally. In detail view of the table in query section I see the date format is...
3
by: Gene McCusker | last post by:
I am getting an SQLCODE = -4700, SQLSTATE = 56038 on Below SQL returned - SQLCODE = -4700, SQLSTATE = 56038 We are on version 8 of DB2 but not in NFM yet UPDATE CORETSTA.DDA C ...
2
by: APP1MVF | last post by:
Question: I come from a COBOL/DB2 environment so I am use to being able to display the current SQLSTATE or SQLCODE following the issuing of a DB2 command, now I have move over to a LINUX/DB2 shell...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.