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: Creating scripts

Re: Creating scripts

From: Craig A.Miller <CAMiller_at_sherwin.com>
Date: 19 Oct 1998 12:33:52 GMT
Message-ID: <01bdf93d$30ae6a20$837e8d94@K980.sherwin.com>


Bret,

Getting data to different DB:

       Yes, Oracle EXP and IMP work great but only within Oracle. Don't go there.

       MS Access causes two passes through data. Don't go there.

       Use SQLPlus, an Oracle tool supplied with the basic client package. With it you can spool output to a delimited ASCII file with a simple SQL statement. This will allow file creation without two passes of the data (MS Access method). The following commands will get you started. Refer to an SQLPlus reference if you require more.

set pages 0
set lines 80
set head off
set echo off
set verify off
set feedback off
set linesize 100

spool filename

example 1.) select col1||col2||col3||col4|| from table1;

example 2.) select col1||','||col2||',||col3||','||col4 from table1

example 3.) select col1||' '||col2||' '||col3||' '||col4 fom table1

spool off

   The first group of 'set' commands will turn off all the non data related stuff SQLPlus displays (headings, row count etc.). Linesize will control the spool file record length. The spool statement will send all output from the select to a file named by filename. Execute your select statement following any one of the three examples given. First example returns columns 1 - 4 all concatenated together. Example 2 returns columns 1 - 4 with commas separating them. Example 3 has spaces between the columns. The last statement closes the spool file.

Creating list of the DB objects:

 Obtain a reference to the DBA_* views which store data dictionary information. You can get a great reference from the Platinum, Inc. web site, WWW.platinum.com I believe. DBA_* tables contain all objects as well as a whole slew of other information about the database. From these you can create any list you want. Use the spool method given above.     Received on Mon Oct 19 1998 - 07:33:52 CDT

Original text of this message

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