How Oracle data is exported to a text file

Source: Internet
Author: User
Tags command line

Oracle data can be exported to a text file using the spool buffer pool technology in Oracle.

1, enter the buffer start command in Oracle Pl/sql, and specify the file name of the output:

Spool D:\output.txt

2, enter your SQL query at the command line:

Select Mobile from Customer;

Select mobile from client;

......

3), enter the buffer result command at the command line:

Spool off;

The system outputs the results from the buffer pool to the "output.txt" file.

tab-delimited example (syoyou_xamshain.sql file)

Set NewPage 0

Set Linesize 10000

Set pagesize 0

Set und Off

Set Trimspool on

Set COLSEP,

Set echo off

Set Feedback off

Spool Syoyou_xamshain.csv

Select

SHIMEI_CD, Valid_term_start_ymd, Shain_nmj_sei, Shain_nmj_na, Shain_nmhk_sei,

Shain_nmhk_na, Shain_nmhe_sei, Shain_nmhe_middle, Shain_nmhe_na, SEI_BETSU_KBN,

nok00j0001. NOZJ1301 (Birth_day),

Saiyou_ymd, KEI_BETSU_CD, Retire_ymd, BANK_CD, BANK_NMJ, BANK_NMK, BANK_SHITEN_CD,

BANK_SHITEN_NMJ, BANK_SHITEN_NMK, Yokin_type, Kouza_meigi_kana,

nok00j0001. NOZJ1301 (Kouza_no), SSO_TAISHO_FLG,

Valid_term_end_ymd, NEXT_SYSTEM_TAISHO_FLG, IDOU_FLG, YUUKOU_FLG, CREATE_USER_CD,

Create_time_stamp, UPDATE_USER_CD, Update_time_stamp

From Xamshain;

Spool off

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.