You could use "utl_file"
Oracle Reference