Hi everybody.
I got a problem with Interbase 6.0.
What I would like to do is write a Stored Procedure which can be run on different tables. What I mean is that I want
to pass the table's name as a parameter to the procedure which then itself accomplishes a certain task on that specific table. To make things clearer a little bit, I give you an example of what i mean:
create procedure test (
tablename varchar(32)
) returns (
number integer
) as
begin
select numbercolumn from :tablename into :number;
suspend;
end
Unfortunately, Interbase doesn't seem to support this type of table-dynamic select (or insert or update) statements
and I think that is because of the dependencies between database objects, which would not be clear then anymore.
Anyway, it would be of great help to have such a construct, because I have to implement quite a large procedure
which has to do the same task for about 15 or 20 tables and I really don't want to code it for each table for
reasons that are obvious as i think
It would be much more elegant and effective if I had the possibility to implement the procedure only once in a way
similar to the one above, that could work with many different tables. So I would be really grateful if someone had
an idea of how to realize a Stored Procedure that behaves like the above one would. Maybe there are some tricks
that would help to realize it somehow.
I hope I have made my problem clear and am really looking forward to all your replies...
thanks in advance
I got a problem with Interbase 6.0.
What I would like to do is write a Stored Procedure which can be run on different tables. What I mean is that I want
to pass the table's name as a parameter to the procedure which then itself accomplishes a certain task on that specific table. To make things clearer a little bit, I give you an example of what i mean:
create procedure test (
tablename varchar(32)
) returns (
number integer
) as
begin
select numbercolumn from :tablename into :number;
suspend;
end
Unfortunately, Interbase doesn't seem to support this type of table-dynamic select (or insert or update) statements
and I think that is because of the dependencies between database objects, which would not be clear then anymore.
Anyway, it would be of great help to have such a construct, because I have to implement quite a large procedure
which has to do the same task for about 15 or 20 tables and I really don't want to code it for each table for
reasons that are obvious as i think
It would be much more elegant and effective if I had the possibility to implement the procedure only once in a way
similar to the one above, that could work with many different tables. So I would be really grateful if someone had
an idea of how to realize a Stored Procedure that behaves like the above one would. Maybe there are some tricks
that would help to realize it somehow.
I hope I have made my problem clear and am really looking forward to all your replies...
thanks in advance