Home » SQL & PL/SQL » SQL & PL/SQL » Can External Tables Contain a WHEN Clause
Can External Tables Contain a WHEN Clause [message #10960] Wed, 25 February 2004 11:58 Go to next message
Mike
Messages: 417
Registered: September 1998
Senior Member
I need to eliminate a transaction type from an external table definition.  The Transaction type is in column 1 of the flat file and 1 record type does not conform to the others.  Is it possible to include a WHEN clause or something like the following:

   WHEN tran_type = '2'

for this sample what would the syntax and placing of the clause be:

CREATE TABLE x_temp
  (tran_type                             CHAR(1),
   state                                    CHAR(4),
   negative_ind                          CHAR(1)
  )
  ORGANIZATION EXTERNAL
    (TYPE                                ORACLE_LOADER
     DEFAULT DIRECTORY                   x_input
     ACCESS PARAMETERS
       (RECORDS                          DELIMITED BY NEWLINE
        BADFILE                          bad_dir:'xbad.bad'
        LOGFILE                          log_dir:'xlog.log'
        FIELDS
          (tran_type                     POSITION(1:1) CHAR(1),
           state                           POSITION(2:5) CHAR(4),
           negative_ind                  POSITION(137:137) CHAR(1)
          )
       )
     LOCATION                            ('xinput.txt')
    )
  REJECT LIMIT UNLIMITED;
Re: Can External Tables Contain a WHEN Clause [message #10982 is a reply to message #10960] Fri, 27 February 2004 03:11 Go to previous messageGo to next message
Frank Naude
Messages: 4579
Registered: April 1998
Senior Member
Hi,

Yes, you can. Add the following line to the ACCESS PARAMETERS section:

LOAD WHEN ( tran_type = '2' )


Best regards.

Frank
Re: Can External Tables Contain a WHEN Clause [message #10985 is a reply to message #10982] Fri, 27 February 2004 04:17 Go to previous message
Mike
Messages: 417
Registered: September 1998
Senior Member
Excellent Frank.

Thanks for your help
Previous Topic: DBMS_JOB not working.
Next Topic: Change default bin directory of oracle to another for com
Goto Forum:
  


Current Time: Fri Apr 26 23:42:41 CDT 2024