Application Development 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: 

Delete statement

Former Member
0 Kudos

Hi experts,

How can I delete a record if a key field is initial.

Is it ok?

delete from t_itab

where field1 eq ' '.

I tried this one also:

delete from t_itab

where field1 is initial.

But is says: The operator IS can only be used in "f IS NULL

1 ACCEPTED SOLUTION

former_member230674
Contributor
0 Kudos

Hi mrwhite,

Don't use IS operator with INITIAL.

These are the following alternatives.

DELETE from t_tab where connid is null.

or

DELETE from t_tab where connid = space.

or

DELETE from t_tab where connid = ' '.

by

prasad GVK.

7 REPLIES 7

Former Member
0 Kudos

You can delete for all initial records.

Just check for the condition and say delete.

I guess you are not allowed to write initial in where clause of delete that is why it showed you that error.

Use null and ' ' instead which will work perfectly fine for your requirement.

Regards,

Lalit Mohan Gupta.

Former Member
0 Kudos

Try this Delete i_tab where field1 = ' '.

Former Member
0 Kudos

Hi,

use null, it will work...

Regards,

Pavan

Former Member
0 Kudos

Try this:-

Delete from t_itab where field1 is Null.

I hope, it'll work for ur requirement.

Thanks.

Anurag.

former_member230674
Contributor
0 Kudos

Hi mrwhite,

Don't use IS operator with INITIAL.

These are the following alternatives.

DELETE from t_tab where connid is null.

or

DELETE from t_tab where connid = space.

or

DELETE from t_tab where connid = ' '.

by

prasad GVK.

Former Member
0 Kudos

Hi,

I think all answers say the same thing so mine is no different

Use:

delete from t_itab where field1 is null.

But some word of precaution:

a) Dont use this statement in loop where loop is done on same internal tab t_itab.

Thanks.

Former Member
0 Kudos

You can delete for all initial records.

Just check for the condition and say delete.

Is it ok?

delete from t_itab

where field1 eq ' '.

I tried this one also:

delete from t_itab

where field1 is initial.

I guess you are not allowed to write initial in where clause of delete.

Regards,

Lalit Mohan Gupta.