KSH - Text from input file truncated while converting it to excel

Dear Members,

I am using the attached script to convert a input file delimited by '|' to excel.
However, while processing the attribute change_reason, the whole content of the text under change_reason is not displayed completely in the cell in excel. It is truncated after only first few words. May be this is because the attribute change_reason has new line character or I am not processing it properly.

This is the query which is extracting the records from a couple of tables:


        SELECT    'Start_rec:'        || request_id
         || ':'
         || request_action
         || ':'
         || employee.emp_first_name
         || ' '
         || employee.emp_family_name
         || ':'
         || Vvdisp
         || ':'
         || request_date || ':' || change_reason,
         REQUEST_INFO
    FROM requests, employee, validvalue
   WHERE requests.requested_by = employee.employee_id
            AND requests.request_status = validvalue.vvvalue
            AND validvalue.dmid = 'REQSTATUS'
            AND request_in_version = '880'
            AND request_action NOT IN ('DL','OP','ME','NE','NI','NS', 'DS')
            AND request_status = 'N'
       ORDER BY request_id;

Following is a sample from the first field (from start rec to change_reason):

Start_rec:2302:ND:Yoodit Didit:New Request:24-JUL-11:new domain for reports - copy from self 
Constant - value 56

In excel only this is what is displayed, for change_reason:

new domain for repo

Please help me resolve the above issue as I want the whole information irrespective of how many tabs or new line characters are present in the request.

Thank you all in anticipation.

just use sqlplus to create a tab-delimited file for you. You can send the tab-delimited file directly to users. Excel will convert it. Correctly

set colsep '  '

The "space" between the ' ' came from pushing the tab key.

This avoids the problem you are having - users entering wierd characters into description fileds. Oracle takes them fine. Your code breaks when someone uses a '|' character, or maybe a & character.

1 Like