1
I need to migrate information from a column of type long raw oracle 11g.
CREATE TABLE PROD_IMAGEM (
ID NUMERIC(8),
IMAGEM LONG RAW
);
CREATE TABLE BKP_TAB_IMAGEM (
ID NUMERIC(8),
IMAGEM LONG RAW
);
DECLARE
IMAGE_L LONG RAW := '1F8B0800000000000400E55C5F6FE3C6117F2FD0EFB05081E60E9065EE3FFE89ED04B2ADBB53EAB35CC977410301C59A5CC9C449A44252CE25C13D047D28D06F91F6A148817C823EF4C11FA85FA1B3FC275A5CCAF29D2FF5E592E08E22B933B3F39B999D995DE6BFFFFECFFEE7AFE7337425A3D80F838316EE182D240337F4FC607AD05A26931DBBF5F967BFFDCDFE5924AF7CF9CD4846BE98F9DFC9A832C8EE900E8391F01E42FB834502B763742AE6F2A0152D92A15C8451825BE84C4CE551B80C928316CD7E1D0AF7D551380BA383D697977E22331240443D3C1689C87FC39D7E22E7381DD40F3CDF95F141CB68E33669A1131178B12B16C02D8996B2859E8B68EA07F113F546FA2FDCF203CDDD331814FDC10FBC835697B5D008E6058F6D62762C0B9BA6D5C6D8743AC4C1D46EA1DD42B6DD35E1F647972292DE28F97626E375810FC3C89351FAECA0D50F629928B65EA65FDEE6A9288403F727A1524C57E9B78DB0B148D4AD48E6EA399C81AA5AA8A2B0F34804F1023807F066C666EDDDF4DEB1882F73F6A370E67B6A9A9ED2DE79B880EB24024980CF5C00F323A025A3BDFCAF277E92523A0C5FB7D1891FC8137FEE276D741A1ECDFCC5DE6918C8BD2398BA70D5DB4F6500B6E19E7FBB08A791585CFA6E0B9DCBD74977E64F83B954737BEE7BDE4C66D40BF1BEF4BDE4B2B02A71A1C4044B0188E56B006AA5F55CA164B3427364750A25EF5DA14A21EB1A3D9522DA4BFFB8776D027E2772926CA5485253247DC096A953E443334D5AD328BBB346CFFDB9843829BF41C3702E8236723A16FFFF99E9FBD5EDD6B68AEB5ECF3F10D5AA39B6E1A52409E70FDD80ED9A96CDCD5AC6786B35B7519CD2380C67DE2FA27288851F8ADE31ADA6129AD4214F270E81F1AB7A3AA1EE823C40F2445CC859260F282BF2A7C213C893C0C7BDFE17A448E1EF7FF7FA780FFEE8EEE9AEF08E4AE96470FDCFEB7F844822379C5F88442281FC82C0A7BA71FD2089426F990D7B94C810A6F958F762375E483709637422A7C28F37BE7B9E3E425E8826E1B4240B522DA2EB1F13DFD58FAA4EC0057B8C2AB2ABB1D77F0F7C77B390E7D73FB9F0926295649C940A35BAD85626B2837A5F2FFD8550E60193D753D36AB6324E0D0B213715D9E4C0B59662B6AD086B74623F06D31168E2BF565AA990154BF0977CD69B944477D059049EEE4730A151E886115C68A7701685AEF4FC7CEE7DD0AC5F81FE36C1BB57E030B96C7E3A76EB39BFF4458CC4F54F91145BB31B4A11F8F39C9F2B22C0E54AC4EE722622F4687874F6786B85C789F0525DBB97E1D74BB9EDB867720EAA14537F7B999F4422594677785F46051A5B8EF8E3528252BCBB30E9CD653405C376D544DCD9F5CFCAA3B61EFD3CBC4A45CC8068A308B45204A5245D1DA07A944ABB57D73F2720DBD694CF641C874AA4708EE6E1850FEB860032105C97DFC1A58E4C472D1FE932A3D290210430489E99D131093798D9C69C7630610E676DE250DC218CDBBC4D30E770DB31D92AE126F5287F23A2EF0FC330390CC3577311BDCA8378B556CE06EFEFE6D574F64B159E38974AADC4941B56C7B64018661B1D8A79593FF70358B96E5D428EC2F9228CA1EE4EEFB5B6A1DC48FDD645EAA5982DE59F93F4F6E85B15933AD94A5D797CD01A0E0E7BC3F3013AEEA1A3EEF3B3C1089DBE38ED8DD4EF2F7AA317A362C1BBFDBD1CC7158C04930E734C0A93324C0C978E65B61D4621656943996FC03F5C5F7A56CBCF7798DBB3DEC9F9E0149DBCE87F8586BD7E3997FAFD9AEC2B135C971D2EA953971F6BE5A7EF247FF7E4B877D41FA2DEF18BEEF078808E064310B75B4CA3F1713E07CA3A14548D8965746C07E0A8FA108619DA16AF54AC37A4576991D2C99D0B819732F24420A06E65BF685EFA21D4B0751BD94D8DA46E372C97AAE8B00D934986F9F7E32899E031E8CA4FFF7017534C38197B723231BE1F4F0083E4620617C67812F833943611F6DEC00D9CDE184F5C9822A068541E91ECDDB5E262EFCD9B5568FF7EEC2A348036DA1B436C35C6D348CAC0185F80A51A7B9537C7AA6DF9CA0F3C365EBA780C907AE3AFDDB10B02CC4430C5E053A974316168F0A8FB183D950A745870047A11642BC6A877DAEDA397D73F0CBFEA75D1D361F714C24C10A2659C65584B957C00D4174B5F4DEC13698D3F9970107E96A6BE6DF59280B4C90BD3B548C07D1F2430D45441A095B015B95B55571DFAEEA552781919C8BA57399953D9854FD96D6EEB9B1595AAFAA3003548219908B881205109A146A50EDB75CC3652B91AA4C502017EC77E2401C2EF403A8960083A5403440CBFC1127ADED21525B692AA67213A152E2CCE90A5AA243F805C43D98D423844C7D2057A217A22C10BE10D481038DB3558FB9E71C78609EBB343AC6A30AD40CFB4D09B5B409FA35E81A7A2FFDC06AAD881466AE0DE788E0B6BD0CEBB4ABD3083D5AD4A56A7B18C0D0F09E77B7A7EE31814E965B6B398093F000B4A4D18AC48C139813800402E2219A7F100B9324AFC096489E0C6E2D3376AA47E2A7785103347F96E13845C0BA1F5BEBCF7FFE1A2B91F65D1F670D81DF54F7AFD611729F79C5D868FC46315429F7787FD2EFA6230EAA1E32E82775E763B993BE17B73276EB20E316DA3090C530B86FD7184D2C361FF6917540FAB5FFFF4E8FA6FA7C7FD013AEF9F0D501FEDA0C3EB1F46FDA3015CF54FCF7BC3E7BDE33EAC98F046B6E641853D15E8328CB2308AD3868F444016EE89B873DF81D182EC18906CC0D1D2E2E83436D8CEFBE72F4EBAC37A6A8E09B13A8C12C275A9793D31B7B58CB1D1C839CF474ACE74AD282096AA40A9A138735C7056650E373B5C31A7AB693B7AEECD8DC551BA8E5DFF18F9CA0B354254AAAA9A1016377542607D7185C9C7E145A722767D2F0D6A728EB0956687D330CEDA75D8014345AA0B00EB4C94463E818E329F71BCE52CEBF17A601259B40C546E93E63596C11DCA28F8DF68748676CF7AF79E6B308B752CB32934627DCD89E9C701EB5918A14B712523953CB8B365069907C98242D9490B0509FAB888529C8941540AE92EA3B488B86FA84C0E1ED818FD30D143F5DEEABCF78947A4C763AD5CDB41CFCFDBC820696B7D992C2B30DC770E6153A2DCC4264DDA5FABC7A0ECD6B5EBD2621C974DC4F577B2732878D519240FBF33783FD6A5F5FBF76E67378CECE29D12A21D95F53C1B409E9B9ADEC5BD585FB54508F6C7285C388475604186CBAAF9E96BC2A6DEE641AB68831C2D237843ED8FE898421D9A32C5D4247916643A2BA6FC6D1A7A1FE89EF3433A4E51073B8D2B64FBE63044836765B66B1A6A07849B780538358C1B489BF7D4BAFD00807E681DDD7AABA0B9A3DB04362003E139094B27C74E1D734C5227E716BD01BDF5EB71F2EE6CF690DDBADE87489166BA36EFBBECF97C31B8FECB009D755F9C0CD0D3C1E9F55FBB272F7BE5CE55D3D39AE150E2A486C349D57430E31D8B10A6D2D1C284ECF76C42BF48C818FAD3CBC693600FC98CEA6D90D48CB8AE65BCB5191D4BD79F8BD90D3B22ACB0197595ABCED62C2B154B510B8BCE44F44D0CEB9DECFCED32B9F2F8D55B8EAE6551553F59E5511A2510E3D7E0270FDF41EAB6963A88A5EB01DFA89F824480B4519EBD6727426A709BC4EE70E7E646B84D7887D8BC729604DF5FB94856E5227DF8E562FA6430998011FFE9A0B55351CDDD556D5495ACDCCC668C549A9244BF49DA5C15D9C276B9B4C58E432774876187ED086E4C76A4C9B9E5DA96693359CAC16DD51B802A899AACC3A863B52D82D58187B6694385E6381541D8FBCD9F3FDEAF20340DCABBD742B71F3C2A1AE3593B8880E9131383E933AB9DD5E3B60197D9C600A99C7879AB0AF9C1E0BE45E2F3D0AA254D17F4EEE592EE6C483DC1297A83B929A87D7BCC213431DBAE165044BFBDD894C21FB45E3E3DDEE99E9DEDA836A626AD22CC51D1C5A4151B641044C1F22C4A3436A8DF166BCAFDD2625F93CC5929076A55B812C384D8EB60B5E8D5B8EAF7C49A12BA8316337593B56D08EFFC265B9A1DD8B42D5BC3569F47DA8D6C4FFCAB285C1D10A53A356387287CB153E81996AB82355D1DC8D1EF80356F3F3E09679742C7BAA2EB15EBBAB22BAC1B76699A37208772EAC7897EE6A9CE597A762167DFA67666EA15B3A60DDB0DDB6E3B56CE62E9C2EB6AE2F5F85A9938FD5537271E5C706D683C62AC31845B7BCF1ADB2B43EA0A7E7D50A5ECFEF2E76C69D85739A71F2CC365DC7BADB66AFBC1244CBF4DCE3F3256B92FCAFFCBBF740E9781176739B1FAAAB86DAB589BAD93D9A02CCF55270B0A1936A4DDBA73CDD4B21DC3AC9E43E090EB3AE9E9C09BA79C2933B86562EB66255DCD775324D772686E592635AD2CBEE818A8A3C8B663329BD1ED98D132636F3E248C218C65B32AD27798ABE164FBD1F999E1FA979819D99AAD14A72409AC10BC42142286A992715EFF2A8E17C458E3D13BC3C00EA7582BA386A25950E48D27C1EE48D12A289A8DE7994CB3498B1A7A7641CF6A385563398C519A41BF1545A7A058C94D8A73338663E5603499956D590E715284B6B0AA62294B8BF7B5A332CCE4363140B395D32A40C45EF1AAF8D1EAE80AACA48E454CB3CEABF447BCC9211B78AD26BA0DAB956BE21A2CD9C90CD3312DCBA26C6B5870E981B8E908C19DA1C6A5FBD563F56A6B7CCD016F21593A21669BC29269D38E012A6596635193A6A7A18B1D500C3F9543E9C8971E89F926F216C329794A2C9C06B9558FAE04D2D4D863E99ED8AC373C0DCA71A6893AF962676D9D60E99FB874D055AF7D13C1B2F74E2C4E33DBD4D12FBD15DB9BE8DBD848E95B001E26D87074F457BD4B9CE25B5F714A77C5CE26F5D4B9DDEC0F37912F3D94D43FA7A980AB994C0DDCDB99953EAAE941AD98516CD81DC7E0E05A3661044282C60FCAAFCAA86DA651A3CE6DB57EAEDC22EB34F122A682EC568753082C06E4E9900FB3F5CE9365618C6D6CB23AFDD29309AFE7DD2C5F9739985687A9880C4E8719E3749586574236E1D82AD6B53AA7D2C1496D092BE85B18F445A80D5E5DE679D575A14EB4746B62D54BB55594AFCBBF2A915370B69B42E9E5A45E099B666E313A6E65B5C6B961A5316A1B76650C20CECD6A8CDFC2AE2C89D7D6D4CDECCA90408D8DBA0460801DC4F73C0054CA602813ABCA2436886BAB95A51E9169191328DEA8CC1ABB46656E6457C6084A6E2A136406B619A1825BC510ABB5EE3ACD321450BAC9796A33D03ACF46E9CB30406B39AA86FE2DCEB3BF7BA3E8D1553AF008AAA1F5FF21D467FF03C34B974B4F4A0000';
BEGIN
Insert into BKP_TAB_IMAGEM (ID, IMAGEM) values (1,IMAGE_L);
END;
Error shows the following: Command Line Error : 2 Column : 231 Report of errors - SQL error: ORA-01704: too long string literal 01704. 00000 - "string literal Too long" *Cause: The string literal is longer than 4000 characters. *Action: Use the literal string of at Most 4000 characters. Longer values may only be entered using bind variables.
please clarify: do you want to migrate from 11g to 18c, OCI 18c??? another Oracle? another version? or make a backup? There are better ways to do this. If it’s backed up, this way it’s totally "without integrity".
– Mateus
I need to restore some deleted rows from PROD_IMAGEM table this information already exists in BKP_TAB_IMAGEM table.
– Rodrigo Martins de Souza
Try UTL_RAW.CAST_TO_VARCHAR2 https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/u_raw.htm
– Motta
I tried this format and it didn’t work
insert into PROD_IMAGEM (select id, utl_raw.cast_to_varchar2(dbms_lob.substr(IMAGEM)) from BKP_TAB_IMAGEM);
Insert into PROD_IMAGEM (select id, utl_raw.cast_to_varchar2(dbms_lob.substr(IMAGE)) from BKP_TAB_IMAGEM) Command Line Error : 17 Column : 78 Error report - SQL Error: ORA-00997: Invalid use of data type LONG 00997. 00000 - "illegal use of LONG datatype" *Cause: *Action:– Rodrigo Martins de Souza