Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wildcard condition help!!

Status
Not open for further replies.

DugzDMan

Programmer
Oct 19, 2000
157
US
I am trying to set a case statement to one of two values depending on the 4th character of a column. My SQL looks sort of like:
Code:
Select Field1,
Field2,
case when SUBSTR(TableName.ColumnName,4,1) = 'U' THEN 'Access'
when SUBST(TableName.ColumnName,4,1) <> 'U' THEN 'Non-Access'
end(named&quot;Test&quot;)
From TableName
The problem that I am running into is that the user now tells me that it is the 4th 'Alpha' character = 'U' that is the switch. The string might start with 2 or 3 digits, then go into the Alpha string. Is there a way to tell it to look over any number of digits, then see if the fourth alpha character is 'U'? I am not sure if this can be done, but would be very grateful for any input.

Thanks in advance,
Doug [sig][/sig]
 
INSTR searches a string to find a match for a given substring;
if found it returns the position in the string of the first letter of the substring,
else it returns 0. It can also search for the nth appearance of the substring. [sig]<p>Jim<br><a href= > </a><br>oracle, vb, some javascript[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top