Solved

lpad & trim in external table

Posted on 2009-04-14
1
1,778 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

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…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now