Skip to content

Instantly share code, notes, and snippets.

@daicham
Created January 11, 2012 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daicham/1593722 to your computer and use it in GitHub Desktop.
Save daicham/1593722 to your computer and use it in GitHub Desktop.
Export csv from a Oracle table by sqlplus
sqlplus -s << EOF > ${sdata_file}
${ora_user_name}/${ora_user_pass}@${ora_sid}
set echo off
set linesize 1000
set pagesize 0
set trimspool on
set trimout on
set feedback off
set colsep ','
select
id,
name,
to_char(created_at,'yyyy-mm-dd HH:MM')
from
table
where
to_char(created_at,'yyyy-mm-dd HH:MM') >= '2010-08-09 19:30';
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment