Use table with DBLINK and without DBLINK
I have a procedure to use with DBLINK but I also need to use it without DBLINK, I could duplicate the procedure and it is already solved.
But I want to just have an Oracle pl/sql procedure that can be used with DBLINK and that can also be used without DBLINK
Please can you help me.
CREATE PROCEDURE credit_account
(acct NUMBER, new_balance NUMBER) AS
BEGIN
UPDATE accounts@dblink_histo SET balance = new_balance
WHERE acct_id = acct;
COMMIT;
END credit_account;
I do not want to repeat the following procedure that does not have DBLINK
CREATE PROCEDURE credit_account
(acct NUMBER, new_balance NUMBER) AS
BEGIN
UPDATE accounts SET balance = new_balance
WHERE acct_id = acct;
COMMIT;
END credit_account;
How can I use the table with DBLINK and without DBLINK so as not to repeat another procedure?
Do you help me please?
apexgeek
You can increase one more parameter in your procedure to instruct when to use the db link and when not. Below is an example:
Now you call it as below: