{"id":1378,"date":"2024-07-17T07:05:59","date_gmt":"2024-07-17T10:05:59","guid":{"rendered":"https:\/\/www.soudba.com.br\/?p=1378"},"modified":"2024-07-17T07:05:59","modified_gmt":"2024-07-17T10:05:59","slug":"trigger-to-update-tstz","status":"publish","type":"post","link":"https:\/\/www.soudba.com.br\/?p=1378","title":{"rendered":"Trigger to update &#8211; TSTZ"},"content":{"rendered":"\n<p>This trigger below need be created before the impdp &#8211; execution. This will avoid ORA-39405 During Import &#8211; The insane way<\/p>\n\n\n\n<p>Create the trigger below and replace the property according to your error. This will correct\/update the timezone &#8211; but this will work only if your imported data will not have columns with timezone property.  Make your adjusts &#8211; like the owner, the table name and property values.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE OR REPLACE TRIGGER sys.create_table_trigger\n  AFTER CREATE ON DATABASE\ndeclare\n  sql_text varchar2(200);\nBEGIN\n  IF DICTIONARY_OBJ_TYPE = 'TABLE' and ora_dict_obj_name = 'SYS_IMPORT_FULL_01' and ORA_SYSEVENT = 'CREATE' THEN\n    sql_text := 'CREATE OR REPLACE TRIGGER update_timezone BEFORE INSERT OR UPDATE ON sys.SYS_IMPORT_FULL_01 ' ;\n    sql_text := sql_text || ' FOR EACH ROW WHEN (new.property > 0) BEGIN ';\n    sql_text := sql_text || ' if ' || ':' || 'new.property=32 then ';\n    sql_text := sql_text  || ' :' || 'new.property:=42;';\n    sql_text := sql_text  || ' end if;';\n    sql_text := sql_text  || ' END; ';\n    execute immediate sql_text ;\n  end if;\nEND;\n\n\n\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>This trigger below need be created before the impdp &#8211; execution. This will avoid ORA-39405 During Import &#8211; The insane way Create the trigger below and replace the property according to your error. This will correct\/update the timezone &#8211; but &hellip; <a href=\"https:\/\/www.soudba.com.br\/?p=1378\">Continue lendo <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1378","post","type-post","status-publish","format-standard","hentry","category-sem-categoria"],"_links":{"self":[{"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/posts\/1378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1378"}],"version-history":[{"count":1,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/posts\/1378\/revisions"}],"predecessor-version":[{"id":1379,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/posts\/1378\/revisions\/1379"}],"wp:attachment":[{"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}