How about writing a function as follows:
CREATE FUNCTION FN_IS_VALID (v_internal_id nvarchar(20))
RETURNS table (a TINYINT) LANGUAGE SQLSCRIPT AS
v_out tinyint;
BEGIN
if (instr(:v_internal_id, '*')) > 0 or (instr(:v_internal_id, '+*') > 0) then
v_out := 1;
else
v_out := 0;
end if;
return select :v_out as a from dummy;
END;
You can use the function as follows:
select a from FN_IS_VALID('firs*t')
In can take the value of a into local variable and use it further.
Regards,
Ravi