Skip to content

Instantly share code, notes, and snippets.

@widoyo
Created April 17, 2014 01:02
Show Gist options
  • Save widoyo/10946079 to your computer and use it in GitHub Desktop.
Save widoyo/10946079 to your computer and use it in GitHub Desktop.
CREATE OR REPLACE PROCEDURE insert_a
AS
tgl varchar2(12);
msg varchar2(3500);
JAM DATE;
file UTL_FILE.FILE_TYPE;
bat UTL_FILE.FILE_TYPE;
file_scripts UTL_FILE.FILE_TYPE;
begin
file := UTL_FILE.FOPEN('C:\TEMP', 'insert A.txt','w', 8000);
msg := 'delete from A;';
UTL_FILE.PUT_LINE(file,msg);
FOR X IN ( select (''''||nim||''','''||nama||''','''||alamat||'''') as isi FROM tabel_sumber_data_A)
LOOP
msg := 'insert into A (nim, nama, alamat) VALUES('|| X.isi ;
UTL_FILE.PUT_LINE(file,msg);
END LOOP;
UTL_FILE.FCLOSE_ALL;
end;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment