-- B1 DEPENDS: BEFORE:PT:PROCESS_START

CREATE PROCEDURE _TmSp_ConvertBRLCurrency
LANGUAGE SQLSCRIPT 
SQL SECURITY INVOKER
AS
begin

UPDATE ACH1 SET "LineCurr" = 'R$' WHERE "LineCurr" = 'BRL';
UPDATE ACHO SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE ACRD SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE ADO1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE ADO5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE ADO5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE ADOC SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE AIT1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE AITM SET "LastPurCur" = 'R$' WHERE "LastPurCur" = 'BRL';
UPDATE AITM SET "ExitCur" = 'R$' WHERE "ExitCur" = 'BRL';
UPDATE AITM SET "FixCurrCms" = 'R$' WHERE "FixCurrCms" = 'BRL';
UPDATE AITT SET "DispCurr" = 'R$' WHERE "DispCurr" = 'BRL';
UPDATE AJD1 SET "FCCurrency" = 'R$' WHERE "FCCurrency" = 'BRL';
UPDATE AJDT SET "OrignCurr" = 'R$' WHERE "OrignCurr" = 'BRL';
UPDATE AJDT SET "TransCurr" = 'R$' WHERE "TransCurr" = 'BRL';
UPDATE ARC1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE ARC3 SET "CreditCur" = 'R$' WHERE "CreditCur" = 'BRL';
UPDATE ARCT SET "DocCurr" = 'R$' WHERE "DocCurr" = 'BRL';
UPDATE ATT1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE ATT1 SET "OrigCurr" = 'R$' WHERE "OrigCurr" = 'BRL';
UPDATE ATXI SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE BOE1 SET "LineCurr" = 'R$' WHERE "LineCurr" = 'BRL';
UPDATE BTF1 SET "FCCurrency" = 'R$' WHERE "FCCurrency" = 'BRL';
UPDATE CHD1 SET "LineCurr" = 'R$' WHERE "LineCurr" = 'BRL';
UPDATE CHO1 SET "LineCurr" = 'R$' WHERE "LineCurr" = 'BRL';
UPDATE CIN1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE CIN5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE CIN5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE CPI1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE CPI5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE CPI5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE CPV1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE CPV5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE CPV5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE CSI1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE CSI5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE CSI5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE CSV1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE CSV5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE CSV5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE DLN1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE DLN5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE DLN5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE DPI1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE DPI5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE DPI5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE DPO1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE DPO5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE DPO5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE DRF1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE DRF5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE DRF5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE DUT1 SET "FeeCurr" = 'R$' WHERE "FeeCurr" = 'BRL';
UPDATE DUT1 SET "MinBlnCurr" = 'R$' WHERE "MinBlnCurr" = 'BRL';
UPDATE DWZ2 SET "FeeCurr" = 'R$' WHERE "FeeCurr" = 'BRL';
UPDATE DWZ2 SET "OpnIntrCrr" = 'R$' WHERE "OpnIntrCrr" = 'BRL';
UPDATE DWZ2 SET "IntrstCurr" = 'R$' WHERE "IntrstCurr" = 'BRL';
UPDATE DWZ2 SET "OpenCurr" = 'R$' WHERE "OpenCurr" = 'BRL';
UPDATE IGE1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE IGE5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE IGE5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE IGN1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE IGN5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE IGN5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE INV1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE INV5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE INV5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE IPF1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE ITM1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE ITT1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE ITT1 SET "OrigCurr" = 'R$' WHERE "OrigCurr" = 'BRL';
UPDATE IWZ3 SET "BaseCurr" = 'R$' WHERE "BaseCurr" = 'BRL';
UPDATE JDT1 SET "FCCurrency" = 'R$' WHERE "FCCurrency" = 'BRL';
UPDATE MIN2 SET "ItemCurr" = 'R$' WHERE "ItemCurr" = 'BRL';
UPDATE OACT SET "ActCurr" = 'R$' WHERE "ActCurr" = 'BRL';
UPDATE OADM SET "MainCurncy" = 'R$' WHERE "MainCurncy" = 'BRL';
UPDATE OADM SET "SysCurrncy" = 'R$' WHERE "SysCurrncy" = 'BRL';
UPDATE OBCG SET "DocCurr" = 'R$' WHERE "DocCurr" = 'BRL';
UPDATE OBNK SET "DebAmntCur" = 'R$' WHERE "DebAmntCur" = 'BRL';
UPDATE OBNK SET "CredAmntCu" = 'R$' WHERE "CredAmntCu" = 'BRL';
UPDATE OBOE SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE OBTF SET "OrignCurr" = 'R$' WHERE "OrignCurr" = 'BRL';
UPDATE OBTF SET "TransCurr" = 'R$' WHERE "TransCurr" = 'BRL';
UPDATE OCFL SET "CredCur" = 'R$' WHERE "CredCur" = 'BRL';
UPDATE OCFL SET "DebCur" = 'R$' WHERE "DebCur" = 'BRL';
UPDATE OCFT SET "FCCurrency" = 'R$' WHERE "FCCurrency" = 'BRL';
UPDATE OCHD SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE OCHH SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE OCHO SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE OCIN SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OCPI SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OCPV SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OCRD SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE OCRH SET "CreditCurr" = 'R$' WHERE "CreditCurr" = 'BRL';
UPDATE OCRN SET "CurrCode" = 'R$' WHERE "CurrCode" = 'BRL' AND NOT EXISTS (SELECT "CurrCode" FROM OCRN WHERE "CurrCode" = 'R$');
UPDATE OCRV SET "CreditCurr" = 'R$' WHERE "CreditCurr" = 'BRL';
UPDATE OCSI SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OCSV SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ODLN SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ODPI SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ODPO SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ODPS SET "DeposCurr" = 'R$' WHERE "DeposCurr" = 'BRL';
UPDATE ODPT SET "DeposCurr" = 'R$' WHERE "DeposCurr" = 'BRL';
UPDATE ODRF SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ODUN SET "FeeCurr" = 'R$' WHERE "FeeCurr" = 'BRL';
UPDATE ODUN SET "MinBlnCurr" = 'R$' WHERE "MinBlnCurr" = 'BRL';
UPDATE ODUT SET "FeeCurr" = 'R$' WHERE "FeeCurr" = 'BRL';
UPDATE ODUT SET "BalCurr" = 'R$' WHERE "BalCurr" = 'BRL';
UPDATE OFLT SET "FCCurrency" = 'R$' WHERE "FCCurrency" = 'BRL';
UPDATE OHEM SET "salaryCurr" = 'R$' WHERE "salaryCurr" = 'BRL';
UPDATE OHEM SET "empCostCur" = 'R$' WHERE "empCostCur" = 'BRL';
UPDATE OHSV SET "CurrCode" = 'R$' WHERE "CurrCode" = 'BRL';
UPDATE OIGE SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OIGN SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OIVL SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE OINV SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OIPF SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OITM SET "LastPurCur" = 'R$' WHERE "LastPurCur" = 'BRL';
UPDATE OITM SET "ExitCur" = 'R$' WHERE "ExitCur" = 'BRL';
UPDATE OITM SET "FixCurrCms" = 'R$' WHERE "FixCurrCms" = 'BRL';
UPDATE OITT SET "DispCurr" = 'R$' WHERE "DispCurr" = 'BRL';
UPDATE OJDT SET "OrignCurr" = 'R$' WHERE "OrignCurr" = 'BRL';
UPDATE OJDT SET "TransCurr" = 'R$' WHERE "TransCurr" = 'BRL';
UPDATE OMIN SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE OMRL SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OMTH SET "CurrType" = 'R$' WHERE "CurrType" = 'BRL';
UPDATE OPCH SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OPDF SET "DocCurr" = 'R$' WHERE "DocCurr" = 'BRL';
UPDATE OPDN SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OPEX SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE OPEX SET "PymDocCurr" = 'R$' WHERE "PymDocCurr" = 'BRL';
UPDATE OPOR SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OQUT SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ORCM SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE ORCR SET "VolCurr" = 'R$' WHERE "VolCurr" = 'BRL';
UPDATE ORCT SET "DocCurr" = 'R$' WHERE "DocCurr" = 'BRL';
UPDATE ORDN SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ORDR SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ORIN SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ORPC SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ORPD SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE ORTM SET "ActCurrncy" = 'R$' WHERE "ActCurrncy" = 'BRL';
UPDATE OSPP SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE OTPI SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OTSI SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OTXD SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE OVPM SET "DocCurr" = 'R$' WHERE "DocCurr" = 'BRL';
UPDATE OWHT SET "WTCurrency" = 'R$' WHERE "WTCurrency" = 'BRL';
UPDATE OWKO SET "TotalCurr" = 'R$' WHERE "TotalCurr" = 'BRL';
UPDATE OWTR SET "DocCur" = 'R$' WHERE "DocCur" = 'BRL';
UPDATE PCH1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE PCH5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE PCH5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE PDF1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE PDF3 SET "CreditCur" = 'R$' WHERE "CreditCur" = 'BRL';
UPDATE PDN1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE PDN5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE PDN5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE PEX1 SET "DocCurr" = 'R$' WHERE "DocCurr" = 'BRL';
UPDATE PEX1 SET "DocLocCurr" = 'R$' WHERE "DocLocCurr" = 'BRL';
UPDATE POR1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE POR5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE POR5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE PWZ3 SET "InvCurr" = 'R$' WHERE "InvCurr" = 'BRL';
UPDATE PWZ3 SET "PymCurr" = 'R$' WHERE "PymCurr" = 'BRL';
UPDATE PWZ4 SET "DocCurr" = 'R$' WHERE "DocCurr" = 'BRL';
UPDATE PWZ5 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE PYM1 SET "CurrCode" = 'R$' WHERE "CurrCode" = 'BRL';
UPDATE QUT1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE QUT5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE QUT5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE RCR1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE RCT1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE RCT3 SET "CreditCur" = 'R$' WHERE "CreditCur" = 'BRL';
UPDATE RDN1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE RDN5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE RDN5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE RDR1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE RDR5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE RDR5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE RIN1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE RIN5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE RIN5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE RIT1 SET "FixSumCurr" = 'R$' WHERE "FixSumCurr" = 'BRL';
UPDATE RPC1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE RPC5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE RPC5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE RPD1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE RPD5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE RPD5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';
UPDATE SPP1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE SPP2 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE VPM1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE VPM3 SET "CreditCur" = 'R$' WHERE "CreditCur" = 'BRL';
UPDATE VRT2 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE WHT2 SET "WTCUR" = 'R$' WHERE "WTCUR" = 'BRL';
UPDATE WHT3 SET "WTCur" = 'R$' WHERE "WTCur" = 'BRL';
UPDATE WKO1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE WTR1 SET "Currency" = 'R$' WHERE "Currency" = 'BRL';
UPDATE WTR5 SET "TxblCurr" = 'R$' WHERE "TxblCurr" = 'BRL';
UPDATE WTR5 SET "DtblCurr" = 'R$' WHERE "DtblCurr" = 'BRL';

end;
