2007 Feb 27 7:27 AM
Hi..
I have added a new field FIELD_1 (domain CHAR10) to a already existing Z table, recreated the "Table Maintenance Generator" and transported the table to Test server. Test data exists on test server with some records having FIELD_1 populated and others having FIELD_1 blank.
The following query when executed on test server fetches no records though many records satisfying the WHERE condition exists.
SELECT *
FROM ZDODATA
INTO IT_ZDODATA
WHERE FIELD_1 EQ SPACE.
Also, it should be noted that the below query fetches proper records as expected.
SELECT *
FROM ZDODATA
INTO IT_ZDODATA
WHERE FIELD_1 NE SPACE.
Why does the first query fail to fetch records?
Regards,
Anoop
2007 Feb 27 11:57 AM
Hi,
Instead of using SPACE( predefined data object ), use IS NULL in
WHERE addition.So that, you can get the required records.
The logical expression sql_cond is either " true, false, or unknown". The expression is unknown if one of the columns involved in the database contains a null value and is evaluated with another comparison as IS NULL. A line is only included in the resulting set if the logical expression is true.
In the first query you posted, Your are comparing NULL with SPACE.
Here the Logical expression result is UNKNOWN.
When you insert a new field to the already existing table.NULL values
are automatically inserted by the system.NULL and SPACE are not one and the same.
I think the above desc. make you understand crystal clear.
Hope that you have got the solution, now.
Regards,
M.Sandhya.
Hi..
I have added a new field FIELD_1 (domain CHAR10) to a already existing Z table, recreated the "Table Maintenance Generator" and transported the table to Test server. Test data exists on test server with some records having FIELD_1 populated and others having FIELD_1 blank.
The following query when executed on test server fetches no records though many records satisfying the WHERE condition exists.
SELECT *
FROM ZDODATA
INTO IT_ZDODATA
WHERE FIELD_1 EQ SPACE.
Also, it should be noted that the below query fetches proper records as expected.
SELECT *
FROM ZDODATA
INTO IT_ZDODATA
WHERE FIELD_1 NE SPACE.
Why does the first query fail to fetch records?
Regards,
Anoop
2007 Feb 27 8:07 AM
there should not be a problem at all.
Please check whether the table really conaines data for the wher condition.
If so, send me you complete code and table structure.
to my email id [email protected]
Regards,
Kavitha
2007 Feb 27 8:33 AM
Hi,
select query is wrong
DATA: IT_ZDODATA TYPE STANDARD TABLE OF zdodata with header line.
SELECT *
FROM ZDODATA
INTO<b>TABLE</b>
IT_ZDODATA
WHERE FIELD_1 EQ '0000000000'.See teh table entries how teh values look like when it is balnk adn pass taht value I have passes 10 zeros considering field length as 10.
This will work now.
Reward if u find helpful.
2007 Feb 27 8:45 AM
hi Anup,
Check with your select query .. table statement is missing and i advice to follow this path
goto Utilities-> database utility an press button activate and adjust database ...
SELECT *
FROM ZDODATA
INTO TABLE IT_ZDODATA
WHERE FIELD_1 EQ SPACE.
Regards,
Santoosh
2007 Feb 27 11:57 AM
Hi,
Instead of using SPACE( predefined data object ), use IS NULL in
WHERE addition.So that, you can get the required records.
The logical expression sql_cond is either " true, false, or unknown". The expression is unknown if one of the columns involved in the database contains a null value and is evaluated with another comparison as IS NULL. A line is only included in the resulting set if the logical expression is true.
In the first query you posted, Your are comparing NULL with SPACE.
Here the Logical expression result is UNKNOWN.
When you insert a new field to the already existing table.NULL values
are automatically inserted by the system.NULL and SPACE are not one and the same.
I think the above desc. make you understand crystal clear.
Hope that you have got the solution, now.
Regards,
M.Sandhya.
2007 Feb 27 12:22 PM
Hi Sandhya,
That is precisely the solution. Thankyou.
The select statement now gives proper output. However, Data Browser (SE16) selects no records for FIELD_1 = ___________ (Blank Box). Is there any solution for this?
Thanks & Regards,
Anoop
2007 Feb 27 12:30 PM
One solution to this problem could be to fire the following DML statement:
UPDATE ZDODATA SET FIELD_1 = ' ' WHERE FIELD_1 IS NULL.
However, does this mean that everytime you add a column(s) to an already existing Z table, you have to fire UPDATE statement to ensure proper selection of data through Data Beowser (SE16)?
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |