Solved

SQLLDR question

Posted on 2004-08-11
8
2,934 Views
Last Modified: 2012-06-22
I have a flat file with fixed length fields where there is no character that terminates the field.
I'm trying to set up an external table and it wants a 'field terminated by'.
What can I use here?
0
Comment
Question by:xoxomos
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 15

Expert Comment

by:jdlambert1
ID: 11777488
There's no visible printable character, but there's either a terminator or one long run-on line.
Most likely either CHR(10) for line-feed, CHR(13) for carriage-return.
0
 

Author Comment

by:xoxomos
ID: 11777556
I believe that would be more for the record(row) I'm looking more for the field(column).
0
 
LVL 15

Expert Comment

by:jdlambert1
ID: 11777596
Sorry about that. How are you currently doing it? (Which tool is giving you the error message)
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:xoxomos
ID: 11777914
Right now I'm not doing it.  I left the field delimited by out so it thinks everything is 255.



Field Definitions for table TEMP_STUDENT
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform

  Fields in Data Source:

    STU_KEY                         CHAR (255)
      Terminated by ","
      Trim whitespace same as SQL Loader
    NAME                            CHAR (255)
      Terminated by ","
      Trim whitespace same as SQL Loader
    STU_ID                          CHAR (255)
      Terminated by ","
      Trim whitespace same as SQL Loader
    BIRTH_DATE                      CHAR (255)
      Terminated by ","
      Trim whitespace same as SQL Loader
    SEX                             CHAR (255)
      Terminated by ","
      Trim whitespace same as SQL Loader
KUP-04076: file name cannot contain a path specification: d:\oracle\student_database\dwstubio
0
 

Author Comment

by:xoxomos
ID: 11778073
With sqlldr, i can use
INTO TABLE student
(
STU_KEY                    POSITION(1:10) CHAR,
NAME                       POSITION(11:42) CHAR,
STU_ID                     POSITION(43:51) CHAR,
BIRTH_DATE                 POSITION(52:59) DATE "YYYYMMDD",
SEX                        POSITION(60:60) CHAR,
and not supply field terminated by.  Trying to use external table , i don't see what the option is.
0
 
LVL 6

Accepted Solution

by:
morphman earned 250 total points
ID: 11778914
Here is an example of hwo to do it with fixed length fields:-

create table ext_table (
   field_1 char(4),
   field_2 char(30)
 )
 organization external (
   type       oracle_loader
   default directory ext_dir
   access parameters (
     records delimited by newline
     fields (
      field_1 position(1:4) char(4),
      field_2 position(5:30) char(30)
     )
   )
   location ('file')
 )
 reject limit unlimited;

All the best,
Dan
0
 
LVL 14

Expert Comment

by:leoahmad
ID: 11779250
goto http://www.softtreetech.com and download DB Tools for Oracle - and this can easily upload text files using File Loader.

LeoAhmad
0
 
LVL 14

Expert Comment

by:leoahmad
ID: 11779262
another option do it manually:

 create directory md as 'e:\q'
SQL> /

Directory created.

SQL> create table mytab(a number,b number, c varchar2(2000))
  2  Organization external
  3  (type oracle_loader
  4  default directory md
  5  access parameters
  6  (fields terminated by '')
  7  location ('1.txt')
  8  )
  9  /

Table created.

SQL> select * from mytab;
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle - SQL Where clause causing Invalid Number Error 4 46
clob to char in oracle 3 62
Deleting Rows from an Oracle Database - Performance 19 53
Help on model clause 5 37
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious sideā€¦
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question