PostgreSQLデータベースからOracleデータベースへのChangedDataCapture(CDC)を実装する必要があります。
CDCforPostgreSQL用のJournalizationKnowledgeModuleがないため、https: //forums.oracle.com/forums/thread.jspa?threadID=620355で指定されているようにJKMOracleSimpleを適応させようとしています。
ただし、Jythonの「Createtrigger」コマンドで問題が発生しています。
ODIでは、「トリガーの作成」コマンドを次のように置き換えました。
drop trigger if exists public_t_payment on public.payment;
drop sequence if exists idSequence;
CREATE SEQUENCE idSequence;
CREATE OR REPLACE FUNCTION public_t_payment_trigger() RETURNS TRIGGER AS $$
declare
V_FLAG VARCHAR(1);
V_id integer NOT NULL DEFAULT nextval('idSequence');
begin
if inserting then
V_id := NEW.id;
V_FLAG := 'I';
end if;
if updating then
V_id := NEW.id;
V_FLAG := 'I';
end if;
if deleting then
V_id := OLD.id;
V_FLAG := 'D';
end if;
insert into public.j$payment
(
JRN_SUBSCRIBER,
JRN_CONSUMED,
JRN_FLAG,
JRN_DATE,
id
)
select JRN_SUBSCRIBER,
'0',
V_FLAG,
sysdate,
V_id
from public."SNP_SUBSCRIBERS"
where JRN_TNAME = 'public.payment';
/* The following line can be uncommented for symetric replication */
/* and upper(USER) <> upper(''postgres'') */
end; $$ LANGUAGE plpgsql;
create trigger public_t_payment
after insert or update or delete on public.payment
for each row
execute procedure public_t_payment_trigger();
上記のコードはPostgreSQLでコピーして実行するとうまく機能しますが、ソーステーブルで「StartJournal」を実行すると、ODIによって次のエラーが発生します。
ODI-1217: Session payment (712013) fails with return code 7000.
ODI-1226: Step payment fails after 1 attempt(s).
ODI-1231: An error occurred while performing a Journal operation on datastore payment.
Caused By: org.apache.bsf.BSFException: exception from Jython:
SyntaxError: ("no viable alternative at character '$'", ('<string>', 6, 19, 'returns trigger as $test\n'))
問題はトリガーの「as」名($$)を返すことにあるようですが、Jythonでこの問題を解決する方法がわかりません。