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: 

condition

Former Member
0 Kudos

HI All

I have a variable v1 = 'ztest'

and I have objid field values as 'ztest1', 'ztest2', 'ztest3', 'ztest'

I need to give a select command with a condition as follows

select count ( * ) into cnt from table where objid = v1.

It is giving the count value as 4 . But I want the exact match that is it has to consider only 'ztest' and not 'ztest1','ztest2' etc.

What should I do for this.

Regards

renuka.

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

Try this way


  concatenate v1 '%' into v1.
  condense v1 no-gaps.
  select count ( * ) into cnt from table where objid like v1.

1 REPLY 1

former_member194669
Active Contributor
0 Kudos

Try this way


  concatenate v1 '%' into v1.
  condense v1 no-gaps.
  select count ( * ) into cnt from table where objid like v1.