And just to throw in a "sed" variant, you could try
Code:
sed -n '/^TABLEA/,/^$/{/^$/!p}' < infile.txt
Just remember that it is case sensitive.
sed -n '/A/,/B/{/C/!p}'
The -n means by default don't print anything
The /A/,/B/ { } means from pattern A to pattern B, inclusive, do what's in the braces.
The /C/!p means except when pattern C occurs, print the current pattern space (line)