View previous topic :: View next topic |
Author |
Message |
vkarun1977 Beginner
Joined: 11 Jun 2004 Posts: 2 Topics: 1
|
Posted: Fri Jun 11, 2004 10:04 am Post subject: Wild card search in a dynamic sql |
|
|
Hi folks,
I develped the dynamic sql with wild cards in a cobol program but it does not fetch any rows.
I want to know ,Is it possible to develop a dynamic sql with wild card in a COBOL program. if so what steps i should take .
Let me knwo our ideas
example
select empno,empname from emp where name like 'jo%'
thanks |
|
Back to top |
|
|
Bithead Advanced
Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
Posted: Fri Jun 11, 2004 10:13 am Post subject: |
|
|
If you are searching for JO% using a COBOL field greater than 4 bytes, DB2 will include any spaces in the field, so when you think you are searching for 'JO%', you are really seaching for 'JO% '. Either truncate the spaces using STRING ... DELIMITED BY SPACES or pad the field with % ('JO%%%%%%%'). |
|
Back to top |
|
|
vkarun1977 Beginner
Joined: 11 Jun 2004 Posts: 2 Topics: 1
|
Posted: Tue Jun 15, 2004 11:16 am Post subject: |
|
|
hi bithead...thanks for the reply..it worked to perfection. thanks a lot. |
|
Back to top |
|
|
|
|