Solved

lpad & trim in external table

Posted on 2009-04-14
1
1,791 Views
Last Modified: 2012-05-06
Hi,

How to use trim & lpad fucntion in oracle external table?. I tried as below. It didn't work.

thanks
victor
CREATE TABLE diff
    (plan_ctry                      VARCHAR2(3),
    division                       VARCHAR2(2))
  ORGANIZATION EXTERNAL (
   DEFAULT DIRECTORY  DPR_DATA_DIR
    ACCESS PARAMETERS(RECORDS DELIMITED BY NEWLINE
BADFILE DPR_LOG_DIR:'diff.bad'
DISCARDFILE DPR_LOG_DIR:'diff.dsc'
LOGFILE DPR_LOG_DIR:'diff.log'
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
    (plan_ctry CHAR,                     
    division  CHAR "LPAD(TRIM(:DIVISION), 2, '0')"
  ))
   LOCATION (
    DPR_DATA_DIR:'ZISCFUOG1.CSV'
   )
  )
   REJECT LIMIT UNLIMITED
/

Open in new window

0
Comment
Question by:victory_in
1 Comment
 
LVL 47

Accepted Solution

by:
schwertner earned 500 total points
ID: 24141070
I will suggest this when you read from the table

SELECT plan_ctry , LPAD(TRIM(:DIVISION), 2, '0') FROM diff;
0

Featured Post

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle Public Synonyms and Privileges 2 65
Oracle 12c database link between pdb not working 20 74
Create table from select - oracle 6 38
Oracle - SQL Parse String 5 34
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

770 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