Performance while saving db entries in a CSV File (Saving the MARA)

Hi Experts.
Now, I have a very difficult problem and until now noone could give me a solution.
The scenario is that I have to export the complete MARA as CSV (Comma Seperated Text File) on the server (xfer-DIR).
So, I select a bunch of mara entries and convert them to character on field level. Why on field level? Because there is no way to convert a whole workarea to character. This means the following command does not work if there is any field with field type P (packed) or F (float).
l_v_char_line = l_s_mara
transfer l_v_char_line to l_v_file
If I move the data on field level to a character the data will be converted correctly. But this means that I need to proof on field level and this results in a very inperformant runtime.
In case the table just consists of CLIKE fileds I can do the move as written above and the transferrate is about 5 MB/s. But when I work on field level base the transferrate is about 200 KB/s.
Below is a part of my coding.
Does anyone know a solution?
          "& Select without WHERE clause
          SELECT (l_t_result)
          FROM (l_t_source)
          UP TO statement_calculator->idx_to ROWS
          INTO CORRESPONDING FIELDS OF TABLE <fs_local_table>[]
          PACKAGE SIZE sel_package_size.
            l_v_dbcnt = sy-dbcnt.
            CLEAR l_stmt_values.
            LOOP AT <fs_local_table> ASSIGNING <fs_workarea>.
              DO.
                IF sy-index > 1.
                  CONCATENATE l_stmt_values l_v_line cl_datext_controller=>delimiter
                  INTO l_stmt_values.
                ENDIF.
                CLEAR l_v_line.
                ASSIGN COMPONENT sy-index
                OF STRUCTURE <fs_workarea> TO <fs_any>.
                IF sy-subrc <> 0.
                  EXIT.
                ENDIF.
                "& Converts
                l_v_line = <fs_any>.
                READ TABLE l_o_struct->components[]
                INTO l_s_components INDEX sy-index.
                IF  sy-subrc = 0
                AND l_s_components-type_kind CA 'NPFIbs%'.
                  "& Convert number like to output format
                  CALL METHOD me->convert_number_string
                    EXPORTING
                      i_numvalue = <fs_any>
                      i_typekind = l_s_components-type_kind
                    CHANGING
                      x_string   = l_v_line.
                ELSEIF sy-subrc = 0
                   AND l_s_components-type_kind CA 'Cg&!?'.
                  "& Delete special characters
                  CALL METHOD me->delete_special_character
                    CHANGING
                      x_string = l_v_line.
                ENDIF.
                UNASSIGN: <fs_any>.
              ENDDO.
              CONCATENATE l_stmt_values cl_abap_char_utilities=>cr_lf
              INTO l_stmt_values.
            ENDLOOP.
            "& Transfer data to file stream
            TRANSFER l_stmt_values TO l_v_filename.
          ENDSELECT.
Edited by: Thomas Zloch on Feb 23, 2011 5:33 PM - code tags added

Ok. That is what I thought, too. But it doesn't matter. Reading all MARA data at once (see coding below) results in 477 Kb/s and reading with a package size 100000 results in 456 Kb/s. This is really a bad performance.
I'm frightened that there seems to be no solution with abap stadard development tools. Right. We could use any ETL Tool to export data, but thats not our aim. The server, who the application is running on, has really enough capacity to handle the exports.
          "& Select without WHERE clause
          SELECT (l_t_result)
          FROM (l_t_source)
          UP TO statement_calculator->idx_to ROWS
          INTO CORRESPONDING FIELDS OF TABLE <fs_local_table>[].
          l_v_dbcnt = sy-dbcnt.
          CLEAR l_stmt_values.
          LOOP AT <fs_local_table> ASSIGNING <fs_workarea>.
            DO.
              IF sy-index > 1.
                CONCATENATE l_stmt_values l_v_line cl_datext_controller=>delimiter
                INTO l_stmt_values.
              ENDIF.
              CLEAR l_v_line.
              ASSIGN COMPONENT sy-index
              OF STRUCTURE <fs_workarea> TO <fs_any>.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
              "& Converts
              l_v_line = <fs_any>.
              UNASSIGN: <fs_any>.
            ENDDO.
            CONCATENATE l_stmt_values cl_abap_char_utilities=>cr_lf
            INTO l_stmt_values.
          ENDLOOP.
          TRANSFER l_stmt_values TO l_v_filename.

Similar Messages

  • Error while refreshing a report using local csv file

    Hi,
    I'm using BI 4.1 SP02.
    While using Rich client, I've created a report with some merged queries, while one of the queries is a local CSV file - saved on AD in some server, and not on the repository inside BO.
    While trying to refresh the report with the Rich client, it all went great.
    Now, while using BI Launchpad java based app, I can't refresh the report - I get the following error:
    "An Internal error occurred while calling 'processDPCommandsEx' API. (Error: ERR_WIS_30270) (WIS 30270)"
    Should I be able to refresh a report without the Rich if it contains a local file (which is possible to EDIT only with rich) ?
    If so, then did someone ran into this error?
    Thank you,
    Or.

    First of all, thanks for both of the replies.
    Second,
    my problem is unlikely have to do something with permissions from one reasons -
    when the report is using XLS\XLSX on same folder(with same name prefix) - the report is running without any problem.
    Only problem is while refreshing without Rich while the source is network CSV file.
    Any suggestions?
    Thanks.

  • Can't paste copied entries from online CSV file into Excel spreadsheet (chatted with zzxc on 5/3/10 at around 2.30 CST but got disconnected. did not get an answer ...)

    Here is the transcript of a chat with Firefox community member zzxcon May 3/10
    You are now chatting with Firefox community member zzxc
    zzxc: Hello
    zzxc: What happens when you attempt to download a .csv file?
    seegal: hello
    seegal: it doesn't copy
    zzxc: how are you trying to copy?
    seegal: pls bear with me I'm a slow typist. Just copy selected text
    Biolizard has joined the conversation.
    zzxc: ok - which text are you selecting?
    seegal: I reconcile my checkbook (spreadsheet this way). I copy the items in my online bank acc and paste it to the spreadsheet
    seegal: I'm using Firefox /2.0.0.19. Have no problem to do this.
    zzxc: Which version of OS X?
    seegal: In all newer version nothing happens when trying to paste- just doesn't paste
    zzxc: Firefox 2.0.0.x is no longer supported, and hasn't been supported in over a year
    zzxc: Paste into Excel, from Firefox?
    seegal: Sorry, I'm ahead... /2.0.0.19
    seegal: Yes. I open my bank acc in Firefox
    zzxc: Which version of Excel?
    zzxc: It would really help if you could tell me step by step what you're doing.
    seegal: First re: your previous question: it's OS 10.4.11
    seegal: About Excell: it'as 2004 version - the lasat one produced for Macs. The specific version is 11.3.7
    seegal: So I open my bank acc online in Firfox (my primary browser). I copy the latest entry in the account and paste it into my Excel spreadsheet.
    zzxc: so, you copy direct from the web page without downloading a CSV file?
    seegal: What do you mean by downloading to CSV file? I could export from the https://chat-support.mozilla.com:9091/webchat/getimage?image=sendmessage&workgroup=support%40workgroup.chat-support.mozilla.comFirefox to the CSV file, but the other way around?
    zzxc: Are you copying your bank statement directly from the web site to Excel using the clipboard?
    seegal: sI don't use the clipboard. This is a mac. There is no need to do that. In PC it would be yes.
    zzxc: I need to know the exact steps you're taking to get them into excel
    zzxc: And I need to know what exactly goes wrong in the latest version of Firefox.
    seegal: Do you have a mac there with Firefox and Excel? It would be very easy to reproduce. Imagine you open an online bank acc, select some entries , click "copy", than proceed to your already open Excel spreadsheet and click' paste". That's it!
    zzxc: When this happens, do you get cryptic code pasted into Excel?
    seegal: As I said before: in all newer versions starting with 3.0 when I go to Excel to "paste" from my bank acc nothing happens. It does not paste. No, I don't get a cryptic code pasted, just NOTHING.
    zzxc: what if you paste into MS Word instead?
    seegal: haven't tried that, the formatting most likely would be lost. Tried that with an other Exc el spreadsheet- it lost all the formating and pasted as continous text.
    == This happened ==
    Every time Firefox opened
    == Pls. see copy of the chat above. THIS A MAC OS X. In older versions, prior to 3.0 I could copy from CSV file on the website Ibank acc) and paste directly to my Excel spreadheet to reconcile my account.

    See also:
    Table2Clipboard: https://addons.mozilla.org/firefox/addon/1852
    TableTools: https://addons.mozilla.org/firefox/addon/2637

  • Saving chosen date format in csv-file

    I format all cells in one column to a dateformat dd-mmm-yy
    i.e. 01-jan-06, works fine I have all the dates in the year by clicking on first cell.
    BUT I can not SAVE the file as csv keeping the format - it is saved as 01-01-2006, which I can not use.
    I do this in Excel all the time - do I have to do something special in Staroffice Calc 8.0 ?

    A similar issue faced here trying to save a worksheet (Staroffice Version 8) in .csv format. The worksheet had one column for date of birth formatted as "dd/mm/yyyy" and another one for age using formula "=TODAY()-B6", formatted as "yy". In the corresponding .csv file the age column showed up as "dd/mm/yyyy" as against the required "yy" format . On saving the data in text file with the space delimited option, the date of birth column showed up in the "mm/dd/yyy" format - the age column however was in the desired "yy" format.
    Here is a workaround though;
    On your existing staroffice worksheet format all the data just as would like it appear in the .csv file. The trick is to transfer the data into an intermediate application that does not understand the underlying formatting or formula, which in our case will be notepad. Copy the entire range of data from your staroffice worksheet into notepad. Minimise notepad after the data has been pasted. Save and exit the existing staroffice workbook. Open a new workbook, select the entire range that is going to hold the data and then format the cells as "text". Now, maximise notepad, select all the data using the edit menu and copy it into the new worksheet. The data should appear just as it was in the original worksheet, but without any formatting or formula. You can now proceed to save the data in a .csv file without having to worry about changed date formats.
    However, if you have come across some other method through which this issue has been resolved, please post here or drop me a a mail
    anandkumarvj [at] rediffmail.com

  • Replacing entries in a csv file

    Hi,
    I am working on a code where I need to replace certain entries in a csv file. In the Get Content command, I need to use a wildcard for "Server". I tried replacing SERVER with * ,however that did not work. Any idea's, how this can be done.
    TSR-SERVICE-MESSAGE ERROR SERVER@@"
    Get-Content C:\VPS\TRH_VPS_DB.csv | ForEach-Object { $_ -replace "%CATD_I_066, serviceMessageTrap: errorMessage: TSR-SERVICE-MESSAGE ERROR SERVER@@", "" } | Set-Content C:\VPS\TRH_VPS_DB_1.csv
    Thanks

    It is not possible to understand your question as asked.
    TO load a CSV we use this method:
    $csv=Import-Csv <filename>
    We can then alter any field in the CSV directly.
    I suspect you do not have a CSV.
    -replace uses regex and NOT wild cards:
    HELP about_Regular_Expressions
    ¯\_(ツ)_/¯

  • Sort records in a csv file in the descending order of time created attribute

    I have an excel (.csv) file with the following column headers :-
    Client, 
    SourceNetworkAddress
    ,TimeCreated,
     LogonType
    ,User,
    Message
    Values like :- ABC, 10.5.22.27, 11/23/2014 9:02:21 PM, 10, testuser
    The file is a combination of a report generated everyday using multiple scripts. The data is appended each day therefore, I would like to sort the final output file in descending order of time created (a combination of date and time) fetched from events
    i.e. the latest record with the latest date and time should be at the top of the list.
    I tried using the following command however, I get a sorted list according to the date but not the time. The command does not consider the AM/PM mentioned in the time instead simply sorts them as per numbers 
    Import-Csv "C:\Users\a\Desktop\report.csv" | sort Timecreated -Descending | Export-csv "C:\Users\a\Desktop\report_sorted.csv" -force -NoTypeInformation
    So if I have a record with 9:02:21 PM(latest) and a record with time 10.44.10 AM on the same date, the command will sort the list with record 10:44:10 AM first and then record with 9:02:21 PM however it should be the opposite as per descending order.
    Kindly help !!

    Hi jrv,
    Thanks for your response. However, I get errors while I run this command in Powershell :-
    Import-Csv <file> | Select Client,SourceNetworkAddress,LogonType,User,Message,@{N='TimeCreated';E={[datetime]($_.TimeCreated)} | Sort TimeCreated -Descending | Export-csv <file> -force -NoTypeInformation
    Missing expression after ','.
    At line:1 char:150
    Unexpected token 'LogonType' in expression or statement.
    At line:1 char:151
    Unexpected token ',' in expression or statement.
    At line:1 char:160
    Unexpected token 'User' in expression or statement.
    At line:1 char:161
    Unexpected token ',' in expression or statement.
    At line:1 char:165
    Unexpected token 'Message' in expression or statement.
    At line:1 char:166
    The hash literal was incomplete.
    At line:1 char:174
    Please help!
    You are missing a second curly brace - 
    Import-Csv <file> | Select Client,SourceNetworkAddress,LogonType,User,Message,@{N='TimeCreated';E={[datetime]($_.TimeCreated)}} | Sort TimeCreated -Descending | Export-csv <file> -force -NoTypeInformation

  • 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.

  • How to upload multiple .CSV files in the same time.

    Hi Legends,
    Can anyone please help me to resolve my issue?
    This is very urgent and critical.
    Description:
    We have two users.1)edw_user_dump
    2)prd_udm.
    We need to upload the xx.csv file at the same time for these two users in oracle forms.
    we have differentiated .csv file name based on the user names.
    the main problem is in the sql loader command the xx.csv file name is created but the data is not captured in the server (kentucky) .
    Below is my code for the upload.
    -- To delete the Part_Mast.log file from the client
    DECLARE
    pid WEBUTIL_HOST.PROCESS_ID;
    v_result PLS_INTEGER;
    v_username varchar2(30) := GET_APPLICATION_PROPERTY(USERNAME);
    BEGIN
    v_result := WEBUTIL_HOST.Get_return_Code(pid ) ;
    host('cat /dev/null > /tmp/'||v_username||'_'||'EDW_CF_IO_UPLOAD.log');
    host('cat /dev/null > /tmp/'||v_username||'_'||'"CF615 IO Upload.csv"');
    END;
    DECLARE
    l_success boolean:=FALSE;
    l_bare_filename varchar2(100):=NULL;
    v_username varchar2(30) := GET_APPLICATION_PROPERTY(USERNAME);
    BEGIN
    -- Delete the content of the log and bad file
    host('cat /dev/null > /tmp/'||v_username||'_'||'EDW_CF_IO_UPLOAD.log');
    --host('cat /dev/null > /tmp/Part_Mast.bad');
    -- Upload the data file to Application Server
    l_bare_filename := v_username||'_'||substr(:FIC_SOURCE,instr(:FIC_SOURCE,'\',-1)+1);
    l_success := webutil_file_transfer.Client_To_AS_with_progress
    (clientFile => :FIC_SOURCE
    ,serverFile => '/tmp/'||l_bare_filename
    ,progressTitle => 'Upload to Application Server in progress'
    ,progressSubTitle => 'Please wait'
    ,asynchronous => false
    ,callbackTrigger => null
    IF l_success THEN
    NULL;
    ELSE
    null;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE Form_Trigger_Failure;
    END;
    DECLARE
    v_username varchar2(30) := GET_APPLICATION_PROPERTY(USERNAME);
    begin
    host('cat /dev/null > /tmp/'||v_username||'_'||'EDW_CF_IO_UPLOAD.log');
    host('cat /dev/null > /tmp/EDW_CF_IO_UPLOAD.bad');
    end;
    BEGIN
    DECLARE
    v_username varchar2(30) := GET_APPLICATION_PROPERTY(USERNAME);
    v_password varchar2(30) := GET_APPLICATION_PROPERTY(PASSWORD);
    v_connect_string varchar2(30) := GET_APPLICATION_PROPERTY(CONNECT_STRING);
    a_host varchar2(500);
    BEGIN
    a_host :='/tmp/'||v_username||'_'||'"CF615 IO Upload.csv"';
    host('sqlldr '||v_username||'/'||v_password||'@'||v_connect_string||' '|| 'control=/home/edw_bis/ctl/GLB_CF_IO_UPLOAD.CTL'||' '|| 'DATA=a_host'||' '|| 'LOG=/tmp/'||v_username||'_'||'EDW_CF_IO_UPLOAD.log SKIP=1 errors=200000 DIRECT=FALSE');
    dbms_output.put_line(a_host);
    END;
    DECLARE
    v_username varchar2(30) := GET_APPLICATION_PROPERTY(USERNAME);
    begin
    host('cat /dev/null > /tmp/'||v_username||'_'||'"CF615 IO Upload.csv"');
    EXCEPTION
    WHEN OTHERS THEN
    RAISE Form_Trigger_Failure;
    END;
    end;
    DECLARE
    al_id3 ALERT;
    al_button Number;
    BEGIN
    edw_user_dump.SANM_PRC_MERGE_CF_IO_UPLOAD(:global.v_plsql_res,:global.v_ins_rec,:global.v_upd_rec);
    IF NVL(:global.v_plsql_res,0) = 0 and (:global.v_ins_rec !=0 OR :global.v_upd_rec != 0 ) then
    al_id3 :=FIND_ALERT('ROWINS');
    SET_ALERT_PROPERTY(al_id3,alert_message_text,' Process Completed Successfully!'||CHR(10)||' Rows Inserted : '||:global.v_ins_rec ||CHR(10)||' Rows Updated : '||:global.v_upd_rec);
    al_button := SHOW_ALERT( al_id3 );
    ELSIF (:global.v_plsql_res IN(-1,0) or :global.v_plsql_res > 0) and (:global.v_ins_rec =0 and :global.v_upd_rec = 0 and :global.v_del_rec =0 ) then
    al_id3 :=FIND_ALERT('ROWINS');
    SET_ALERT_PROPERTY(al_id3,alert_message_text,' Process Failed. Please Download the Log File '||CHR(10)||' Rows Failed : '||:global.v_plsql_res||CHR(10)||' Rows Inserted : '||:global.v_ins_rec ||CHR(10)||' Rows Updated : '||:global.v_upd_rec);
    al_button := SHOW_ALERT( al_id3 );
    ELSE
    al_id3 :=FIND_ALERT('ROWINS');
    SET_ALERT_PROPERTY(al_id3,alert_message_text,'Please Download the Log File '||CHR(10)||' Rows Failed : '||:global.v_plsql_res||CHR(10)||' Rows Inserted : '||:global.v_ins_rec ||CHR(10)||' Rows Updated : '||:global.v_upd_rec );
    al_button := SHOW_ALERT( al_id3 );
    END IF;
    EXCEPTION WHEN OTHERS THEN
    RAISE Form_Trigger_Failure;
    END;
    DECLARE
    v_username varchar2(30) := GET_APPLICATION_PROPERTY(USERNAME);
    begin
    host('cat /dev/null > /tmp/'||v_username||'_'||'"CF615 IO Upload.csv"');
    host('rm -rf /tmp/'||v_username||'_'||'"CF615 IO Upload.csv"');
    end;
    Thanks in advance!
    Thanks,
    Madhusudhanan

    Madhusudhanan,
    A couple of observations. First; always list your exact Forms version (eg; 10.1.2.0.2 not 10g R2). In most cases, the solution is different depending on the Forms version. Second; why must you use Forms to kick off a SQL Loader process? This is a server-side process and should be initiated by a server side process. If you absolutely must use Forms to kick off the process, again we need your Forms version in order to offer any solutions. Based on your code sample, I can asusme you are at least using Forms 9i becuase you are using WebUtil.
    Is your Database and Application Server the same physical computer? If they are not, this would explain why your HOST command isn't working because HOST runs against the Application Server not the Database server.
    Third; have you considered using and External Table (if your RDBMS version supports them) for each of the files you are attempting to upload? In this instance, it would be helpful to know your RDBMS version as well. External Tables can be a little frustrating to set up the first time, but as with any new construct you use - it gets easier the more you use it.
    Fourth; are you getting any errors in your log file(s)? If so, what are the errors? Please list the full error message if you have one.
    Finally, with respects to your statement:
    Posted: Mar 18, 2011 2:30 PM - Madhu This is very urgent and critical.>
    You have to understand that forum contributers are all volunteers - this is not our full-time job. If your issue is truely urgent I suggest you open a Service Request (SR) with Oracle Support! ;-)
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • I also have a .csv file with the name of a jpeg in one column and a text description of each jpeg in a second column. Is there a way to automatically insert one jpeg (photo) and its corresponding text, each pair on one page, into a Indesign document?

    I also have a .csv file with the name of a jpeg in one column and a text description of each jpeg in a second column. Is there a way to automatically insert one jpeg (photo) and its corresponding text, each pair on one page, into a Indesign document?

    I would also recommend to write the description into the meta data. This would allow to place a text frame above the image and it is possible to add meta information and file name automatically together with the image, when you place it or even in a prepared template.
    Meta data information can be written easily in Bridge in the Meta File Workspace.

  • How to create power shell script to upload all termset csv files into the SharePoint2013 local taxonomy ?

    Hi Everyone,
    I want to create a powershell script file
    1) Check a directory and upload all termset csv files into the SharePoint local taxonomy.
    2) Input paramaters - directory that containss termset csv files, Local Termstore to import to,
    3) Prior to updating get a backup of the existing termstore (for rollback/recovery purposes)
    4) Parameters should be passed in via XML file.
    Please let me know how to do it.
    Regards,
    Srinivas

    Hi,
    Please check this link
    http://termsetimporter.codeplex.com/
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • No luck syncing .cvs or vcs.csv files on the new iCal

    This is so annoying, I can no longer sync my University timetable with the new iCal. Does anyone know why I can no longer add .cvs or .vcs.csv files to the new iCal? Thanks

    Presumably you've tried trashing your preferences . . ?
    Have you tried trashing the App and reinstalling it?
    Andy

  • SQL* Loader Loading specific column from CSV file to the table

    Dear All,
    Iam Loading specific column from .CSV file to the oracle table.
    Could pls help how i can load only that cols into the table
    Eg: CSV file having id, Frst_name,Last_name, Address,Phone,Insurance etc
    out of this I want to load only Frst_name,Last_name columns to oracle table say fname and lname.
    Thanks in Adv.
    Junu

    Lily,
    I made some changes to your table def but you will get the idea
    -- Table EMPLOYEE
    CREATE TABLE EMPLOYEE
      EMPID        NUMBER                           NOT NULL,
      EMPNICKNAME  VARCHAR2(10 BYTE)                    NULL,
      FNAME        VARCHAR2(20 BYTE)                NOT NULL,
      MI           VARCHAR2(20 BYTE)                    NULL,
      LNAME        VARCHAR2(20 BYTE)                NOT NULL,
      FULLNAME     VARCHAR2(20 BYTE)                NOT NULL,
      HIREDATE     DATE                             DEFAULT SYSDATE               NOT NULL
    --  data file employee.dat
    1,amy,b,amy b
    2,cindy,d,cindy d
    3,eric,f,eric f
    4,gary,h,gary
    -- Control file : Employee.ctl ( you can use truncate, replace or append , see sqlldr for more options)
    load data
    Truncate into table employee
    fields terminated by ","
    optionally enclosed by '"'
    TRAILING NULLCOLS
    empId INTEGER EXTERNAL,
    FName char(20),
    LName char(20),
    FullName char(30)
    now to load use following or you can speicify infile in control fle
    sqlldr username/passowrd control=employee.ctl  data=employee.dat log=employee.log
    {code}
    Hope this help.
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Saving result from query into CSV file

    Hi folks,
    in our application we're generating pages source using general packages (like htp, owa_util, ...). and in this part I'm a really beginner.
    I want to modify source one of our page, I want to add functionality to enable save result from query (cursor) into CSV file, to enable user choose place where generated file will be created and also change file name.
    I searched this forum and I found procedure, that could be useful:
    procedure p_getcsv is
    cursor cur is
           select 'a1' col1, 'b1' col2, 'c1' col3 from dual
       union  select 'a2' col1, 'b2' col2, 'c2' col3 from dual
       union  select 'a3' col1, 'b3' col2, 'c3' col3 from dual;
       begin
            -- Set the MIME type
            owa_util.mime_header( 'application/octet', FALSE );
            -- Set the name of the file
            htp.p('Content-Disposition: attachment; filename="test.csv"');
            -- Close the HTTP Header
            owa_util.http_header_close;
            -- Loop through all rows in EMP
            for x in cur
            loop
                -- Print out a portion of a row,
                -- separated by commas and ended by a CR
                 htp.prn(x.col1||','|| x.col2||','||x.col3|| chr(13));
            end loop;        
       end;What peace of code should I add to procedure that is generating web page to enable calling this procedure and whole saving process?
    Can anybody help me with this?
    Many thanks,
    Tomas
    Message was edited by:
    Tomeo

    Hi Marc,
    thanks for reply, problem is that I'm not using APEX application, I'm just generating web page code straight using oracle general packages.
    But I found this solution (maybe some tunning will be good):
    In page where I want to display Download i have
      begin
             htp.anchor2 (
                           curl  =>  ... .p_getcsv'||'?term=2005&crn=123,
                           ctext => 'Download Class List'
             HTP.br;
          end;
    ...si I'm calling p_getcsv procedure:
      procedure p_getcsv( term  IN stvterm.stvterm_code%TYPE DEFAULT NULL,
                           crn   IN sirasgn.sirasgn_crn%TYPE DEFAULT NULL) is
       v_length      NUMBER;
       v_file_name   VARCHAR2 (2000);
       temp_blob  blob;
       line RAW(32767);
       begin
             DBMS_LOB.CREATETEMPORARY(temp_blob, TRUE);
             FOR i IN 1..6  LOOP
                line := UTL_RAW.CAST_TO_RAW(i||','||term||','||crn||',AAA,BBB,CCC'||chr(10));
                DBMS_LOB.WRITEAPPEND(temp_blob, LENGTH(UTL_RAW.CAST_TO_VARCHAR2(line)), line);
             END LOOP;
              v_file_name := 'ClassList.csv';
              v_length  := DBMS_LOB.getlength (temp_blob);
              -- set up HTTP header
                 -- use an NVL around the mime type and
                 -- if it is a null set it to application/octect
                 -- application/octect may launch a download window from windows
               OWA_UTIL.mime_header (NVL ('csv', 'application/octet'), FALSE);
               -- set the size so the browser knows how much to download
               HTP.p ('Content-length: ' || v_length);
               -- the filename will be used by the browser if the users does a save as
               HTP.p (   'Content-Disposition:  attachment; filename="'
                  || REPLACE (REPLACE (SUBSTR (v_file_name,
                                               INSTR (v_file_name, '/') + 1
                                       CHR (10),
                                       NULL
                              CHR (13),
                              NULL
                  || '"'
                 -- close the headers
                 OWA_UTIL.http_header_close;
                -- download the BLOB
                 WPG_DOCLOAD.download_file (temp_blob);
                 -- release temporary blob
                 dbms_lob.freetemporary(temp_blob);  
       end;Regards,
    Tomas

  • How to transfer the messages saved as .csv file to the iphone?

    I made abackup my messages using SQlite browser which saved the backup file as .csv file. How can i transfer it to my phone again?

    PC suite does not help. Especially in my case where i created sub-folders in the "saved messages" folder, after which the messages can be read, but cannot be moved back to inbox anymore. After calling the nokia care centre, guess what the d**B customer care person said? she said one option is to forward the SMS's to another SIM card, then save it on that sim card. talk abt not using your brain!!! firstly, it would be costly, at 5cents per sms; that notwithstanding, it would take hours and hours to forward all (I have ard 900 saved sms's) to another number!
    with technology at the leve it's at now, I don't see why I have to incur both the TIME and MONEY to transfer something that is already belonging to me.

  • Random Records are being skipped while uploading data in PSA from CSV File

    Hi Experts,
    I am facing issue in data uploading in PSA through CSV file, Random Records are being skipped while uploading data in PSA.
    First Load
    We have flat file (.txt in CSV format), which contains 380240 Records.
    We are uploading the flat file data into PSA from Application Server. But it uploads Only 380235 records, 5 Records are being skipped.
    Second Load
    We have re-generated same file next day, which contains same No of Records (380240), but this time it uploads Only 380233 records, 7 Records are being skipped.
    We found 1 skipped record (based on key columns combination, by cross verifying from source and PSA table) from First load. But same records (combination of key column) is available in second load. It means same records are not being skipped every time.
    Earlier (5 months ago) , We have loaded 641190 Records from flat file in same PSA and all records (641190) were uploaded successfully.
    There is no change is Source, PSA and flat file structure.
    Thanks & Regards
    Bijendra

    Hi Bijendra,
        Please check in the file if at the begining if it has got any excape sign then that record may be skipped so the records may be mssing
    Please check the excape sign like ; if they are present at the beginign that recor entirely will be skipped.
    Regards
    vamsi

Maybe you are looking for

  • How can I receive list of my purchases in Apple store from customer support

    Hi I need help in contacting customer support to get full information about my purchases on Apple store through Visa card. All I purchased was a 20$ in game purchase for my little brother , however several days later I found out that more than 70$ we

  • Returns and Repairs  in CS

    Hi, I am creating the  following cycle- Service notification--> Repair Quotation Then i create a Repairs order with reference to teh quoatton created earlier- and carry out returns delivery. The problem is that  when i go to the repairs screen ,it do

  • CreateJavaVM after destroying it fails

    Hello, I'm trying to use JNI in a VC++ project - it works fine, when I call it the first time, but always when I call the jvm I load and unload it in the same process. Now is my problem, that I call DestroyJavaVM at the end of this method, this retur

  • Mission Control & Spaces

    Before Mavericks I was able to quickly switch to a space by using CTRL plus a number key.  How do I bring back this feature after Mavericks?

  • DVDRW is Mega-Slow and slows the system down

    Hi, I have: 4 x SATA2 disks on the ICH7 (three in RAID 0, one as single disk) 1 x IDE DVDRW on the Secondary IDE port, set as slave When I burned a DVD yesterday the sound started to slow, I thought it was the application. But when I try to install a