My question should be simple for many of you Supouse I have the following SQL and I want to get the table name using regexp:
SELECT name, age FROM table1
Using this expression I can get that ok
Pattern p = Pattern.compile(".*FROM\\s+(.*?)($|\\s+[WHERE,JOIN,START\\s+WITH,ORDER\\s+BY,GROUP\\s+BY])", Pattern.CASE_INSENSITIVE);
Matcher result = p.matcher(pSql);
if (result.find()) {
lRetorno = result.group(1);
}
But, in case the table name contains the schema name (xyz.table1) my expression brings everything. My question is ... what do I need to modify on this query to only return me the table name without schema/owner?
Any help would be extremely apreciated Regards
Raphael Moita