7 ms·
I see what you mean, and yes it would be nice. In essence what you advocate is a table type and a number of tables conforming to that type could be then passed
by DenisM 17y ago
I see what you mean, and yes it would be nice. In essence what you advocate is a table type and a number of tables conforming to that type could be then passed into a function which operates over the parameter given what it knows about it by the type description. It's a very appealing idea and many times I wished it was possible.
My guess as to why it isn't possible is that in the database world there is an assumption that all records of the same type lie in one table, i.e. the table is the type. And if you look at it form theoretical relational theory point of view, that is so. Alas in practice we do have things like third-party components and we have to worry about lifetime (e.g. transient table-typed variables).
To be fair Oracle I think has something called "package" which allows writing reusable code. Don't know much about it, but supposedly that's what it does.
Also, MSSQL has notion of Table Type which can be used to declare variables. I actually implemented (a part of) it while I worked there. :)