How to check byte length of data?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

How to check byte length of data?

Post by chulett »

Got the dreaded 'ORA-12899 value too large for column' error because somehow a two character field got some multi-byte crappola in it and it won't fit in an Oracle VARCHAR2 field defined as 2 bytes rather than characters. :evil:

Is there an expedient way to check the byte length of a string? May need to end up making this check in multiple fields in 20+ million records, hence the need for speed.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How about Len(StringToRaw(InLink.TheString)) ?

Or ByteLen(InLink.TheString) in a BASIC Transformer stage ?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Craig - we had to put in a BASIC transform stage in order to figure out byte lengths, basically we had to parse a very long string into multiple Oracle strings and they could contain multibyte data and the BASIC ByteLen() was our first choice. I think we've now replaced that with a BuildOp because the BASIC transform stage caused sporadic production hangups.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Thanks guys. I'll check these options out today, hopefully.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ray.wurlod wrote:How about Len(StringToRaw(InLink.TheString)) ?
This I can't even get to compile. Depending on the output data type it either complains about an "Invalid conversion requested from a string to a raw" or "from an int32 to a raw". :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
aaryabhatta
Premium Member
Premium Member
Posts: 20
Joined: Mon Dec 19, 2005 10:00 pm
Location: UK

Post by aaryabhatta »

chulett wrote:
ray.wurlod wrote:How about Len(StringToRaw(InLink.TheString)) ?
This I can't even get to compile. Depending on the output data type it either complains about an "Invalid conversion requested from a string to a raw" or "from an int32 to a raw". :?
Hi Craig,

Have you managed to find the solution for this please?
My requirement is to supress multi byte characters from loading to Oracle.

Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Heck, I'm not working for that client any longer and I forget what we ended up actually doing for this. :(

Tell us what you mean by needing to "suppress" multi-byte characters.
-craig

"You can never have too many knives" -- Logan Nine Fingers
aaryabhatta
Premium Member
Premium Member
Posts: 20
Joined: Mon Dec 19, 2005 10:00 pm
Location: UK

Post by aaryabhatta »

chulett wrote:
Tell us what you mean by needing to "suppress" multi-byte characters.
I am trying to load around 200 million records to Oracle db, but some records seem to contain multi byte characters due to which Oracle load is failing.

I don't want the job to abend, instead I want to capture all those such records and continue with the rest of the records.

So I am trying to identify these records before the Oracle stage, for example in a transformer but so far failed to do so.

Any ideas please?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Add a reject link to your Oracle Enterprise stage or Oracle Connector.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
aaryabhatta
Premium Member
Premium Member
Posts: 20
Joined: Mon Dec 19, 2005 10:00 pm
Location: UK

Post by aaryabhatta »

Those records are not getting rejected through Oracle Enterprise stage but causing the job to fail.

The specific error that I am getting is:

ORA-12899: value too large for column
dsedi
Participant
Posts: 220
Joined: Wed Jun 02, 2004 12:38 am

Post by dsedi »

If you can not think ALTER DATABASE CHARACTER SET then this link may educate/help you to write a routine to handle Multibyte Characters.
would be happy to see any working solution here.. :D
Accept that some days you're the pigeon and some days you're the statue.
Post Reply