View previous topic :: View next topic
|
Author |
Message |
tarunbhardwajleo
New User
Joined: 23 Feb 2007 Posts: 25 Location: Dallas, TX
|
|
|
|
Hi,
In a SQL query, Iam using the following predicate in the 'WHERE' clause:
Code: |
OR (SUBSTR (GN_TXN_DATA,191,15)
= :D011-IWA-AMT-1)
|
As per the rule, scalar function SUBSTRING always returns the data in character format. The host variable D011-IWA-AMT-1 has been defined as X(15). But when I bind the module, it gives me a SQL CODE -401 which is "THE OPERANDS OF AN ARITHMETIC OR COMPARISON OPERATION ARE NOT COMPARABLE".
Could someone please tell me where am going wrong !!! |
|
Back to top |
|
|
vini_srcna
Active User
Joined: 26 May 2005 Posts: 178 Location: Copenhagen, Denmark
|
|
|
|
I'm not so sure about cobol firstly.
I believe X(15) declaration should be changed to A(15).
I might be wrong since am very bad in COBOL.
Can you paste the entire query and the declaration of :D011-IWA-AMT-1.
Are you sure your bind is failing @ this query..?
Can you paste the bind error message. |
|
Back to top |
|
|
girias
New User
Joined: 09 Feb 2007 Posts: 26 Location: Chennai
|
|
|
|
Hi,
I too got the same error. Can any one help me out.
Let us take the above scenario itself.
I tried giving it as 9(15). But I am getting compilation error saying
Code: |
"SQL host variable had invalid syntax or the referenced host variable was an invalid SQL variable type. The statement was discarded." |
Thanks
Giri |
|
Back to top |
|
|
munikumar Currently Banned New User
Joined: 18 Apr 2007 Posts: 24 Location: India
|
|
|
|
Try this,
OR CHAR((SUBSTR (GN_TXN_DATA,191,15))
= :D011-IWA-AMT-1)
I have not checked this. |
|
Back to top |
|
|
priyamnavada
New User
Joined: 24 Dec 2005 Posts: 52 Location: hyderabad
|
|
|
|
use this---
(SUBSTR (CHAR(GN_TXN_DATA),191,15)
= :D011-IWA-AMT-1) |
|
Back to top |
|
|
|