View previous topic :: View next topic
|
Author |
Message |
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
Hi All,
My requirement is to fetch rows from a table having low vaules for a particular field in the table. I tried the below sample query
Quote: |
select empno
from employee
where remarks = x'00' |
But its not fetching those rows which contains low values in the remarks field.
The datatype of remarks field is char(70).
Please correct me where i am doing a mistake. Thanks |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
In a cobol program:
Code: |
01 WS-REMARKS PIC X(70).
MOVE LOW-VALUES TO WS-REMARKS
SELECT EMPNO
FROM EMPLOYEE
WHERE REMARKS = :WS-REMARKS |
|
|
Back to top |
|
|
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
Thanks Marso.
But i am executing the query using spufi. Is there any way to use low values directly in the query? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
CHAR(x'00',70) would not work. The result is a 70 byte field in which the first byte is x'00' and all remaining bytes are spaces. According to the manual:
If the length of string-expression ( in this case, x'00' ) is less than the length attribute of the result ( in this case, 70 ), the result is padded with blanks to the length of the result.
Instead, try:
Code: |
CHAR(REPEAT(X'00',70)) |
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Ronald Burr wrote: |
Instead, try:
Code: |
CHAR(REPEAT(X'00',70)) |
|
Thanks Ronald, This was helpful. I never tried this before.. |
|
Back to top |
|
|
|