Skip to content
Advertisement

Oracle View loop on specific tables only

I got many tables of which some end with digits (date).

Due to technical reasons I had to create a view on every table (just a workaround)

The current state is something like:

All it does is creating views for every table which begins with ‘XXX_’. Its almost what I need.

But now, sometimes tablenames look like “XXX_tablename_20210302”, which is a manual backup.

Its not always 8 digits (date), sometimes shorter, soemtimes longer numbers. I would like to avoid all tables, which do have numbers in the end of the tablename (from right to left till first “_” checkup, its a number maybe?)

Does anyone know how to solve it?

Im kind of stuck here.

Advertisement

Answer

You can use regular expressions with regexp_like:

This finds all the tables that

  • Start with XXX_ XXX_
  • Followed by any characters .*
  • That do not end with a digit [^0-9]+$
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement