Thanks. That works. Strange that the STRSQL does not require the casting to work.

"CRPence" <CRPbottle@xxxxxxxxx> wrote in message news:<mailman.1931.1354221121.10847.midrange-l@xxxxxxxxxxxx>...
On 29 Nov 2012 13:14, Lim Hock-Chai wrote:
Below is the error that I'm getting when run it thru RUNSQLSTM:

5770SS1 V7R1M0 100423 Run SQL Statements SVLRSPTST
Record *...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
<<SNIP>>
10 create or replace variable palhc.pinewEncPwd Binary(256) default 'TEST124 ';
<<SNIP>>

MSG ID SEV RECORD TEXT
<<SNIP>>
SQL0303 30 10 Position 1 Variable PINEWENCPWD not compatible
or value too long.


I have never really fully understood the nuances for making
/character/ and /binary/ typed data compatible for the SQL, but the
easiest solution is to CAST the literal explicitly to the desired type.
I thought another option was to specify the literal in hex notation,
e.g. x'E3C5E2E3F1F2F44040', but on v5r3 that resulted in an SQL0408 for
an INSERT.

Try the following for the value to assign-to the variable:

cast( 'TEST124 ' as binary(256) )
-- just BINARY ¿should be sufficient?, but all bad on v5r3 :-(
-- it deposited only the 'T'. For proper 0x00 pad, one might
-- expect cast('TEST124 ' as binary(9)) is more appropriate
-- or required, but the cast to BINARY pads properly IME

--
Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.