How to import from CSV file into INTERVAL DAY TO SECOND column?

Hello,
I need to import data from a csv file that has a column that stores time-intervals (e.g. 2:06:02 Hours:Minutes:Seconds) into a table column INTERVAL DAY TO SECOND.
Does any of you know what format I should apply?
I tried HH:MI:SS but it didn't work.
Any suggestion is welcomed (including changing the column type to something else that might hold time-intervals in it....).
Thanks,
Andrei

Andrei,
There is no native support for the INTERVAL datatype in the Text loading facilities of Application Express.
To work around this known limitation, I suggest either creating a temporary table or a shadow column in your existing table. You could then upload your data for the interval as a VARCHAR2 and then use SQL to convert to an appropriate interval value.
For example:
1) Create a table with:
create table foo (id number primary key, i interval day to second, shadowi varchar2(4000) )2) Using your sample data set, load this data into table FOO, loading the second column of this data into column SHADOWI
1     01:06:02
2     02:06:02
3     03:01:013) Issue the following SQL to convert the value in your shadow interval column to your actual interval column
update foo set i = to_dsinterval( '0 ' || shadowi )Note that you'll need to prepend the '0' to formulate a valid interval literal value.
Joel

Similar Messages

  • How to import an .csv file into the database?

    and can we code the program in JSP to import the.csv file into the database.

    It is better to use Java class to read the CSV file and store the contents in the database.
    You can use JSP to upload the CSV file to the server if you want, but don't use it to perform database operations.
    JSPs are good for displaying information on the front-end, and for displaying HTML forms, there are other technologies more suitable for the middle layer, back end and the database layer.
    So break you application into
    1) Front end - JSPs to display input html forms and to display data retrieved from the database.
    2) Middle layer - Servlets and JavaBeans to interact with JSPs. The code that reads the CSV file to parse it's contents should be a Java Class in the middle layer. It makes use of Java File I/O
    3) Database layer - Connects to the database using JDBC (Java Database Connectivity), and then writes to the database with SQL insert statements.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Keeping the above concepts in mind, first build a simple JSP and get it to work,
    then research on Google , for Java File I/O , discover how to read a file,
    Then search on how to readh a CSV file using Java.
    After researching you should be able to read the CSV file line by line and store each line inside a Collection.
    Then research on Google, on how to write to the database using JDBC
    Write a simple program that inserts something to a dummy table in the database.
    Then, read the data stored in the Collection, and write insert statements for each records in the collection.

  • Import from csv file into a oracle database

    Hi,
    like i wrote in the subject i want to import some data from a csv file
    and transform it into a database.
    Its a simple setup,
    - FA which reads with a self defined schema from a physical path
    - Receive activity which creates an instance
    - transform activity
    - invoke which invokes the database adapter to fill a single table
    - deploy it to a application server
    I cant get it done.
    What i achieved is to fill the table with one set (one row of the csv file),
    but the other rows are untouched.
    Does somebody know where i have to look for some errors.
    The Auditing tool from the app server shows no errors.
    I could also provide some screenshots.
    Any help would be appreciated, i am really desperate :(
    Thanks in Advance
    Sven Richter

    Hi
    1) Is the File Adapter reading the correct number of lines in the csv file?
    2) If yes, after the transformation, how many lines are there in the resulting variable?
    Solutions:
    1) If the FA is not reading all lines, the problem for sure is the XSD you are using. The XSD must define an element which must occurs many times. You do this using a correct XSD construction with the "maxoccurs=unbounded" atribute.
    2) If the problem is with the transformation activity, you shoud use "for each" xsl node, otherwise the transformation just pick one line.
    []´s
    Menezes

  • How to import a CSV file into Appleworks

    Does anybody knows? I tried using ASCII format (everything goes into one cell), Excel (not recognized). Very fustrated, I can do that in 2 seconds with Excel or Open Office.
    Any help will be really appreciated, must be something really sily

    Roger, you are right. But instead of using a word processort I fixed the file with Perl (much faster in my case):
    auyan:~/Desktop josevnz$ perl -p -i -e 's#,#\t#g; s#\n#\rn#;' 401k-funds-appleworks.csv
    I have to say than Appleworks ***** big time .
    Thanks for your help, very valuable tip!

  • Importing a CSV file into AD 2012r2

    Hi Guys
    Just wondering if anyone can help, I am a newbie on scripting and finding it really difficult to understand how to import a csv file into AD
    I have created the CSV file with the following headers, see below but I am unable to write a powershell script to import them into AD which work, I have tried multiple help guides but still cannot do it for the life of me.
    Any help on this would be really appreciated 
    objectClass user
    cn Jo bloggs
    givenName jo
    sn blogs
    mail [email protected]
    sAMAccountname j.blogs
    AccountPassword Pa$$w0rd
    ChangePasswordAtLogon true
    PasswordNeverExpires false
    ou OU=staff,DC=test,DC=com

    Import-Csv C:\User.csv| %{New-ADUser -SamAccountName $_.SamAccountName `
    -UserPrincipalName $_.userprinicpalname `
    -Name $_.name `
    -Mail = $_.mail `
    -DisplayName $_.name `
    -GivenName $_.GivenName `
    -Path "OU=Test Users,DC=XXX,DC=XXX" `
    -PasswordNeverExpires $false `
    -ChangePasswordAtLogon $true `
    -AccountPassword (ConvertTo-SecureString "test41;" -AsPlainText -force) `
    -Enabled $True -PasswordNeverExpires $True -PassThru ` }
    help New-ADUser -Examples
    You can try the below sample code
    Regards Chen V [MCTS SharePoint 2010]

  • Trigger while importing from .csv file

    hey
    i am importing data from .csv file into a table called temp.
    .csv file is having column sales. the data in that also contains some empty filed or N/A or -
    sales coulmn in my table is NUMBER.
    so while importing some column are not able to import.
    how to write a trigger to eliminate '-' or 'N/A' or ' ' values from the sales column before inserting into the table

    It might be easier if the field on temp was a varchar2 field instead?
    The values entered should be loaded into this field and you can then use the trigger to test the values and convert these into numbers or nulls before inserting onto the proper data table.
    Check out the TO_NUMBER() function in SQL for info on how to convert strings to numbers.
    Regards
    Andy

  • How to read/write .CSV file into CLOB column in a table of Oracle 10g

    I have a requirement which is nothing but a table has two column
    create table emp_data (empid number, report clob)
    Here REPORT column is CLOB data type which used to load the data from the .csv file.
    The requirement here is
    1) How to load data from .CSV file into CLOB column along with empid using DBMS_lob utility
    2) How to read report columns which should return all the columns present in the .CSV file (dynamically because every csv file may have different number of columns) along with the primariy key empid).
    eg: empid report_field1 report_field2
    1 x y
    Any help would be appreciated.

    If I understand you right, you want each row in your table to contain an emp_id and the complete text of a multi-record .csv file.
    It's not clear how you relate emp_id to the appropriate file to be read. Is the emp_id stored in the csv file?
    To read the file, you can use functions from [UTL_FILE|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#BABGGEDF] (as long as the file is in a directory accessible to the Oracle server):
    declare
        lt_report_clob CLOB;
        l_max_line_length integer := 1024;   -- set as high as the longest line in your file
        l_infile UTL_FILE.file_type;
        l_buffer varchar2(1024);
        l_emp_id report_table.emp_id%type := 123; -- not clear where emp_id comes from
        l_filename varchar2(200) := 'my_file_name.csv';   -- get this from somewhere
    begin
       -- open the file; we assume an Oracle directory has already been created
        l_infile := utl_file.fopen('CSV_DIRECTORY', l_filename, 'r', l_max_line_length);
        -- initialise the empty clob
        dbms_lob.createtemporary(lt_report_clob, TRUE, DBMS_LOB.session);
        loop
          begin
             utl_file.get_line(l_infile, l_buffer);
             dbms_lob.append(lt_report_clob, l_buffer);
          exception
             when no_data_found then
                 exit;
          end;
        end loop;
        insert into report_table (emp_id, report)
        values (l_emp_id, lt_report_clob);
        -- free the temporary lob
        dbms_lob.freetemporary(lt_report_clob);
       -- close the file
       UTL_FILE.fclose(l_infile);
    end;This simple line-by-line approach is easy to understand, and gives you an opportunity (if you want) to take each line in the file and transform it (for example, you could transform it into a nested table, or into XML). However it can be rather slow if there are many records in the csv file - the lob_append operation is not particularly efficient. I was able to improve the efficiency by caching the lines in a VARCHAR2 up to a maximum cache size, and only then appending to the LOB - see [three posts on my blog|http://preferisco.blogspot.com/search/label/lob].
    There is at least one other possibility:
    - you could use [DBMS_LOB.loadclobfromfile|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i998978]. I've not tried this before myself, but I think the procedure is described [here in the 9i docs|http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96591/adl12bfl.htm#879711]. This is likely to be faster than UTL_FILE (because it is all happening in the underlying DBMS_LOB package, possibly in a native way).
    That's all for now. I haven't yet answered your question on how to report data back out of the CLOB. I would like to know how you associate employees with files; what happens if there is > 1 file per employee, etc.
    HTH
    Regards Nigel
    Edited by: nthomas on Mar 2, 2009 11:22 AM - don't forget to fclose the file...

  • Import From CSV File statement runs forever, no error, does not finish

    Hello,
    I am trying to import a CSV file in a JAVA program, with the following statement:
    IMPORT FROM CSV FILE '/debug/testdatabase/FILE.csv'
    INTO "JOSEPH"."TEST_TABLE"
    WITH COLUMN LIST IN FIRST ROW
    RECORD DELIMITED BY '\n'
    FIELD DELIMITED BY '\t' ERROR LOG '/debug/testdatabase/file.err'
    THREADS 10
    BATCH 10000
    I have two HANA instances on different machines A and B:
    Both machines run HANA version 1.00.74.00.389160 (NewDB100_REL), while the OS is
    SUSE Linux Enterprise Server 11.1 on machine A and
    SUSE Linux Enterprise Server 11.2 on machine B.
    The statement above runs fine on machine A and the rows are imported properly from JAVA as well as when executed from HANA Studio SQL console.
    If I copy the file to machine B and try the exact same statement with the same file, it does not finish (neither from JAVA nor from HANA Studio SQL console). There is no error either. It cannot be cancelled, only a HANA restart stops the statement. Also the sample file I use has only 2 rows, and memory does not seem to be a problem.
    I seem to have a similar problem to the one described here, but the answers there do not help me: http://scn.sap.com/thread/3396582 I specified the record delimiter, and I used a python script to check for any strange characters that are not supposed to be there, but didn't find any.
    If I copy the file to my windows PC and use the "File Menu -> Import -> SAP Hana Content -> Data from Local file" function, it imports the file correctly into B, but I need to be able to do it from JAVA.
    Machine A administration view:
    Machine B administration view:
    If you have any idea what might cause this behavior or where I can find more information on this problem please give me a hint.

    Hi Joseph,
    First from the pics, the revision of your SAP HANA instance is 73 instead of 74. Since I have no identical environment, I cannot test it for you. But can you try the simplest scenario? You can create a table with only one column table try to import a CSV file with only one row.
    Best regards,
    Wenjun

  • How to import a PSD file into Indesign WITH layers so it can be edited/saved as an InDesign file?

    How to import a Photoshop file into Indesign CS6 so that it's layers show in InDesign and it can then be edited/saved as an InDesign file?

    MyTienN wrote:
    Someone had mentioned the possibility of saving each individual layer in Photoshop as a png file and importing into Indesign and adjusting it in there
    What do you mean by "adjust"? Editing of Photoshop images should be done in Photoshop.
    Sure, it's possible to save individual layers from an image in Photoshop as inidvidual files in a variety of formats, but what's the point? You could just as easily import the layered file, then copy/paste it into a new layer for each layer in the image and use layer visibility to control which ones show. I don't think that will do you a lot of good, though, if you use adjustment layers or opacity controls on the layer in Photoshop.

  • Importing a csv file into addressbook

    So I did a search & found this question has come up quite often, but with the person having a slightly different problem, so here goes.
    I am trying to import a csv file into address book, when I go import -> text tile it comes up like it should do and I pick the file, if I select ok at this point, it will quite happily import all of the data no trouble (but in the wrong categories). So I make the changes to what I want ie. Phone other --> Phone (work). Then when I click ok, the button goes from blue to white but nothing happens.
    When I open the csv file in textedit I can see all the values separated by commas.
    Any Ideas?

    I too just had this problem. To clarify all fields work and you can map them. I found that the Outlook CSV file had two problems which were tripping up the AddressBook import function. Note these were both in street address fields so I suspect the poster who said that addresses don't work may have been having that problem.
    The CSV load program does not work if you have commas "," in your data. In my case this was very common for some European addresses as well as some company names. And then the second problem was if there was a carriage return or new line character in a field. This later one was a problem with the address fields. I suspect an AddressBook export to CSV might have this same issue. Specifically, when there were multiple lines to the street address, they had been entered as multiple lines in street address one, as opposed to entering them in multiple fields such as "street 1", "street 2", etc.
    To solve the problem I opened the CSV file using Numbers and did a global find and replace on: commas, substituting the string --- and on the newline character "¶" (ALT+Rreturn) with *.
    Note to reduce some of the remapping I also changed all of the labels with "business" in the header row of the CSV file to "work". This made it a little easier for the AddressBook import function to map fields more correctly.
    After these set of changes rather than the alternating blue then white with nothing behavior it cleanly loaded all of my names. I could then search for "---" and "*" in addressbook's search field to identify all addresses which I had to clean up.
    I hope that is helpful to someone else. The import function really does work. However, it is not robust enough to deal with certain oddities in one's data.

  • Loading data from .csv file into Oracle Table

    Hi,
    I have a requirement where I need to populate data from .csv file into oracle table.
    Is there any mechanism so that i can follow the same?
    Any help will be fruitful.
    Thanks and regards

    You can use Sql Loader or External tables for your requirement
    Missed Karthick's post ...alredy there :)
    Edited by: Rajneesh Kumar on Dec 4, 2008 10:54 AM

  • Loading data from .csv file into existing table

    Hi,
    I have taken a look at several threads which talk about loading data from .csv file into existing /new table. Also checked out Vikas's application regarding the same. I am trying to explain my requirement with an example.
    I have a .csv file and I want the data to be loaded into an existing table. The timesheet table columns are -
    timesheet_entry_id,time_worked,timesheet_date,project_key .
    The csv columns are :
    project,utilization,project_key,timesheet_category,employee,timesheet_date , hours_worked etc.
    What I needed to know is that before the csv data is loaded into the timesheet table is there any way of validating the project key ( which is the primary key of the projects table) with the projects table . I need to perform similar validations with other columns like customer_id from customers table. Basically the loading should be done after validating if the data exists in the parent table. Has anyone done this kind of loading through the APEX utility-data load.Or is there another method of accomplishing the same.
    Does Vikas's application do what the utility does ( i am assuming that the code being from 2005 the utility was not incorporated in APEX at that time). Any helpful advise is greatly appreciated.
    Thanks,
    Anjali

    Hi Anjali,
    Take a look at these threads which might outline different ways to do it -
    File Browse, File Upload
    Loading CSV file using external table
    Loading a CSV file into a table
    you can create hidden items in the page to validate previous records before insert data.
    Hope this helps,
    M Tajuddin
    http://tajuddin.whitepagesbd.com

  • Error While Importing from EIF file into AW

    Hi All,
    I am facing the following error while importing from EIF file into AW using AWM as well as from sql prompt.
    java.sql.SQLException: ORA-36786: (IOSEC04) File POCAW/abc.eif does not exist or cannot be accessed.
    ORA-06512: at "SYS.DBMS_AW", line 42
    ORA-06512: at line 1
    at oracle.olap.awm.eif.eifimport.ImportDialogActionThread.doExportOrImport(ImportDialogActionThread.java:172)
    at oracle.olap.awm.eif.EifDialogActionThread.doAction(EifDialogActionThread.java:58)
    at oracle.olap.awm.ui.dialog.ThreadedDialogActionThread.run(ThreadedDialogActionThread.java:49)
    i have already created the directory pocaw.
    i have done the following steps :
    CREATE OR REPLACE DIRECTORY POCAW as 'D:\Olap_POC\export';
    GRANT all ON DIRECTORY POCAW to PUBLIC;
    execute dbms_aw.execute ('aw create ''POC_AW''');
    execute dbms_aw.execute('cda pocaw');
    execute dbms_aw.execute('dtb attach POC_AW rw');
    execute dbms_aw.execute('import all from eif file ''/abc.eif'' dfns update ');
    any idea or thought would be appreciable.
    thanks n advance
    anwar

    execute dbms_aw.execute('import all from eif file''/abc.eif'' dfns update ');
    Maybe one of the following file names could help
    (have never tried it):
    ''abc.eif''
    ''POC_AW\abc.eif''Yes,
    you don't need the slash. CDA is like setting a default directory.

  • How to import a XML file into the document?

    Hai,
    i had created a table using xml file....
    Now i want to import that xml file tabel into the document...
    Can any one tell me how to import the xml file into the document?
    thanks
    senthil

    Hai...
    this is senthil...
    i'm beginner for creating adobe indesign plugins..
    i want to import a html file in the document...
    i want to create a table by using html tags and
    that table will be imported into the document..
    How shall i do it?
    can any one plzz explain me?

  • Import a CSV-file into a new table?

    hi, im trying to import a csv file into a new tabel, but i just cant make it work :-O. what are the steps to do that? im using sql developer version1.1.2.25.
    thanks for helping :-)

    We do not support CSV import at this stage, we only support XLS import.
    Regards
    Sue

Maybe you are looking for