dbTalk Databases Forums  

Write text data in pseudo-packed format

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Write text data in pseudo-packed format in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Luke
 
Posts: n/a

Default Write text data in pseudo-packed format - 08-30-2010 , 02:52 PM






Hello,

Oracle 11.2.0.1.0 running on SunOS 5.10.

I have a problem extracting data and writing it to a flat file with PL/
SQL and can use
some help.

I am extracting and writing records in ebcidic character set to an
output file
using UTL_FILE, 'WB' (write binary) mode and UTL_PG (to write packed
decimal
output).

HEXTORAW, UTL_RAW.CAST_TO_RAW and UTL_PG.NUMBER_TO_RAW_FORMAT with
UTL_FILE.PUT_RAW
have provided the formatting options that I have needed except for the
followng case:

The database column is CHAR(6) and contains lower case data, e.g.,
'aaaaaa'.

This CHAR(6) column needs to be written to the flat file as 3 bytes,
sort of a
pseudo-packed format, similar to packed decimal but non-numeric text.

HEXTORAW ( 'aaaaaa' ) writes 3 non-displayable bytes, with hex value
x'AAAAAA'
(upper case).

Close, but I need it to write those 3 bytes as lower case.

UTL_RAW.CAST_TO_RAW ( CONVERT ( 'aaaaaa' , 'WE8EBCDIC500' ,
'US7ASCII' ) )
writes 6 displayble lower case bytes: 'aaaaaa'.

Correct case, too many bytes.

Can anyone suggest a solution to this?

TIA

Luke

Reply With Quote
  #2  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Write text data in pseudo-packed format - 09-03-2010 , 05:16 AM






On Aug 30, 3:52*pm, Luke <luke_ai... (AT) hotmail (DOT) com> wrote:
Quote:
Hello,

Oracle 11.2.0.1.0 running on SunOS 5.10.

I have a problem extracting data and writing it to a flat file with PL/
SQL and can use
some help.

I am extracting and writing records in ebcidic character set to an
output file
using UTL_FILE, 'WB' (write binary) mode and UTL_PG (to write packed
decimal
output).

HEXTORAW, UTL_RAW.CAST_TO_RAW and UTL_PG.NUMBER_TO_RAW_FORMAT with
UTL_FILE.PUT_RAW
have provided the formatting options that I have needed except for the
followng case:

The database column is CHAR(6) and contains lower case data, e.g.,
'aaaaaa'.

This CHAR(6) column needs to be written to the flat file as 3 bytes,
sort of a
pseudo-packed format, similar to packed decimal but non-numeric text.

* HEXTORAW ( 'aaaaaa' ) writes 3 non-displayable bytes, with hex value
x'AAAAAA'
* (upper case).
I think you do not understand what you have there. A binary value is
not uppercase or lower case.

Quote:
* * Close, but I need it to write those 3 bytes as lower case.

* UTL_RAW.CAST_TO_RAW ( CONVERT ( 'aaaaaa' , 'WE8EBCDIC500' ,
'US7ASCII' ) )
* writes 6 displayble lower case bytes: 'aaaaaa'.

* * Correct case, too many bytes.

Can anyone suggest a solution to this?

TIA

Luke
I still don't see the problem. Binary is Binary, Maybe if you explain
the whole process (IOW include what the consumer of that file
expects.)

Ed

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.