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

Select where %

Former Member
0 Likes
851

Hi All,

Why is the below statment not fetching any data?

SELECT * FROM t012k INTO TABLE gt_t012k WHERE bankn EQ '%15%'.

Data is present in the table T012k having bankn = %15%.

Thanks,

Rakesh.

7 REPLIES 7
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
820

Hi

SELECT * FROM t012k INTO TABLE gt_t012k WHERE bankn EQ '%15%'.

Use :

SELECT * FROM t012k INTO TABLE gt_t012k WHERE bankn<b> LIKe</b> '%15%'.

Regards,

Sree

Read only

Former Member
0 Likes
820

SELECT * FROM t012k INTO TABLE gt_t012k WHERE bankn <b>like</b> '%15%'.

regards

shiba dutta

Read only

former_member196280
Active Contributor
0 Likes
820

When you want to USE % in where clause use LIKE.

Regards,

Sai Ram

Read only

0 Likes
820

How can i use LIKE % FOR ALL ENTRIES?it is giving error

Read only

Former Member
0 Likes
820

Hi

In SQL the symbol % is used to get LIKE fields

say 'AB%' means all fields starting with AB to be fetched.

Ensure that there is data in the table with this field '%15%'. then

Declare a constant

<b>Constants: v_bank like t012k-bankn value '%15%'.

data gt_t012k like t012k occurs 0 with header line.</b>

then see the select statement:

<b><b>SELECT * FROM t012k INTO TABLE gt_t012k

WHERE bankn = v_bank.</b></b>

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
820

Rakesh,

Use LIKE '%15%'

Thanks,

Raj.

Read only

Former Member
0 Likes
820

hi

With character type variables u could use co(contain only) cs(contain string) ..

Thanks

Dinesh