Code:
awk '$0 ~ v { printf "%s\n%s\n", x, $0 }
/^--/ { x = "" } { x = x ? x RS $0 : $0 }
' v="^IP=172.18.0.1$" file
Use nawk or /usr/xpg4/bin/awk on Solaris.
Perhaps I misread the question, if you need only the table names,
you should use the code era posted.