‎2008 Nov 21 10:39 AM
Hello,
I want to write an sql select similar to this one:
select * into wa from dbtab where substr(dbtab~field,2,4) = variable.
where variable is type c length 4.
I know that in various SQL there is a substr function but I can't find a similar one for the SQL used by ABAP...
Thanks.
‎2008 Nov 21 10:42 AM
Hi,
you can wildcard text like
select * from dbtab where feild1 = '%like%'
regards
Ramchander Rao.K
‎2008 Nov 21 10:44 AM
Yes, but this works for static texts, I want something that will work using a variable instead a static text.
Thank you.
‎2008 Nov 21 10:46 AM
Not available in Open SQL, try WHERE field LIKE '__text%' for your example to search for occurrence of "text" in positions 3 to 6 of the column.
Thomas
P.S. you can build the search string using your variable contents.
‎2008 Nov 21 1:27 PM
if the contents in the table dbtab are only few , you can do the following.
select all the entries from the table into an internal table.
loop at the internal table checking for the required condition on the field.
this would reduce the burden on the database .