Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Q: SQL+, set COLSEP = "TAB" ?

Re: Q: SQL+, set COLSEP = "TAB" ?

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Mon, 02 Nov 1998 14:40:00 GMT
Message-ID: <363fbd75.5271249@dcsun4.us.oracle.com>


On Mon, 02 Nov 1998 11:45:10 +0000, "Martin B." <martin.b_antispam_at_lycosmail.com_antispam> wrote:

>Hello,
>
>We'd like to set the column separator of SQL+ to TAB, in order to
><spool> a query result directly to a table-formated text document, which
>can be recognized and imported automatically by any spread-sheet
>program.
>
>We tried several solutions, but no one worked.
>
>Could anybody out there help us, please ?

set colsep ' '
will set the colsep to tab.

but you might consider selecting one column made up of all your columns concatenated together with tabs.

SQL> set heading off
SQL> set feedback off
SQL> select ename||chr(9)||sal||chr(9)||empno
  2 from scott.emp;
SMITH	800	7369
ALLEN	1600	7499
WARD	1250	7521
JONES	2975	7566
MARTIN	1250	7654
BLAKE	2850	7698
CLARK	2450	7782
SCOTT	3000	7788
KING	5000	7839
TURNER	1500	7844
ADAMS	1100	7876
JAMES	950	7900
FORD	3000	7902

SQL> This way you can 'escape' tabs in your data by enclosing the columns in '"' like

  1  select '"'||ename||'"'||chr(9)||
            '"'||sal||'"'||chr(9)||
            '"'||empno||'"'

  2* from scott.emp
SQL> /
"SMITH" "800"   "7369"
"ALLEN" "1600"  "7499"
"WARD"  "1250"  "7521"
"JONES" "2975"  "7566"
"MARTIN"        "1250"  "7654"
"BLAKE" "2850"  "7698"
"CLARK" "2450"  "7782"
"SCOTT" "3000"  "7788"
"KING"  "5000"  "7839"
"TURNER"        "1500"  "7844"
"ADAMS" "1100"  "7876"
"JAMES" "950"   "7900"
"FORD"  "3000"  "7902"
"MILLER"        "1300"  "7934"

SQL> Hope this helps.

chris.

>
>Thanks in advance,
>
>Martin.
Received on Mon Nov 02 1998 - 08:40:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US