Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How do ORACLE and MYSQL import data from each other

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report