External Tables using SYSDATE

It's possible to use the external table with SYSDATE? Here is the create external table syntax I am using and it's not working.
create TABLE T_MASTER_EXT
CUSTOMER_NAME          VARCHAR2(255),
AUDIT_TIMESTAMP          DATE
organization external
type oracle_loader
default directory MY_DIRECTORY
access parameters
records delimited by newline
skip 1
fields terminated by ','
OPTIONALLY ENCLOSED BY '"'
lrtrim
missing field values are null
(CUSTOMER_NAME,
AUDIT_TIMESTAMP DATE SYSDATE))
location ('customers.csv')
reject limit unlimited;
Thank you.
H

Well, this discussion is rather academic since there is no facility to supply a virtual column with a default value of SYSDATE or anything else in an external table, but as I understand it "oracle_loader" external tables currently work like this:
1. You issue a query against an external table
2. The database starts an external loader process to open and read the file
3. The loader process parses the file contents and returns the results to your query.
Possibly I have oversimplified, but I just don't see where "The SYSDATE changes when the table is written" comes in. What process is this?
PS:
@VG - this thread would be a lot easier to read for those of us with small monitors if you could make that AskTom link a bit shorter ;)

Similar Messages

  • Can we take backup of external table using expdp

    Can we take backup of external table using expdp, please suggest any doc.
    thanks in advance.

    @Fahd
    About the ACCESS_METHOD parameter
    -It's undocumented data pump parameter and it's should be used only when requested by Oracle Support
    -It's purpose is to specify the loading/unloading method, not filtering object types during the export or import
    -If this parameter is not specified,the Data Pump will automatically choose the best method to load or unload the data...
    so,
    the External Tables method
    -Is used by the data pump if data cannot be moved in the default method to load/unload data ,
    and that is direct path mode, or if there is a situation where parallel SQL can be used to speed up the data move even more

  • Problem with External Table using ORACLE_INTERNAL TYPE in 9i release 2

    Hi,
    I have tried to create an external table in oracle 9i release 2 using the following qurey:
    CREATE TABLE emp_ext
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_INTERNAL
    DEFAULT DIRECTORY admin_dat_dir
    LOCATION(admin_dat_dir:'emp1.dmp')
    PARALLEL
    AS
    SELECT * from employees;
    and getting the following error message
    ORA-30657: operation not supported on external organized table
    Please help me.
    Thanks in Advance

    As a matter of fact oracle 9i has two types of api for external tables one is oracle_loader and the other is oracle_internal which in 10g become oracle_datapump.
    What my question is how can I use the other type in case of external table as we are doing in 10g? Do I need to run any script to enable this feature or is there any privillege issue?
    I've given the read, write privillege to the user and the oracle user has read/write permission in os level on the location of the directory.

  • External Tables using Discoverer

    I am mapping the contents of a complex query to an external table. I am mapping the SUM() of each field to the external table. BUT... when I create a workbook using that complex folder, Discoverer correctly uses the external table but when I look at the actual query that is generated it performs a 'GROUP BY' on the the summary table (i.e my external table) prior to doing the query that I originally wanted.
    This is different than if Discoverer was managing the summary table. A very simple example is:
    External Table Query
    SELECT
    SUM(alias_avar)
    FROM
    (select id, SUM(avar) alias_avar
    FROM
    summarytable
    group by id)
    Discoverer Managed
    Select SUM(avar) from summarytable
    Thank you in advance for helping me with any ideas or workarounds.
    Mike

    Just a word...I have had NO LUCK with Oracle9i external tables accessing network drive with Windows Server 2003 spk1.
    I have read all the tips from Metalink and forums and nothing that works on Windows 2000 or NT work for 2003..Has anyone had any luck with this?
    UNC or mapped letters..The best I could do was GIVE EVERYPERMISSION and create a SUPER users with ALL groups and still then all external tables could do was move it to the error folder with a OS errors saying it could not open the file. I have the same setup locally and it opens fine.
    In fact UNC was the only way I could even touch the files..mapped drive letter did nothing ...

  • Accessing The External Table using UIAPI and DIAPI

    Hi  Every One,
    can any one tell me about , can we access the external table data  that is created by using sql query externally using UIApi and DIAPI
    Regards
    Srinivas

    Hi,
    technically is it possible, but all inserts and updates have to be through query.
    Note, that when you create tables from sdk, you can set more informations about fields than in sql query manager (for example subtype) - so you may have problem in binding data to matrix for example. So if you have table externally, you may work with, but this isn`t allowed by SAP (and I think that this case may be dangerous if you acces it in sdk). If you need to acces it on sql server side (own numbering, some stored procedure, ..) it will works safer, but it is not allowed as well.
    Petr

  • Sqlldr flat file to external table using shell scripts

    Hi,
    Has anyone done this before? Please give me a hand.
    Thanks!

    Thanks Justin.
    When do I need to create the external table EMP_STAGING ?
    These are my steps so far:
    - shell script to crate the flat file (but I need to change the table name to EMP_STAGING)
    - use a script to call sqlldr to load the flat file into the external table
    - then the script will call the MERGE sql script to merge the data from the external table into the database table
    Am I on the right track?
    In which stage should I create and drop the external table?
    Thanks!

  • Short Dump while acessing external tables using DB Connect

    Hello SDN'rs,
    I am getting Short dump (below) when i am trying to look into the table contents using DB Connect.
    Please let me know how to resolve this problem. Is there any OSS Note on this??
    External Database is Oracle; i can look into other tables.
    ShrtText
    Syntax error in program "GP_CREATE_STRUCTURE_DBCON_026 "
    |What happened?                                                                                |
    |    Error in ABAP application program.                                                            |
    |                                                                                |
    |    The current ABAP program "CL_RS_STRUC===================CP" had to be                         |
    |     terminated because one of the                                                                |
    |    statements could not be executed.                                                             |
    |                                                                                |
    |    This is probably due to an error in the ABAP program.                                         |
    |                                                                                |
    |    In program "GP_CREATE_STRUCTURE_DBCON_026 ", the following syntax error                       |
    |     occurred                                                                                |
    |    in the Include "GP_CREATE_STRUCTURE_DBCON_026 " in line 5:                                    |
    |    "Type "D" can only have the length specification "8" or no length speci"                      |
    |    "fication at all."                                                                            |
    |    " "                                                                                |
    |    " "                                                                                |
    |                                                                                |
    |    Author and last person to change the Include are:                                             |
    |    Author "XYZ "                                                                            |
    |    Last changed by "XYZ
    |Error analysis                                                                                |
    |    In program "GP_CREATE_STRUCTURE_DBCON_026 ", the following syntax error                       |
    |     occurred:                                                                                |
    |    "Type "D" can only have the length specification "8" or no length speci"                      |
    |    "fication at all."                                                                            |
    |    " "                                                                                |
    |    " "                                                                                |
    Trigger Location of Runtime Error                                                                 |
    |    Program                                 CL_RS_STRUC===================CP                      |
    |    Include                                 CL_RS_STRUC===================CM002                   |
    |    Row                                     108                                                   |
    |    Module type                             (METHOD)                                              |
    |    Module Name                             CREATE    
    Thanks,
    Faizee B

    When i tried today for the same table i am getting the shortdump description(below), I have noticed that the number have changed from 026 to 055, any thoughts why it happen and how it can be resolved?
    In program "GP_CREATE_STRUCTURE_DBCON_055 ", the following syntax error                      
    occurred in the Include "GP_CREATE_STRUCTURE_DBCON_055 " in line 5:                                   
        "Type "D" can only have the length specification "8" or no length specification at all."                                                                               
    Thanks,
    Faizee B

  • Rename table using sysdate!

    I have a statement : rename AA_QISATE_INFO_PROCESSLOG to AA_QISATE_INFO_PROC20090805
    This statement is present in .sql file which is having 50 other statements
    I want to rename a table with to AA_QISATE_INFO_PROC<sysdate>. I do not want to hardcode date value at the end of table name.

    user12133658 wrote:
    Hi BluShadow .. why is this scary? sorry for being a 'noob', but I have a table, suppose, CurrentData and I rename it to FY09Data and create a new CurrentData, now empty. Is that bad? Please explain.And the users use the application with your new blank CurrentData, but then a couple of months down the line they say... "we really need to be able to see last years data". What do you do? Are you going to copy all the data from your "archive" into the CurrentData? What if the table structure has changed since due to an application/database upgrade and the table structures don't match? Oooo, that's going to get messy. What about changing the application to read archives of data? But that means that the queries would have to be dynamic to cope with dynamic table names that perhaps didn't exist when the application was created. All in all, table names should not be based on changing values such as times or dates.
    Now, if it was a partitioned table, the data can still remain in the same table and the partitions would ensure that performance is maintained because you would have partitioned in such a way that previous partitions of data are seperate from the current data. If an application change requires a structural change to the table it will apply to all old data too, and, if the users need to get back to the old data for whatever reason, it's already there. Then, when the data is confirmed as "no longer needed" the partition can simply be dropped... no deletion performance issues on millions of records.

  • How to use remote directory for external table

    Hi Folks,
    I have 2 Oracle 11GR2 64 bit database installed on Win 2008 server as prod1 and prod2.
    I have one directory created on prod1 server as EXT_TAB_DIR using the path as D:\OrsDWtest_dir .
    I want to use this directory in Prod2 server and use external table using this remote directory.
    I am able to access the Prod1 directory from Prod2 machine and also i have created Network map drive as Z drive pointing to that prod1 D:\OrsDWtest_dir directory. Also i checked read and Write permissions are there . I am able to create the external table but when i try to fetch the data i m getting below error ..
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file IOMM_20121213_060736.csv in EXT_TAB_DIR not found
    now my doubt is this possible ? Can we use remote directory for External table ? or is there is there any alternative way to achieve same ?
    Thanks & Regards,
    Vikash Jain(DBA)

    could you confirm the name and the existence of this file "IOMM_20121213_060736.csv" ?
    same error like:
    http://www.oracle-base.com/articles/9i/external-tables-9i.php
    if the load files have not been saved in the appropriate directory the following result will be displayed.
    SQL> SELECT *
      2  FROM   countries_ext
      3  ORDER BY country_name;
    SELECT *
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file Countries1.txt in EXT_TABLES not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1Edited by: Fran on 10-ene-2013 23:32

  • Accesing windows files using oracle unix external tables.

    Hi, I'm trying to access files on windows2k using oracle external tables on unix:
    Oracle server on unix: oracle ver. is 9.2.0.6 and OS is 5.8 Generic_117000-03 sun4u sparc SUNW,Sun-Fire
    1. Created dir object on oracle unix pointing to windows path
    2. created user
    3. Assigned read and write privs on dir to user
    4. created external table using dir step 1
    5. select on external table
    When I FTP the files into unix and recreate dir object, it works, but if I point dir object into windows path, it fails.
    Is possible to do this?
    Tks
    GAP

    Hi
    The directory object must be accesible to your Database server, so if the Database is in unix you must create the directory in unix.
    I don´t know software that allow unix systems to see a windows file system. Maybe windows can see unix from a samba server or NFS.

  • How to use External Tables

    Hi, I want to know how to use external tables? The procedure i follow for SQL*Loader in my shell script is:
    Call the sqlldr
    Check return code
    If return code = 2. get count of records from bad file and exit.
    If return code != 0 and != 2 then exit as fatal error
    If return code = 0 then continue.
    But i don't understand how to use external table as it is not invoked and does not have a return code.

    Hello,
    What do you mean alogrithim, do you mean to invoke external table as you invoke sqlldr? You can generate external table script from sqlldr and use it to load data but you might have to modify the table name and datafile name . You can see if any bad file generated from sqlldr and if yes then you can generate external table (using sqlldr) or based on your bad file. May be if you can list what exactly you want in bullet points, then it will be easier to suggest you.
    Regards

  • Error while querying the external tables in 9i

    i am working on a project on Oracle 9iR2 on Linux AS 3.0, i am in urgent need to port my data in text files for using in the DB
    I have created an external table using the following script. While executing a query it gives the following error. Pls Hlp
    create table ap_info_ex
         (ser_no number(7),
         no_of_sps number(1),
         hpy_liq_mm number(2),
         rmp_rnk_cd number(1),
         ir number(3),
         dps_flg varchar2(1))
    organization external
    (type oracle_loader
         default directory aps_jul
         access parameters (records delimited by newline
                        fields terminated by ","
                        (sno char,
                        no_sps char,
                        hpy_mm char,
                        rmp_rnk char,
                        ir char,
                        dpsflg char))
    location ('info.txt'));
    Table has been created successfully
    but when i execute a query say
    select * from ap_info_ex;
    THIS IS THE ERROR MESSAGE I AM GETTING
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04063: unable to open log file AP_INFO_EX_6151.log
    OS error Permission denied
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    hope you would help me. i am greateful for that.

    Arun,
    Here are the things you could do.
    1. You may want to specify a logfile in your access parameters using the command 'logfile'.
    For example,
    logfile 'info.log'. You could create the file in advance and provide appropriate permissions to the operating system user(In unix, I use the commands 'touch' and 'chmod').
    2. You could specify the command
    'NOLOGFILE' in your access parameters.
    3. Provide permissions for the user to create files in the folder associated with the directory object 'aps_jul'.

  • Error while selecting from view that references external table

    Can someone explain why the error near the bottom of the code below is occuring? If USER1 grants SELECT on the external table to USER2, then USER2 can select from the view without any problems; however, I want to avoid giving USER2 access to all of the columns in the external table. (I only want to give USER2 access to two of the four columns.)
    SQL> CONNECT sys AS SYSDBA
    Connected as SYS@ as sysdba
    SQL> CREATE USER user1 IDENTIFIED BY user1
    User created.
    SQL> CREATE USER user2 IDENTIFIED BY user2
    User created.
    SQL> GRANT CONNECT, CREATE TABLE, CREATE VIEW TO user1
    Grant complete.
    SQL> GRANT CONNECT TO user2
    Grant complete.
    SQL> GRANT READ, WRITE ON DIRECTORY EXT_DATA_DIR TO user1, user2
    Grant complete.
    SQL> CONNECT user1/user1
    Connected as USER1@
    SQL> CREATE TABLE emp_xt
      emp_id     NUMBER,
      first_name VARCHAR2(30),
      last_name  VARCHAR2(30),
      phone      VARCHAR2(15)
    ORGANIZATION EXTERNAL
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY EXT_DATA_DIR
      ACCESS PARAMETERS
        RECORDS DELIMITED BY NEWLINE
        FIELDS TERMINATED BY ','
        OPTIONALLY ENCLOSED BY '"'           
      LOCATION ('emp.txt')
    REJECT LIMIT 0
    Table created.
    SQL> SELECT COUNT(1) FROM emp_xt
      COUNT(1)
             4
    1 row selected.
    SQL> CREATE OR REPLACE VIEW emp_xt_view AS SELECT first_name, last_name FROM emp_xt;
    View created.
    SQL> SELECT COUNT(1) FROM emp_xt_view
      COUNT(1)
             4
    1 row selected.
    SQL> GRANT SELECT ON emp_xt_view TO user2
    Grant complete.
    SQL> CONNECT user2/user2
    Connected as USER2@
    SQL> SELECT COUNT(1) from user1.emp_xt_view
    SELECT COUNT(1) from user1.emp_xt_view
    Error at line 0
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    ORA-04043: object "USER1"."EMP_XT" does not exist
    SQL> CONNECT user1/user1
    Connected as USER1@
    SQL> GRANT SELECT ON user1.emp_xt TO user2
    Grant complete.
    SQL> CONNECT user2/user2
    Connected as USER2@
    SQL> SELECT COUNT(1) from user1.emp_xt_view
      COUNT(1)
             4
    1 row selected.
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    user503699 wrote:
    user1983440 wrote:
    Can someone explain why the error near the bottom of the code below is occuring? If USER1 grants SELECT on the external table to USER2, then USER2 can select from the view without any problems; however, I want to avoid giving USER2 access to all of the columns in the external table. (I only want to give USER2 access to two of the four columns.)As you have demonstrated, I guess the view approach only works for database tables. External tables are actually files on the file system. Even through OS, it is not possible to grant READ/WRITE access to only part of the file. The access is for entire file. An "External Table" is just a "wrapper" provided by oracle (using data cartridge) to allow user to be able to access the file as a "table". So it can definitely not do something that underlying OS can not do.
    p.s. In fact, oracle does not even allow to edit data in external tables using SQL.Why not just make a second external table (only including the 2 columns you need) and grant select directly on that to the user. I know you say "views only" but there's an exception to every rule ... just because it's called a table doesn't make it so. You could argue an external table is nothing more than a fancy view.
    Worst case, make a view on top of the second external table.
    CREATE TABLE emp_xt_less_information
      first_name VARCHAR2(30),
      last_name  VARCHAR2(30)
    ORGANIZATION EXTERNAL
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY EXT_DATA_DIR
      ACCESS PARAMETERS
        RECORDS DELIMITED BY NEWLINE
        FIELDS TERMINATED BY ','
        OPTIONALLY ENCLOSED BY '"'   
             emp_id      number,
             first_name  char,
             last_name   char,
             phone       char
      LOCATION ('emp.txt')
    REJECT LIMIT 0
    {code}
    Should do it, but my syntax may be off a touch ....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error when loading from External Tables in OWB 11g

    Hi,
    I face a strange problem while loading data from flat file into the External Tables.
    ORA-12899: value too large for column EXPIRED (actual: 4, maximum: 1)
    error processing column EXPIRED in row 9680 for datafile <data file location>/filename.dat
    In a total of 9771 records nearly 70 records are rejected due to the above mentioned error. The column (EXPIRED) where the error being reported doesn't have value greater than 1 at all. I suspect it to be a different problem.
    Example: One such record that got rejected is as follows:
    C|234|Littérature commentée|*N*|2354|123
    highlightened in Bold is the EXPIRED Column.
    When I tried to insert this record into the External Table using UTL_FILE Utility it got loaded successfully. But when I try with the file already existing in the file directory it again fails with the above error, and I would like to mention that all the records which have been loaded are not Ok, please have a look at the DESCRIPTION Column which is highlightened. The original information in the data file looks like:
    C|325|*Revue Générale*|N|2445|132
    In the External Table the Description Value is replaced by the inverted '?' as follows:
    Reue G¿rale
    Please help.
    Thanks,
    JL.

    user1130292 wrote:
    Hi,
    I face a strange problem while loading data from flat file into the External Tables.
    ORA-12899: value too large for column EXPIRED (actual: 4, maximum: 1)
    error processing column EXPIRED in row 9680 for datafile <data file location>/filename.dat
    In a total of 9771 records nearly 70 records are rejected due to the above mentioned error. The column (EXPIRED) where the error being reported doesn't have value greater than 1 at all. I suspect it to be a different problem.
    Example: One such record that got rejected is as follows:
    C|234|Littérature commentée|*N*|2354|123
    highlightened in Bold is the EXPIRED Column.
    When I tried to insert this record into the External Table using UTL_FILE Utility it got loaded successfully. But when I try with the file already existing in the file directory it again fails with the above error, and I would like to mention that all the records which have been loaded are not Ok, please have a look at the DESCRIPTION Column which is highlightened. The original information in the data file looks like:
    C|325|*Revue Générale*|N|2445|132
    In the External Table the Description Value is replaced by the inverted '?' as follows:
    Reue G¿rale
    Please help.
    Thanks,
    JL.sorry, couldnt see the highlighted test.could you plesae enclsoe it in  tags
    also post the table definition with attributes. BTW..Whats your NLS_LANGUAGE SET TO?

  • Create an external table based on an XML file

    Hi ,
    I am trying to create an external table based on XML file .Is it possible to do in OWB ?If Yes .Can someone please let me know the same .
    I was successfully able to create an external table based on a flat file which is of the extension *.txt.
    I was even able to load an XML file to a normal
    table .How do we do it to an external table?
    Thanks,
    Manjula

    Hello Manjula,
    Is it possible for you to spare sometime to list down the steps to be followed for creating External Table using flat file *.txt?
    I am trying to do it but not getting through it.
    Thanks in Advance,
    Ripesh

Maybe you are looking for

  • Continuous Cheque  Printing

    Dear Friends, In checks for payments screen ,I've designed a layout for cheque printing .It is printing correctly (using laser printer) when i give a print from checks for payment screen. But I want to print the cheques of a particular bank continuos

  • Comparing Top-n queries for performance

    I would like to know which version of the query is performance efficient. Query1: Using analytic functions: select * from ( select pv.vendor_name, aia.invoice_num , aia.invoice_date, aia.invoice_amount ,pvs.vendor_site_code,att.name terms *,row_numbe

  • How to set a scope for sessions

    I need to create a session to store my object in it and I need it to be avalable ONLY on the same computer!!! I have the following: jsp1 MyObject obj = (MyObject ) request.getSession().getAttribute("MyObject "); request.getSession().setAttribute("MyO

  • Ipod won't work after trying to install Paid 2.0 update

    I bought the 2.0 update for my 16 gig ipod touch. After trying to install the update through itunes half way through the update it gave me the message "The ipod could not be restored. An Unknown error occured (6)." I tried to do a restore on the ipod

  • CProjects - Approval Document Password setup

    Hi all, Can someone provide the configuration / setup that needs to be done so  that the approver (Phase Approval) does not have to type in the password when granting a phase approval. I believe it is some kind of a user certificate / SSO issue which