Goku
Goku

Reputation: 441

How to write PL/SQL packages for all tables

I have 5 tables in schema (t1, t2, t3, t4, t5)

I want to use data dictionary to write DML packages for all tables in schema with one code, not to write one by one.

I couldn't find any example on google.

Thanks in advance

Upvotes: 0

Views: 90

Answers (1)

Littlefoot
Littlefoot

Reputation: 142710

Examples you're looking for are related to dynamic SQL. It will work (if you use it correctly), but doesn't scale at all. What if t6 or t7 appear?

What I meant to say is that data model looks wrong, if there are several tables which - apparently - look the same as you can reuse the same code on all of them. I'd suggest you to merge all those tables into one, by adding additional column which will distinguish rows (i.e. what t1 table's rows represent, what t2 table's rows represent etc.).

You'll have to put some effort into it, but it'll pay off in long term.

Upvotes: 4

Related Questions