SQL - write UPDATE script to read a text/excel file
Results 1 to 2 of 2

Thread: SQL - write UPDATE script to read a text/excel file

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    2

    Question SQL - write UPDATE script to read a text/excel file

    I trying to use below two scripts to read a text/excel file and then implement a UPDATE sql command

    This is to extract from filename in order to update every individual user's name. But i encounters two problems, can anyone help to solve???

    1) When i run below script, the output turns out looping 1st name instead of populating the whole list in text/excel file. How to solve?

    set serveroutput on;
    declare
    f utl_file.file_type;
    s varchar2(200);
    begin
    f := utl_file.fopen('firedirectory','filename','R');
    utl_file.get_line(f,s);
    utl_file.fclose(f);
    dbms_output.put_line(s);
    end;
    /

    2) How should i use below UPDATE script to implement into above? Please advice.
    UPDATE ocgen008individual
    SET ind_imagepath_v = 'filename' + '.JPG'
    WHERE ind_nricno_v = 'filename';
    COMMIT;

  2. #2
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,824
    Well Korito

    From the looks of it you have copied this script but failed to read the accompanying explanation. The script just gets the first line of the text file... which is why your update always has the same name.

    You need to put it in a loop and work out a way to terminate the loop when you reach eof. more on utl_file
    Never, ever approach a computer saying or even thinking "I will just do this quickly."

Similar Threads

  1. vdx/dll/drivers/cdrom problems
    By thia in forum Windows 95/98/98SE/ME
    Replies: 6
    Last Post: March 15th, 2006, 02:10 PM
  2. Replies: 5
    Last Post: December 1st, 2004, 12:28 AM
  3. DVD buner cannot read and write CD-RW
    By marik in forum CD-ROM/CDR(-W)/DVD Drivers
    Replies: 5
    Last Post: September 16th, 2004, 03:55 AM
  4. will read dvd's but won't write them
    By bmb0704 in forum CD-ROM/CDR(-W)/DVD Drivers
    Replies: 2
    Last Post: July 30th, 2004, 07:54 AM
  5. busy work
    By ilovetheusers in forum Tech Lounge & Tales
    Replies: 6
    Last Post: July 23rd, 2002, 03:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •