Last active
October 14, 2021 01:33
-
-
Save ruan4261/810d8d336537379eda0190d4ec3e6329 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Replace ${} with your text | |
-- Compare the structure of two tables | |
-- Pay attention to the case of the table name | |
select v1.table_name,v2.table_name, v1.column_name,v2.column_name, | |
v1.data_type,v2.data_type,v1.data_length,v2.data_length ,v1.data_precision,v2.data_precision,v1.data_scale,v2.data_scale | |
from | |
(select * from user_tab_columns where table_name='${table_A}') v1 left join | |
(select * from user_tab_columns where table_name='${table_B}') v2 on v1.column_name=v2.column_name | |
-- Query from historical data | |
SELECT columns FROM ${table} AS OF TIMESTAMP TO_TIMESTAMP('rollback time','${YYYY-MM-DD HH24:MI:SS}') | |
-- Join table update | |
update ${table_A} a set | |
${field} = (select b.${field} from ${table_B} b where b.${field} = a.${field}) | |
where ${field} = ${target} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment