Have a string column - COL1,containing words of different lengths separated by space,this can contain special characters as well.While deriving below logic, getting different result.
Logic: If COL1 starts with an alphabet and ends with an alphabet and doesn't contain any special characters(can contain spaces in between) flag is 1 else flag is 0.
COL1 FLAG
Abc gty xyz 1
ab/c bpl ?t 0
qwr .p 0
tiotio iop 1
TItio io/ 0
abc 1
abc xy 1
tried with
SELECT CASE WHEN REGEXP_LIKE(COL1,'^[a-zA-Z]$') THEN '1' ELSE '0' END AS FLAG FROM TABLE1;
but wrong outcome.