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

Delete statement

Former Member
0 Likes
843

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
Read only

Former Member
0 Likes
812

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
Read only

Former Member
0 Likes
812

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.

Read only

Former Member
0 Likes
812

Try this Delete i_tab where field1 = ' '.

Read only

Former Member
0 Likes
812

Hi,

use null, it will work...

Regards,

Pavan

Read only

Former Member
0 Likes
812

Try this:-

Delete from t_itab where field1 is Null.

I hope, it'll work for ur requirement.

Thanks.

Anurag.

Read only

Former Member
0 Likes
813

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.

Read only

Former Member
0 Likes
812

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.

Read only

Former Member
0 Likes
812

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.