plsql - Is it possible to read a text file and write it in binary format in another file using PL/SQL UTL_FILE? -
for example: consider text file "a.txt" has following contents:
123,jhon
456,jason
125,deepak
i want read above text file , want write binary file considering first field integer , 2nd field character/varchar2 (like in c or c++).
file "a.txt" has 2 fields. each field separated comma.
let first field stored in integer type.
let max length of second field 10. hence, 2nd field padded space (let b represents blank space) make 10 chars , stored in type char(10).
now each records after formatting of fixed byte size , without filed separator:
123jhonbbbbbb
456jasonbbbbb
125deepakbbbb
if can write each field of each line shown above (one integer , 1 char(10) ) in binary format using utl_file or other oracle utility, can read file in c opening file in binary format , can store each record in structure , can go ahead further processing.
typedef struct
{
int id,
char name[10],
}sample;
hope explains want achieve. on appreciated.
thank you!
wiki
Comments
Post a Comment