Hello I have possible strings that come into a stored procedure like the following:
jag1969
jag*
*1969
The first one above contains no * (wild card) so I'm gonna use IS
The next one contains a wildcard at the end so search for all strings that start with 'jag'
the last one searches for all strings that end in 1969
This code does not work at all, but its the idea I'm looking for :) (I guess I'm looking for a substitute syntax to CHARINDEX) Any help would be greatly appreciated. Cheers
if p_QuoteID is not null then
if (CHARINDEX('*', p_QuoteID) = 1) then
--The wildcard * is at the start of the quote number--
thissql := thissql || 'and quo.QUOTEID LIKE '|| p_QuoteID ||'%'' ';
elsif (CHARINDEX('*', p_QuoteID) = len(p_QuoteID)-1) then
--The wildcard is at the end of the quote number
thissql := thissql || 'and quo.QUOTEID LIKE ''%'|| p_QuoteID ||' ';
else
--There is no wild card
thissql := thissql || 'and quo.QUOTEID IS '|| p_QuoteID ||' ';
end if;
end if;