Hello All,
In a Korn Shell,
I am trying to populate database table with the the contents of flat file.
Here is the sample of my flat file and its contents: sample_file.txt
- source: "\"GRP\".\"GEC_CLAIM_EVENT_SRI_PROCESS\""
target: "\"GRP\".\"GEC_CLAIM_EVENT_SRI_PROCESS\""
rsid: c0a8a91c-26-0
flags: 0
- source: "\"GRP\".\"GPB_BONUS_PMT_SMMRY\""
target: "\"GRP\".\"GPB_BONUS_PMT_SMMRY\""
rsid: c0a8a91c-26-0
flags: 0
- source: "\"SIC\".\"CCP_ADP_DETAIL\""
target: "\"SIC\".\"CCP_ADP_DETAIL\""
rsid: c0a8a91c-26-0
flags: 0
Here is the intended structure of the population of the destination table. Note that the table already has the column headings:
Here is the attempt:
#!/bin/ksh
USER=splex
PASS=splexpassword
DATABASE=mydbname
sqlplus -s /nolog << EOF
conn ${USER}/${PASS}@${DATABASE}
for i in `cat file.txt`
do
col1=`cat $i | awk -F ',' '{print $1}'`
col2=`cat $i | awk -F ',' '{print $2}'`
col3=`cat $i | awk -F ',' '{print $3}'`
col4=`cat $i | awk -F ',' '{print $4}'`
col5=`cat $i | awk -F ',' '{print $5}'`
col6=`cat $i | awk -F ',' '{print $6}'`
col7=`cat $i | awk -F ',' '{print $7}'`
INSERT INTO TEST_TAB
(COLUMN1, COLUMN2.....................)
VALUES
($col1, $col2, $col3,.................)
commit;
done
--doing other operations in the database after the aoove
set pagesize 0 linesize 4000 feedback off trimspool on
spool rowcount.txt;
select source_name from splex.count_match_vw;
spool off;
EOF
However the above is not helping.
Please Help.
In a Korn Shell,
I am trying to populate database table with the the contents of flat file.
Here is the sample of my flat file and its contents: sample_file.txt
- source: "\"GRP\".\"GEC_CLAIM_EVENT_SRI_PROCESS\""
target: "\"GRP\".\"GEC_CLAIM_EVENT_SRI_PROCESS\""
rsid: c0a8a91c-26-0
flags: 0
- source: "\"GRP\".\"GPB_BONUS_PMT_SMMRY\""
target: "\"GRP\".\"GPB_BONUS_PMT_SMMRY\""
rsid: c0a8a91c-26-0
flags: 0
- source: "\"SIC\".\"CCP_ADP_DETAIL\""
target: "\"SIC\".\"CCP_ADP_DETAIL\""
rsid: c0a8a91c-26-0
flags: 0
Here is the intended structure of the population of the destination table. Note that the table already has the column headings:
Here is the attempt:
#!/bin/ksh
USER=splex
PASS=splexpassword
DATABASE=mydbname
sqlplus -s /nolog << EOF
conn ${USER}/${PASS}@${DATABASE}
for i in `cat file.txt`
do
col1=`cat $i | awk -F ',' '{print $1}'`
col2=`cat $i | awk -F ',' '{print $2}'`
col3=`cat $i | awk -F ',' '{print $3}'`
col4=`cat $i | awk -F ',' '{print $4}'`
col5=`cat $i | awk -F ',' '{print $5}'`
col6=`cat $i | awk -F ',' '{print $6}'`
col7=`cat $i | awk -F ',' '{print $7}'`
INSERT INTO TEST_TAB
(COLUMN1, COLUMN2.....................)
VALUES
($col1, $col2, $col3,.................)
commit;
done
--doing other operations in the database after the aoove
set pagesize 0 linesize 4000 feedback off trimspool on
spool rowcount.txt;
select source_name from splex.count_match_vw;
spool off;
EOF
However the above is not helping.
Please Help.