Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Inserting Field in Table

Former Member
0 Likes
794

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
762

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,

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.

6 REPLIES 6
Read only

Former Member
0 Likes
762

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

Read only

Former Member
0 Likes
762

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.

Read only

Former Member
0 Likes
762

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

Read only

Former Member
0 Likes
763

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.

Read only

0 Likes
762

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

Read only

0 Likes
762

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)?