Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> split file from UNIX or SQL
Hello, Being not a UNIX expert, I'm write unix & SQL scripts to generate report. But have difficulty to split the file according the report ID. I'm wondering IF UNIX (sh script) can split a big text file into several different files according to a certain field (from posX to posY), when that field is not in sequence, but from rowA to rowB will be exactly the same.
ie: check text file, if from rowA to rowB, when posX-posY are equal, generate report AB;
if from rowC to rowD, when posX-posY are equal, generate report CD; ....
Here are more info:
I have a table to store report request info from user, like this:
REPORT_ID DI PL BUI FL ROOM---------- -- -- --- -- ------REPORT 1 RC SF DAL ndREPORT 2 AD LEREPORT 3 RC DD LKF 01 RENTALREPORT 4 *REPORT 5 CSREPORT 6 * DD LKF 01 RENTALREPORT 7 RC DD LKF 01 ABCDEREPORT 8 AB AC LKF 01
After I do error checking and then run the query against DB, I can get a huge temp table to store info, like this:
REPORT_ID KOMP_IDENT---------- ----------REPORT 1 C-773280558REPORT 1 C-773281754REPORT 1 C-773281755REPORT 1 C-773281753REPORT 3 C-0773280100REPORT 8 C-063444REPORT 8 C-063442
Due to invalid records, certain report ID are throw away during the query, therefore nothing in my temp table are in sequence. How could I spool out the file according to group by the report ID??
Maybe this can be done in SQL script but I just running out of my brain for this complex report. (I'm not doing it in Dynamic SQL).
Thanks for advise
HelenDo You Yahoo!?
Yahoo! Mail Personal Address -
Get email at your own domain with Yahoo! Mail.
Received on Wed Jun 13 2001 - 13:14:35 CDT