Solved

lpad & trim in external table

Posted on 2009-04-14
1
1,866 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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 videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

696 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