- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Print the field value in a single line in the ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2008 07:47 AM
тАО03-29-2008 07:47 AM
Print the field value in a single line in the file
I am writing a plsql script to fetch the table data and write it into the unix file.
I am preparing a select statement in the FOR loop. The fields are selected and displayed while writing. One of the field holds the letter of 100 character.
But while printing it is not printed in single line instead it is traversing into miltiple lines.
the part of the code is
FOR i in (
SELECT trim(substr(DESC_TXT,1,100)) P3_DESC)
from table
where ...
LOOP
utl_file.putf(fp,'%s',rpad(i.p3_desc,100));
utl_file.fflush(fp);
END LOOP;
IDEAL OUTPUT should be
======================
OEM RoHS Compliant Universal Supply ROHS
but the ACTUAL O/P is
=====================
OEM RoHS Compliant Universal
Supply ROHS
Could anyone help me to how to print the value in the single line.
Appreciate your help.
Regards
Sasikala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2008 08:02 PM
тАО03-29-2008 08:02 PM
Re: Print the field value in a single line in the file
Now if it works on say Windows, but not on HPUX, then you are correct posting here first, but there is no indication of that.
>> But while printing it is not printed in single line instead it is traversing into miltiple lines.
Could it be that the file is fine, but that the printing that is wrapping for you?
Did you check with 'vi' or better still, od -c?
Just create a file with a long line:
#perl -le 'print "X" x 200' > x
not print:
#cat x
and check:
#od -x c
The provided example, which may well be out of context, seems to porivde an interesting example of program bloat.
- Why first TRIM only to PAD back to the same length right after?
- Why use formatted IO when just replacing the entire argument using "%s".
Just use UTL_FILE.PUT !?
Good luck!
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2008 01:56 AM
тАО04-01-2008 01:56 AM
Re: Print the field value in a single line in the file
can you confirm if the field does not have any hidden characters like chr(10)?
Then, for example, you can eliminate all the trailing invisible characters (chr(10) using a similar query:
e.g.
select col1, trim(trailing chr(10) from col2) "TRIM" from test;
revert!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2008 05:18 AM
тАО04-01-2008 05:18 AM
Re: Print the field value in a single line in the file
Yes the field has the control character.
And i got the way to bring the result to single line. Please find the
REGEXP_REPLACE(rpad((substr(P3.DESC_TXT,1,100)),100), '[[:cntrl:]]{1}', ' '),
The REGEXP_REPLACE replaces here the control character to space so that all the infomation comes in single line.
Thanks
Sasikala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2008 05:29 AM
тАО04-01-2008 05:29 AM
Re: Print the field value in a single line in the file
thank you for the feedback.
Please close this thread if this issue has been resolved.
All the best.
kind regards
yogeeraj