MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » December 2012

Re: calling sql procedure from interactive SQL session



fixed

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





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact