Get the App
SLTechnology News&Howtos  ›  Database  › 

How do ORACLE and MYSQL import data from each other

Shulou Source: shulou.com Published: 2022-05-31 17:58:58 10月02日 Update

This article mainly explains "how ORACLE and MYSQL import data from each other". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how ORACLE and MYSQL import data each other".

It's just a column and method specific options to be added as needed.

1. ORACLE uninstall data

DECLARE

Row_result varchar2 (4000)

Selectsql varchar2 (4000)

Qrycursor SYS_REFCURSOR

Txt_handle UTL_FILE.file_type

BEGIN

-- selectsql: = 'select id | |',''| | name | |'','| | dti from testdump where name =''gaopeng'' and dti > to_date (' '2015-03-17 00 to_date,' 'yyyy-mm-dd hh34:mi:ss'')'

Selectsql: = 'select nvl (to_char (id),'\ nerve') | |'',''| | nvl (name,''\ net') | |'',''| | nvl (to_char (dt,''yyyy-mm-dd''),''\ net') from txt'

Txt_handle: = UTL_FILE.FOPEN ('DATA_PUMP_DIR',' testnull1.txt', 'wicked, 32767)

Open qrycursor for selectsql

Loop

Fetch qrycursor

Into row_result

Exit when qrycursor%notfound

UTL_FILE.PUT_LINE (txt_handle, row_result)

End loop

-- close the cursor

Close qrycursor

UTL_FILE.FCLOSE (txt_handle)

End

2. Import to MYSQL

MYSQL LOAD DATA INFILE

1gamma gaopengjia 2010-10-10

2meme gaopeng2Jing 2011-11-12

3Gao Gao Geng 2011-12-13

Load data infile'/ tmp/testnull1.txt' into table txt fields terminated by', 'LINES TERMINATED BY'\ n'

3. MYSQL uninstall data

SELECT id,name,dt into outfile "/ tmp/test2.txt"

FIELDS TERMINATED BY','

LINES TERMINATED BY'\ n'

FROM txt

4. Import to ORACLE

1gamma gaopengjia 2010-10-10

2meme gaopeng2Jing 2011-11-12

3Gao Gao Geng 2011-12-13

Append can be replaced with replace

Modify according to demand

Load data

Infile'/ home/oradba/loadr/in.txt'

Badfile'/ home/oradba/loadr/bad.txt'

DISCARDFILE'/ home/oradba/loadr/dc.txt'

Append

Into table txt

Fields terminated by','

(id

Name

Dt char "to_date (: dt,'YYYY-MM-DD')"

)

Sqlldr userid=ppzhu/gelc123 control=/home/oradba/loadr/ld.ctl log=/home/oradba/loadr/log.log

Thank you for reading, the above is the content of "how ORACLE and MYSQL import data each other". After the study of this article, I believe you have a deeper understanding of how ORACLE and MYSQL import data each other, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Data learning content requirements just that is ideas situations articles methods more cursors knowledge points articles follow questions Liezi practice push Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MariaDB Shulou Tech Info Shulou Technology Xiaomi