I am in the process of migrating from Oracle to Postgres with Ora2pg but I find this problem that the signatures on the Postgres side do not exist can you help me find the right solution ? What will be equivalent of following oracle’s query in Postgres? this is the code with ORACLE
procedure log_TRA_4_TRED (rowData in TRANSACTION_%ROWTYPE, inFundCurrency in char, inActionType in VARCHAR2, inLoadDate in DATE, tmpAddedData in out pkg_contenu_dossier_cmn.tmp_addedData) is
-- TRG_TRANSACTION_ //CONTENU_DOSSIER => HIS_TRADE_REAL_ESTATE (TRED)
varLogTableName VARCHAR2 (30 CHAR) := 'LOG_CONTENU_DOSSIER_TRED' ;
varSqlSignature VARCHAR2 (32000 CHAR) ;
varSql CLOB;
begin
varSql := getLogSqlForTRED('TRANSACTION_', 1, varSqlSignature);
case
-- TRANSACTION_ (from TRG_TRANSACTION)
when varSqlSignature = '127895436' then
execute immediate varSql using
/*1*/rowData.CODE_TRANSACTION ,/*2*/rowData.CODE_VALEUR_SOURCE ,/*7*/rowData.CODE_DEVISE_NEGOCE
,/*8*/inFundCurrency ,/*9*/pkg_contenu_dossier_cmn.getRunRefMinRequiredCycle(tmpAddedData, inLoadDate, 'PKG_CONTENU_DOSSIER_TRED', 'WH')
,/*5*/inActionType
,/*4*/inLoadDate ,/*3*/rowData.CODE_VALEUR_RESUL ,/*6*/rowData.DATE_EFFET
;
else
dk.throw('Unhandled sql signature "'||varSqlSignature||'".');
end case;
exception when others then
pkg_trg.legacyHandler('PKG_CONTENU_DOSSIER_TRED.log_TRA_4_TRED', varLogTableName, 'for ('||rowData.CODE_TRANSACTION||')', NULL, varSql);
end;
and this is the result of ora2pg
CREATE OR REPLACE PROCEDURE pkg_contenu_dossier_tred.log_tra_4_tred (rowData TRANSACTION_, inFundCurrency char, inActionType text, inLoadDate date) AS $body$
DECLARE
-- TRG_TRANSACTION_ //CONTENU_DOSSIER => HIS_TRADE_REAL_ESTATE (TRED)
varTriggerName varchar(30) := 'TRG_TRANSACTION_';
varLogTableName varchar(30) := 'LOG_CONTENU_DOSSIER_TRED';
varLogActionType varchar(20) := 'add of data';
varSqlSignature varchar(32000);
varSql text;
BEGIN
varSql := pkg_contenu_dossier_tred.getlogsqlfortred('TRANSACTION_', 1, varSqlSignature);
case
-- TRANSACTION_ (from TRG_TRANSACTION)
when varSqlSignature = '12785436' then
EXECUTE varSql using
rowData.CODE_TRANSACTION/*1*/
, rowData.CODE_VALEUR_SOURCE/*2*/
, rowData.CODE_DEVISE_NEGOCE/*7*/
,
inFundCurrency/*8*/
, inActionType/*5*/
, inLoadDate/*4*/
,
rowData.CODE_VALEUR_RESUL/*3*/
, rowData.DATE_EFFET/*6*/
;
else
pkg_trg.throw('log_TRA_4_TRED: Unhandled sql signature "'||varSqlSignature||'".');
end case;
exception when others then
pkg_trg.legacyHandler(varTriggerName, varLogTableName, 'for ('||rowData.CODE_TRANSACTION||')', varLogActionType, varSql);
end;
$body$
LANGUAGE PLPGSQL
for info, I use this method to replace the variables above in the appropriate places in the SQL query, that is to say I will replace the bind variables in the query, Any help hereand thanks.
aab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.