3 Replies Latest reply: Dec 6, 2012 7:58 AM by Paul M. RSS

    sql*loader with forms

    kaminanikamini
      I am using oracle forms 10g on windows 7 32 bit.

      i want to load data from oracle form to oracle database.
      i have written the following code on Push Buttons When-Button-Pressed trigger.

      declare
      usid varchar2(10):= get_application_property(username);
      pwd varchar2(10):= get_application_property(password);
      db varchar2(10):= get_application_property(connect_string);
      v_ctl_file text_io.file_type;
      v_live_path varchar2(1000):='D:\';
      v_bat_file text_io.file_type;

      begin

      v_ctl_file := text_io.FOPEN(v_live_path||'test.ctl', 'w');
      text_io.PUT_LINE (v_ctl_file, 'LOAD DATA');
      text_io.PUT_LINE (v_ctl_file, 'INFILE '''||v_live_path||'data.csv''');
      text_io.PUT_LINE (v_ctl_file, 'INTO TABLE test');
      text_io.PUT_LINE (v_ctl_file, 'fields terminated by "," optionally enclosed by ''"'' ');
      text_io.PUT_LINE (v_ctl_file, '(id,name,salary)') ;
      text_io.FCLOSE (v_ctl_file);

      v_bat_file := text_io.FOPEN(v_live_path||'load_data.bat', 'w');
      text_io.PUT_LINE (v_bat_file, 'sqlldr userid = '|| usid || '/' ||pwd || '@' ||db ||
      *' ERRORS=1000000 control = '|| v_live_path||'test.ctl log = '|| v_live_path||'test.log');*
      text_io.FCLOSE(v_bat_file);

      host(v_live_path||'load_data.bat');

      Exception when others then
      message(sqlerrm||dbms_error_text);
      message(' ');
      end;

      SO my control file content is

      LOAD DATA
      INFILE 'D:\data.csv'
      INTO TABLE test
      fields terminated by "," optionally enclosed by '"'
      *(id,name,salary)*

      Batch File content:
      sqlldr userid = SCOTT/TIGER@orcl ERRORS=1000000 control = D:\test.ctl log = D:\test.log

      But on my command prompt i am getting the following messsage

      SQLLDR is not recognised as an internal or external command,operable prgram or batch file.

      Thanks