Remove using external table data

Hello

Please could someone help me with the instruction to delete an entire row of referencing a person_id on an internal table where it corresponds to the id of the person on an external? I have the statement of updated date below, but also need to know how to remove (for the entire line, not just one column).

Update XX_SQL_LOADER_TEST SLT
Set emp_number = (SELECT emp_number from XX_EXTERNAL_TBL WHERE AND.) Person_id = HI. PERSON_id)
, emp_name = (SELECT XX_EXTERNAL_TBL emp_name AND where AND.) Person_id = HI. PERSON_id)


Thank you very much

Steve

Published by: SteveCPP on January 17, 2011 13:19

Hello

Here's one way:

DELETE     xx_sql_loader_test
WHERE     person_id     IN (
                    SELECT  person_id
                    FROM     xx_external_tbl
                  )
;

It does not matter if xx_external_tbl is an external table.

Tags: Database

Similar Questions

  • external table data with several locations pump

    Hello
    I'm on:
    Oracle Database 10 g Enterprise Edition release 10.2.0.3.0 - 64biit
    SunOS 5.10

    I am trying to create a table of data pump external at the same time, with the location of the files previously created using pump.
    This is the same as the example given in step 10-13 here:
    http://docs.Oracle.com/CD/B19306_01/server.102/b14215/et_dp_driver.htm#i1007502

    But when I do this and select all the lines in the resulting table, I get the error:

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend
    ORA-29400: data cartridge error
    KUP-11011: file / < filepath > sys_tables.dmp is not valid for this load operation
    ORA-06512: at "SYS." ORACLE_DATAPUMP', line 52

    Can anyone help?
    Here is a script of what I do...


    create the directory message_archive_dir as ' / your/path/directory "; -change default directory
    -chmod 777 your way

    create the sys_tables table
    external organization
    (type ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ("sys_tables.dmp"))
    AS
    Select object_id, object_type
    of object
    where owner = 'SYS '.
    and object_type = 'TABLE '.
    and rownum < 11;

    create the table sys_indexes
    external organization
    (type ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ("sys_indexes.dmp"))
    AS
    Select object_id, object_type
    of object
    where owner = 'SYS '.
    and object_type = 'INDEX '.
    and rownum < 11;

    Select * from sys_tables
    Union
    Select * from sys_indexes;

    -all 20 rows returned!
    -now I combine the two dmp files in a single table...

    create the table sys_objects
    (
    object_id NUMBER (14).
    object_type VARCHAR2 (30)
    )
    EXTERNAL ORGANIZATION
    (
    TYPE ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ('sys_indexes.dmp', 'sys_tables.dmp')
    );

    Select *.
    of sys_objects
    where rownum = 1;

    -ok returnes one line (one of the dmp files work)
    --Choose so all lines...

    Select *.
    of sys_objects;

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend
    ORA-29400: data cartridge error
    KUP-11011: file / < filepath > sys_tables.dmp is not valid for this load operation
    ORA-06512: at "SYS." ORACLE_DATAPUMP', line 52

    Can you see what I'm doing wrong?

    Any help is greatly appreciated!
    Thank you.

    user9969845 wrote:
    ... Etc...

    TYPE ORACLE_DATAPUMP
    THE DEFAULT DIRECTORY MESSAGE_ARCHIVE_DIR
    LOCATION ('sys_indexes.dmp', 'sys_tables.dmp')

    Combination dump files

    Files dump populated by different external tables can all be specified in the LOCATION of another external table clause. For example, data from different databases can be unloaded in separate files, and these files can then be included in an external table defined in a data warehouse. This provides an easy way to aggregate data from multiple sources. The only restriction is that the metadata for all external tables is exactly the same. This means that the game characters, time zone, schema name, table name, and column names must match. In addition, the columns must be defined in the same order, and their data types must be identical. This means that after you create the first external table you must remove it so that you can use the same table name for the second outer table. This ensures that the metadata in two dump files is the same and they can be used together to create the external table even.
    8 2

  • jump the last record loading using external table

    Hi gentlemen,

    I have a requirement to load data from text file of oracle database by using the external table. I need to remove the header records and complementary.

    I can use the skip option to remove the header, IE front-line.

    Is it possible to remove the additional record (IE last line) using the external table.


    Thanks in advance.

    Ferry

    Hello ferry.
    Do not hesitate on occasion as useful and Correct answers for those of us Newbie trying to get credibility :)

    Thank you
    Luke

  • No external table data

    I created an external table without errors, but when I try to only publish sql on the external table, there is no data. This is a subset of my data and the sql code used to create the external table. 10.2.0.2 on aix 5.2 64 bit.

    "BoxC_SL.lwl" | 106 | "" tzdpship52 "|" 1. 1. 01/28/2008 0:00:00 | 12/30/1899-09:56:03 |
    "Genshp_SL.lwl" | 106 | "" tzdpship52 "|" 1. 1. 01/28/2008 0:00:00 | 12/30/1899-09:56:04 |
    "TRLABS - 001B_600.lwl | 126. "\\Ibm1\tzsgprod63"|2|1|1/28/2008 0:00:00 | 12/30/1899-09:56:08 | "14928758" | " "89-5425, 04" | "
    "PalC_SL.lwl" | 106 | "" tzdpship52 "|" 1. 1. 01/28/2008 0:00:00 | 12/30/1899-09:56:11 |
    "SSCC_SL.lwl" | 106 | "" tzdpship52 "|" 1. 1. 01/28/2008 0:00:00 | 12/30/1899-09:56:12 |



    CREATE TABLE 'DMR '. "" LABEL ".
    (VARCHAR2 (100) "LABEL_NAME")
    NUMBER OF "PRINTER_NUM."
    VARCHAR2 (100) "PRINTER_NAME,"
    NUMBER OF "QUANTITY."
    NUMBER OF "DUPLICATES"
    DATE OF THE "PRINT_DATE."
    TIMESTAMP OF the 'PRINT_TIME. "
    'LOT' NUMBER,
    'PARTY' VARCHAR (25),
    'BATCH' VARCHAR (25),
    NUMBER OF "WONUM."
    'ITEM' VARCHAR (25)
    )
    EXTERNAL ORGANIZATION
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY 'LISTENER_LOG_DIR '.
    ACCESS SETTINGS
    (records delimited by newline
    nobadfile
    nologfile
    nodiscardfile
    fields finished by "|" lrtrim
    missing field values are null
    (
    label_name,
    printer_num,
    printer_name,
    quantity,
    duplicates,
    print_date tank (8) date_format
    mask "MM/DD/YY", the date
    print_time (8) char date_format
    "HH24:MI:SS", of the date mask
    A lot
    part,
    batch,
    wonum,
    Agenda
    )
    )
    LOCATION
    ("AUDIT_001.txt"
    )
    )
    REJECT LIMIT UNLIMITED;



    Table created.

    sys@DMRDEV > select * from dmr.labels where rownum < 10;

    no selected line

    sys@DMRDEV > select count (*) in the dmr.labels;

    COUNT (*)
    ----------
    0

    Hello

    Here go us

    SQL > drop table t11.

    Deleted table.

    SQL >
    SQL > create table t11)
    VARCHAR2 (20) 2 'LABEL_NAME. "
    NUMBER 3 "PRINTER_NUM."
    VARCHAR2 (20) 4 "PRINTER_NAME,"
    NUMBER 5 "QTY."
    NUMBER 6 "DUPLICATES."
    Date of 7 "PRINT_DATE."
    8 'PRINT_TIME"STAMP
    NUMBER 9 "BATCH."
    VARCHAR (25) 10 'PART. "
    11 'BATCH' VARCHAR (25),
    NUMBER 12 "WONUM."
    13 'ITEM' VARCHAR (25)
    14)
    15 external organization)
    16 type oracle_loader
    Default directory 17 LISTENER_LOG_DIR
    (settings) access 18
    19 records delimited by 0 x, 0 'a '.
    ' 20 fields completed by "|" possibly provided by ' "'
    21 lack of field values are null
    (22)
    23 'LABEL_NAME. "
    24 "PRINTER_NUM."
    25 "PRINTER_NAME,"
    26 "QTY."
    27 "DUPLICATES."
    28 "PRINT_DATE" DATE MM/DD/YYYY"."
    Mask of timestamp DATE_FORMAT 29 "PRINT_TIME" tank (25) "HH24:MI:SS / MM/DD/YYYY."
    30 'BATCH '.
    31 'PART. "
    32 "BATCH."
    33 "WONUM."
    34 "ITEM.
    35)
    36)
    location 37 ("holidays.txt")
    38)
    39 reject limit unlimited;

    Table created.

    SQL >

    I displays the count only since you can select query * of the t11 and check... :-)

    SQL > select count (*) of t11.

    COUNT (*)
    ----------
    5

    "' Change the data as follows:-Remove * *"

    BoxC_SL.lwl|106|tzdpship52|1|1|01/5/2008|12/30/1899 09:56:03 |
    Genshp_SL. LWL | 106 | tzdpship52 | 1 | 1: 01/28/2008: 12/30/1899-09:56:04 |
    PalC_SL.lwl|106|tzdpship52|1|1|1/28/2008|12/30/1899 09:56:11 |
    SSCC_SL. LWL | 106 | tzdpship52 | 1 | 1 | 1/28/2008: 12/30/1899-09:56:12 |
    TRLAB-001B_600.LWL|126|\\Ibm1\tzsgprod63|2|1|1/28/2008|12/30/1899 09:56:08 | 14928758 | 89 - 5425.04 |

    Satisfied... Answer question correct... ;-)

    -Pounet

  • How do I get the number of incorrect records when you use external tables

    Hi all, I have an external table DEPT,.

    DEPT. DAT

    20. ELECTRONICS

    10. SHOES

    30. CAMERA

    Select * from the Department; only 10 and 30 dept will be led as deptdescr for 20 that there are more than 10 in length so this record will go into the wrong file,

    y at - it count any query to display the folder or get any query to get the record to view the entries entries wrong file rather that will drop and see how much is rejected.

    Table:

    CREATE TABLE DEPT
    (
       DEPT        NUMBER,
       DEPTDESCR   VARCHAR2 (10 CHAR)
       )           ORGANIZATION EXTERNAL
      (  TYPE ORACLE_LOADER
         DEFAULT DIRECTORY BATCH_INBOX
         ACCESS PARAMETERS
           ( RECORDS DELIMITED  BY '\r\n'
                  BADFILE  BATCH_BAD:'UPS_DEPT_LOAD_%p.bad'
                  LOGFILE  BATCH_LOG:'UPS_DEPT_%p.log'
                  NODISCARDFILE
        FIELDS  TERMINATED BY '|'
        MISSING FIELD VALUES ARE NULL
    (
    DEPT,
    DEPTDESCR
    )
                                    )
         LOCATION (BATCH_INBOX:'DEPT.DAT')
      )
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;
    

    You can use the wrong file as the data file for another external table, with the entire line in a single field.  Please see the demo below.

    Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_inbox AS 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_bad AS 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > CREATE or REPLACE DIRECTORY batch_log AS 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > CREATE TABLE DEPT

    2       (

    NUMBER 3 DEPT,

    4 DEPTDESCR VARCHAR2 (10 CHAR)

    (5) ORGANIZATION EXTERNAL

    6 (TYPE ORACLE_LOADER

    7 DEFAULT DIRECTORY BATCH_INBOX

    8 ACCESS SETTINGS

    9 (RECORDS DELIMITED BY "\r\n"

    10 BADFILE BATCH_BAD: 'UPS_DEPT_LOAD.bad'

    11 BATCH_LOG:'UPS_DEPT_%p.log LOGFILE'

    12 NODISCARDFILE

    13 FIELDS TERMINATED BY ' |'

    14 MISSING FIELD VALUES ARE NULL

    15       (

    DEPT 16,

    17 DEPTDESCR

    18       )

    19                       )

    LOCATION 20 (BATCH_INBOX:'DEPT.) DAT')

    21         )

    RELEASE 22 UNLIMITED LIMIT

    23 NOPARALLEL

    24 NOMONITORING;

    Table created.

    Scott@orcl12c > SELECT * FROM dept

    2.

    DEPTDESCR DEPT

    ---------- ----------

    10 SHOES

    CAMERA 30

    2 selected lines.

    Scott@orcl12c > CREATE TABLE DEPT_bad

    2       (

    3 the_whole_row VARCHAR2 (4000)

    (4) ORGANIZATION EXTERNAL

    5 (TYPE ORACLE_LOADER

    6 DEFAULT DIRECTORY BATCH_INBOX

    7 ACCESS SETTINGS

    8 (RECORDS DELIMITED BY "\r\n"

    9 NOLOGFILE

    10 FIELDS TERMINATED BY '\r\n '.

    11. THE MISSING FIELD VALUES ARE NULL

    12       (

    13 the_whole_row CHAR (4000)

    14       )

    15                       )

    16 RENTAL (BATCH_BAD:'UPS_DEPT_LOAD.) THE BAD ")"

    17         )

    RELEASE 18 UNLIMITED LIMIT

    19 NOPARALLEL

    20 NOMONITORING

    21.

    Table created.

    Scott@orcl12c > SELECT * FROM dept_bad

    2.

    THE_WHOLE_ROW

    --------------------------------------------------------------------------------

    20. ELECTRONICS

    1 selected line.

  • External table - date for 20120802032917000 mask

    Hello

    I have a flat file (separator: tab), which has value of date as 20120802032917000 and I try to use the external table but not return all values below. What I am doing wrong.

    create the table xtern_bond_issue_data
    (
    issuelastUpdatedTime timestamp
    )
    external organization
    (
    the default directory xtern_bond_issue_data_dir
    access settings
    (
    records delimited by newline
    BadFile xtern_bond_issue_data_dir: 'xtern_bond_issue_data.bad'
    xtern_bond_issue_data_dir log file: 'xtern_bond_issue_data.log'
    jump 1
    fields terminated by '\t '.
    MISSING FIELD VALUES ARE NULL
    (
    issuelastUpdatedTime TANK (17) DATE_FORMAT TIMESTAMP MASK "YYYYMMDDHHMISSSSS".
    )
    )
    location ("AMER_20120702_BOND_ISSUE.dat")
    )
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    ;

    Thank you
    Kalai

    Hi, Kalai,

    951307 wrote:
    ... issuelastUpdatedTime TANK (17) DATE_FORMAT TIMESTAMP MASK "YYYYMMDDHHMISSSSS".

    I think the desired format is

    YYYYMMDDHH24MISSFF
    

    JACKY is the number of seconds since the start of the day : 17000 seconds after the beginning of a day is 04:43:20. You probably wouldn't SSSSS if you also use HH (or HH24) or MI.
    If 17000 means 17,000 seconds since the start of the minute , then use SSFF. FF is for the fractional part of the second, no matter how many numbers that is.

  • How to load data from matrix report in the base using ODI table data

    Hello

    How to load matrix report data in the base table data using oracle Data Integrator?

    Description of the requirement:

    This is the data from matrix report:
    JOB                       DEPT10                DEPT20  
    ___________________________ _____________
    ANALYST                                           6000
    CLERK                   1300                     1900 
    Need to convert it to the format below:
    JOB                             Dept                        Salary
    _____________________________________________
    ANALYST                  DEPT10      
    ANALYST                  DEPT20                     6000
    CLERK                       DEPT10                    1300
    CLERK                       DEPT20                    1900
        
    Thank you for your help in advance. Let me know if any other explanation is needed.

    Your list seems to be a bit restrictive, you can do much more with the procedures of ODI.

    If you create the new procedure and add a step. In the 'source' tab command you define technology and pattern according to your source database. Use the unpivot operator as described in the link, please, instead of using "SELECT *' use the column names and aliases for example:"

    SELECT workstation,
    deptsal as deptsal,
    saldesc as saledesc
    OF pivoted_data
    UNPIVOT)
    deptsal-<-->
    FOR saldesc-<-->
    IN (d10_sal, d20_sal, d30_sal, d40_sal).<-->
    )

    Then in your tab 'command on target' defined technology and drawing on your target db, then put your INSERT statement for example:

    INSERT INTO job_sales
    (employment,
    deptsal,
    saledesc
    )
    VALUES
    (
    : job,.
    : deptsal,.
    : saledesc
    )

    That's why you use bind variables from source to load data into the target.

    Obviously if the source and target table is in the same database, you can have it all in a single statement to the "command on target' as

    INSERT INTO job_sales
    (employment,
    deptsal,
    saledesc
    )
    SELECT workstation,
    deptsal as deptsal,
    saldesc as saledesc
    OF pivoted_data
    UNPIVOT)
    deptsal-<-->
    FOR saldesc-<-->
    IN (d10_sal, d20_sal, d30_sal, d40_sal).<-->
    )

    also assign the log count "Insert" on the tab corresponding to your INSERT statement, so that you know how many rows you insert into the table.

    I hope this helps.

    BUT remember that this feature is out in Oracle 11 g.

  • Load the XML file into Oracle external Table


    I load the data from the XML file into an intermediate table Oracle using external Tables.

    Let's say below, it is my XML file

    < header >
    < A_CNT > 10 < / A_CNT >
    < E_CNT > 10 < / E_CNT >
    < AF_CNT > 10 < / AF_CNT >
    < / header >
    < student >
    <>students-details
    < Student_info >
    < Single_Info >
    < ID > 18 / < ID >
    New York < City > < / City >
    < country > United States < / country >
    < Name_lst >
    < Student_name >
    Samuel < name > < / name >
    Paul < Last_name > < / Last_name >
    < DOB > 19871208 < / DOB >
    Aware of < RecordStatus > < / RecordStatus >
    < / Student_name >
    < Student_name >
    Samuel < name > < / name >
    Paul < Last_name > < / Last_name >
    < DOB > 19871208 < / DOB >

    < TerminationDt > 20050812 < / TerminationDt >
    History of < RecordStatus > < / RecordStatus >
    < / Student_name >
    < / Name_lst >
    < Personal_Info >
    <>men < / Type >
    < 27 > < / Age >
    < / Personal_Info >
    < / Single_Info >
    < / Student_info >

    < student - register >
    class < A >
    < info >
    < detail >
    < ID student > 18 < / student >
    EE < major > < / Major >
    < course-Grades >
    < course > VLSI < / course >
    < degree > 3.0 < / Grade >
    < / course-Grades >
    < course-Grades >
    < course > nanotechnology < / course >
    < degree > 4.0 < / Grade >
    < / course-Grades >
    < / details >
    < detail >
    < ID student > 18 < / student >
    THIS < major > < / Major >
    < / details >
    < / info >
    class < A >
    < Student_Enrol >
    <>students-details
    < student >

    I load this XML data file into a single table using an external Table. Could someone help me please with coding.

    Thank you

    Reva

    Could you please help me how to insert my XML content into that.

    Same as before, try a plain old INSERT:

    insert into xml_pecos

    values)

    XmlType (bfilename ('XML_DIR', "test.xml"), nls_charset_id ('AL32UTF8'))

    );

    But you'll probably hit the same limitation as with the binary XMLType table.

    In this case, you can use FTP to load the file as a resource in the XML DB repository.

    If the XML schema has been registered with the hierarchy enabled then the file will be automatically inserted into the table.

    Could you post the exact statement that you used to save the scheme?

    In the meantime, you can also read this article, I did a few years ago, it covers the XML DB features that may be useful here, including details on how to load the file via FTP:

    https://odieweblog.WordPress.com/2011/11/23/Oracle-XML-DB-a-practical-example/

    And documentation of the course: http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb06stt.htm#ADXDB4672

  • EXTERNAL TABLE ERROR

    Hello

    I use external table below script

    CREATE TABLE emp_load

    (employee_number VARCHAR2 (50))

    employee_last_name VARCHAR2 (50).

    employee_first_name VARCHAR2 (50).

    employee_middle_name VARCHAR2 (50).

    employee_hire_date VARCHAR2 (50))

    EXTERNAL ORGANIZATION

    (TYPE ORACLE_LOADER

    THE DEFAULT DIRECTORY ABC_LOAD

    ACCESS SETTINGS (FIELDS TERMINATED BY ' |')

    RECORDS DELIMITED BY NEWLINE

    FILED MISSING VALUES ARE NULL

    (employee_number VARCHAR2 (50))

    employee_last_name VARCHAR2 (50).

    employee_first_name VARCHAR2 (50).

    employee_middle_name VARCHAR2 (50).

    employee_hire_date VARCHAR2 (50))

    )

    LOCATION ("info.dat")

    ) REJECT LIMIT UNLIMITED;

    and have created a directory ABC_LOAD as 'C:\Oracle' and my os is WINDOWS 8.

    and the content of my. DAT file is

    010 | ABC | DEF | XYZ | DECEMBER 3, 2011

    but when I do select * from emp_load I get error below.

    ERROR on line 1:

    ORA-29913: error in executing ODCIEXTTABLEOPEN legend

    ORA-29400: data cartridge error

    KUP-00554: error occurred when parsing the access settings

    KUP-01005: syntax error: found 'records': expected an of: "column, locked,

    (', ltrim, lrtrim, ldrtrim, missing, notrim, possibly, rtrim, reject ")

    KUP-01007: line 2, column 9

    I use the Oracle 11 g R2 and Windows as operating system.

    Any help please.

    Thank you.

    1. in the absence of typing in the VALUES LIST FILED ARE NULL

    2 RECORDS DELIMITED BY NEWLINE must precede FIELDS TERMINATED BY ' |'

    3. There is no such SQL * Loader/external VARCHAR2 table field type (in this case, you need not even say)

    SQL > CREATE TABLE emp_load
    2 (employee_number VARCHAR2 (50))
    3 employee_last_name VARCHAR2 (50).
    4 employee_first_name VARCHAR2 (50).
    5 employee_middle_name VARCHAR2 (50).
    6 employee_hire_date VARCHAR2 (50))
    7 EXTERNAL ORGANIZATION
    8 (TYPE ORACLE_LOADER
    9 DEFAULT TEMP DIRECTORY
    10 ACCESS (PARAMETERS
    11 PRECEDED BY NEWLINE RECORDS
    12 FIELDS TERMINATED BY ' |'
    13 MISSING FIELD VALUES ARE NULL
    14 (employee_number,
    15 employee_last_name,
    employee_first_name 16,
    employee_middle_name 17,
    18 employee_hire_date)
    19         )
    20 RENTAL ("info.dat")
    (21) REJECT LIMIT UNLIMITED
    22.

    Table created.

    SQL > SELECT *.
    2 FROM emp_load
    3.

    EMPLOYEE_N EMPLOYEE_L EMPLOYEE_F EMPLOYEE_M EMPLOYEE_HI
    ---------- ---------- ---------- ---------- -----------
    010 ABC DEF XYZ DECEMBER 3, 2011

    SQL >

    SY

  • SQL * Loader vs external tables to a single file with several types of records (intercalated)

    I have a file of sample data (we will have the a 'true' at a later date and put in day after that) which includes a header, footer, and 5 types of records, that have different columns and lengths, noticed by the first two characters. The different types of records are not all together. On the contrary, some (in particular, two of these types in this example) are intertwined. I am currently working on a SQL * Loader configuration file when it was suggested that I use external tables. I know very little of either, then I would ask what is the best to use.

    Scott@orcl12c > host type test.dat

    header line

    AB, 123, efg

    CD, hij, 456

    Scott@orcl12c > type host test.ctl

    options (Skip = 1)

    load data

    in the ab table truncate where table_name = 'ab'

    fields ended by ',' trailing nullcols

    (table_name filler position (1), col1, col2)

    in the cd table add where table_name = 'cd'

    fields ended by ',' trailing nullcols

    (table_name filler position (1), col3, col4)

    Scott@orcl12c > create table ab

    2 (col1 number,

    3 col2 varchar2 (8))

    4.

    Table created.

    Scott@orcl12c > insert into ab values (1, 'old data')

    2.

    1 line of creation.

    Scott@orcl12c > create table cd

    2 (col3 varchar2 (8))

    3 col4 number)

    4.

    Table created.

    Scott@orcl12c > insert into cd values ("old data", 1).

    2.

    1 line of creation.

    Scott@orcl12c > commit

    2.

    Validation complete.

    Scott@orcl12c > host sqlldr scott/tiger control = test.ctl data = test.dat log = test.log

    SQL * Loader: release 12.1.0.1.0 - Production on Thu Mar 27 13:11:47 2014

    Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

    Path used: classics

    Commit the point reached - the number of logical records 2

    Table AB:

    1 row loaded successfully.

    Table D:

    1 row loaded successfully.

    Check the log file:

    test.log

    For more information on the charge.

    Scott@orcl12c > select * AB

    2.

    COL1 COL2

    ---------- --------

    EFG 123

    1 selected line.

    Scott@orcl12c > select * from cd

    2.

    COL3 COL4

    -------- ----------

    old data 1

    hij 456

    2 selected lines.

  • charge of the external table

    I load a file .csv to table data.
    I tried to load it using EXTERNAL TABLES

    Is there a way to specify null in the external tables loaded if the column has no data queued (CSV) external loading
    Thank you

    Do you mean?

    MISSING FIELD VALUES ARE NULL
    
  • Sqlloader Vs external Tables

    HII All,
    Currently, we use sqlloader. But now we are stuck to the top with a question. The problem is that in our production environment that they have installed customer sqlldr in the application server and the feed file in place in the Oracle server machine.

    We tried everything to stay with sqlloader but nothing works very well. I tried with ftp to transfer the file from Oracle server to the client machine, but we use the secure port it did not work.

    But this was easily accomplished using external table that the file is located in the server. But now I need to satisfy my clients by proving the external tables are relatively better.

    I have google for Sqlloader vs. external this debate.

    But I found no strong points supporting external tables.

    I had also gone through the following links

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:6611962171229

    http://www.orafaq.com/Usenet/comp.databases.Oracle.misc/2007/02/13/0222.htm

    So please help me by providing some plus points and other links.

    Concerning
    Rambeau

    792353 wrote:
    Yes, it's really a good point, but can be achieved once the data has been pumped into staging tables.

    Who would take more space on the database, while the external tables you can do anything as the data is read. External tables would seem better in this regard.

    And now, we are not concerned with all the functions for use in DEC.

    People argue with me if we use external tables, we need create objects 2 db (1 external and more temporary table) which is just 1 intermediate table if sqlloader.

    You only need the external table definition. If you create a temporary table with this depends on your needs and the need to have such a table "staged." Even if you did in SQL * Loader you would always create a staging table, if there is really no difference...

    External table = 1 table definition and no data loaded in the database
    SQL * Loader = 1 table and the data loaded into the database

    Also read that when the feed file is huge its better to opt for sqlloader as it can circumvent sql analysis by choosing a DIRECT approach. Isisnt it?

    External tables using SQL * Loader under the hood engine, so there is no real difference except where you want to keep your data (in the file, or load a copy first on the database). You can use the parallel with external tables to load using multiple threads, you can use the indicator append to load the data as in the direct approach of sql * loader.

    So, kindly suggest me which is the best approach in a long-term process.

    In the long term, the external tables are the best approach. They were introduced after SQL * Loader to provide an improved mechanism. If they were not better, Oracle would not have taken the trouble with them. They also have the advantage that the control of their use is on the database, i.e. no need to control files, no need to run a command-line utility, not two floors (loading then treatment) treatment.

    There is no real reason for the use of SQL * Loader everything but more, the strange unique circumstance where you need to download data from a client computer (which will raise the question why a client machine has data on it in the first place!)

  • How to specify a constant value in the external tables?

    Create table cp_portfolio_ext
    (
    rec_type                                                varchar2(1),
    acct_nbr                                                varchar2(23),
    acct_title                                              varchar2(50),
    prod_type_cd                                            varchar2(5),
    acct_desc                                               varchar2(35),
    country_code                                            varchar2(2),
    acct_ref_ccy_cd                                         varchar2(3),
    nom_accr_int_amt                                        number(20,4),
    ineligible_cash                                         number(20,4),
    pldg_amt                                                number(20,4),
    posn_as_of_dt                                           date,
    moody_rating                                            varchar2(5),
    sp_rating                                               varchar2(4),
    mat_dt                                                  date,
    anl_pct_rt                                              number(20,6),
    acct_pp_cd                                              varchar2(10),
    filler                                                  varchar2(229),
    process_status                                                  char(1)
    )
    Organization External
    (
    type                    oracle_loader
    default directory     TEST_DIR
    access parameters
                        (
                             records delimited by newline
                             fields
                                  (
                                  REC_TYPE                            POSITION(1:1),
                                  ACCT_NBR                            POSITION(2:24),
                                  ACCT_TITLE                          POSITION(25:74),
                                  PROD_TYPE_CD                        POSITION(75:79),
                                  ACCT_DESC                           POSITION(80:114),
                                  COUNTRY_CODE                        POSITION(115:116),
                                  ACCT_REF_CCY_CD                     POSITION(117:119),
                                  NOM_ACCR_INT_AMT                    POSITION(120:139),
                                  INELIGIBLE_CASH                     POSITION(140:159),
                                  PLDG_AMT                            POSITION(160:179),
                                  POSN_AS_OF_DT                       POSITION(180:187) DATE "DDMMYYYY" NULLIF POSN_AS_OF_DT ='00000000',
                                  MOODY_RATING                        POSITION(188:192),
                                  SP_RATING                           POSITION(193:196),
                                  MAT_DT                              POSITION(197:204) DATE "DDMMYYYY" NULLIF MAT_DT = '00000000',
                                  ANL_PCT_RT                          POSITION(205:215),
                                  ACCT_PP_CD                          POSITION(216:225),
                                  FILLER                              POSITION(226:454),
                                  process_status               
                                  )
                        )
    location('ODS_CP_DAILY_EXTRACT.DAT')
    )reject limit unlimited;
    I won't receive flow file process_status, but I would like to have a value by default "n" must be provided. How to get there? I tried to use defaultif, but it does not work it.

    I know that you donw with the CONSTANT Keywork using sqlloader. But what in external tables. ??

    Published by: 792353 on September 30, 2010 21:21

    I think it should useful to you

    http://Jiri.WordPress.com/2010/03/29/Oracle-external-tables-by-examples-part-4-column_transforms-clause-load-CLOB-BLOB-or-any-constant-using-external-tables/

    Iqbal

  • Facing many problems on the creation of directory and an external Table

    Question:

    The strange thing is that if you look at the question 10-b page 3-41, it says:
    (page 3-41 "Oracle Database 10g SQL Fund. II Vol.1")

    Merge the data into the EMP_DATA table that is created in the lab last in the data in the table emp_hist. assume
    EMP_DATA external table data corresponds to the EMP_HIST of table, update the email column
    table EMP_HIST to match the row in the EMP_DATA table. If a row in the EMP_DATA table is not
    match, to be inserted in the tables of EMP_HIST lines are considered as corresponding whenever his first and
    family name are the same.

    For me, this issue is built wrong. First of all in the last lab we have not been asked to create EMP_DATA. Secondly, EMP_DATA is empty.
    Thirdly, this question asks us to merge into the table EMP_HIST while EMP_DATA is empty.

    Table EMP_HIST currently copied data from the employees table. Structure EMP_HIST:

    FIRST NAME VARCHAR2 (20)
    LAST_NAME NOT NULL VARCHAR2 (25)
    EMAIL NOT NULL VARCHAR2 (45)

    Anway, I did the merger as follows:

    merge into e emp_hist
    with the help of emp_data d
    on (e.first_name = d.first_name)
    When matched then
    game update
    Select = d.last_name,
    e.email = d.email
    When not matched then
    Insert values (d.first_name, d.last_name, d.email);

    I get this error:

    Error report:
    SQL error: ORA-29913: error in executing ODCIEXTTABLEOPEN legend
    ORA-29400: data cartridge error
    KUP-04040: file emp.dat in EMP_DIR not found
    ORA-06512: at "SYS." ORACLE_LOADER', line 19
    29913 00000 - "error in the execution of %s legend".
    * Cause: The execution of the specified legend caused an error.
    * Action: Examine the error messages take appropriate measures.

    On the other hand, I said I'm going to try this:

    merge into emp_data d
    using e emp_hist
    on (d.first_name = e.first_name)
    When matched then
    game update
    d.last_name = select,
    d.email = e.email
    When not matched then
    Insert values (e.first_name, select, e.email);

    I get this error because the external table is final once its creation is as far as I know:

    Error report:
    SQL error: ORA-30657: operation not supported on external organized table
    30657.0000 - "operation not supported on external-organized table".
    * Cause: User attempted on the operation on an external table which is
    not supported.
    * Action: Don't do that!

    **********************************

    I don't know what to do. I did my best, please help.

    Published by: user11164565 on July 27, 2009 02:43

    user11164565 wrote:
    NOTE: I did my best, I've done everything I can do, but the problem persists. Help, please

    I'll mention all the steps that I made it clear...

    I gave scott the following grants:

    grant create any directory Scott;
    grant read on the directory emp_dir to scott;

    -----------------------

    1. create a directory and its been created successfully:

    create or replace directory emp_dir
    like 'F:\emp_dir ';

    Then I made just to make sure that my directory is recognized the following:

    SELECT *.
    OF dba_directories;

    I found the drive among the results...

    OWNER NOM_REPERTOIRE
    ------------------------------ ------------------------------
    DIRECTORY_PATH
    --------------------------------------------------------------------------------
    SYS EMP_DIR
    F:\emp_dir

    SYS SUBDIR
    D:\oracle\product\10.2.0\db_1\demo\schema\order_entry\/2002/Sep

    SYS XMLDIR
    D:\oracle\product\10.2.0\db_1\demo\schema\order_entry\

    ----------------------
    2. I created an external table emp_data (the script is given by the text book): successfully done

    drop table emp_data;

    CREATE TABLE emp_data
    (first name VARCHAR2 (20))
    , last_name VARCHAR2 (20)
    , email VARCHAR2 (30)
    )
    EXTERNAL ORGANIZATION
    (
    TYPE oracle_loader
    Emp_dir default DIRECTORY
    ACCESS SETTINGS
    (
    RECORDS DELIMITED BY NEWLINE CHARACTERSET US7ASCII
    NOBADFILE
    NOLOGFILE
    FIELDS
    (first name POSITION (01:20) TANK)


    , last_name POSITION (22:41) TANK
    CHAR POSITION (43:72) by email)
    )
    LOCATION ('emp.dat'));

    --------------------------------

    3. I went to drive F:\ to see if emp_dir file exist or not! I did not see it. I checked the files hidden, nothing. Anyway, I ignored and did step 4.

    "Anyway, I ignored him... "

    and so the rest of your problems. I do not see in the steps you told that acually you created a directory ("folder") named "\emp_dir" on your f: drive. Anything that you create the database will actually create this directory on the operating system. Uttering a directory in Oracle, uttering an external table in Oracle, don't create pointers to Oracle objects will assume just actually exists.

  • Table data type

    Is there any equivalent data type to create a table inside a stored procedure or a package, and the table is only valid in the stored procedure or package.
    Something like this [http://www.developer.com/db/article.php/3414331/Using-the-Table-Data-Type-in-SQL-Server-2000.htm] what we have in sql server.

    I'm pretty new in Oracle world.

    Any help will be much appreciated.

    Thanks in advance.

    Yes... You can declare a record type in the package body

    TYPE rec_type () IS RENDERING
    NUMBER of col1,
    col2 VARCHAR2 (2 CHAR)
    ....
    );

    then simply declare a type of table top the record type

    TYPE tab_type IS TABLE OF THE rec_type;

    You can make statements within the body to keep it private, or in the spec to make it public

    It could be that useful...

Maybe you are looking for