A selection from the original table (TB1):
Note: The table has a great amount of data volume with 4 million rows of
data.
You need to export data into several
TXTfiles according to different values in PROGROUP column. Based on the above
data, the expected result is as follows:
DG.txt
MONTH ID COMPANY DEPARTMENT JOINTIME PROGROUP
201305 1009 1 A A1 201108 DG
201305 1027 2 A A3 201007 DG
PG.txt
MONTH ID COMPANY DEPARTMENT JOINTIME PROGROUP
201305 1009 1 B B1 201207 PG
SEG.txt
MONTH ID COMPANY DEPARTMENT JOINTIME PROGROUP
201305 1009 1 D D1 201109 SEG
SG.txt
MONTH ID COMPANY DEPARTMENT JOINTIME PROGROUP
201305 1009 1 C C1 201301 SG
201305 1013 2 C C2 201302 SG
A1: Use the SQL statement to create and
return a database cursor sorted by PROGROUP.
A2-B2: Group data by PROGROUP. Run a loop
to retrieve a group of records each time and then export them in B2 to the
corresponding TXT file named after a type of value in PROGROUP field.
No comments:
Post a Comment