I'm with Martin... It probably depends on the client software and/or database interface you are using.
For example, if you are using PowerBuilder and ODBC, you might have to use SELECTBLOB to get anything over 32,767 bytes in length (see sample code below).
As Martin suggests, consider dbisql in SQL Anywhere 11.0.1... it's just another client program, and it defaults to a small value (256?) in the Tools - Options - SQL Anywhere - Results - Truncation length field. The effect of that truncation shows up if you run a SELECT and then do right mouse - Copy - Copy cell, and then paste into Wordpad or whatever. Change the Truncation length to a huge number like 1000000 and then the copy and paste works.
Here's the PowerBuilder 10.5 sample code... pay close attention to the various length values shown in the MessageBox display at the end, especially the funky doubled-length 549748:
Long ll_proc_length
String ls_proc_name
String ls_source
Blob lb_source
SQLCA.DBMS = 'ODB'
SQLCA.DBParm &
= "ConnectString='DSN=foxhound'," &
+ "ConnectOption='SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT'"
CONNECT USING SQLCA;
IF SQLCA.SQLCODE 0 THEN
MessageBox ( 'Error', &
'CONNECT failed in bbb:' &
+ '~r~nSQLCode = ' &
+ String ( SQLCA.SQLCode ) &
+ '~r~nSQLDBCode = ' &
+ String ( SQLCA.SQLDBCode ) &
+ '~r~n' &
+ SQLCA.SQLErrText )
RETURN
END IF
SELECT TOP 1
LENGTH ( SYSPROCEDURE.source ) AS proc_length,
SYSPROCEDURE.proc_name,
SYSPROCEDURE.source
INTO :ll_proc_length,
:ls_proc_name,
:ls_source
FROM SYSPROCEDURE
WHERE USER_NAME ( SYSPROCEDURE.creator ) = 'DBA'
ORDER BY proc_length DESC
USING SQLCA;
IF SQLCA.SQLCODE 0 THEN
MessageBox ( 'Error', &
'SELECT failed:' &
+ '~r~nSQLCode = ' &
+ String ( SQLCA.SQLCode ) &
+ '~r~nSQLDBCode = ' &
+ String ( SQLCA.SQLDBCode ) &
+ '~r~n' &
+ SQLCA.SQLErrText )
RETURN
END IF
SELECTBLOB SYSPROCEDURE.source
INTO :lb_source
FROM SYSPROCEDURE
WHERE SYSPROCEDURE.proc_name = :ls_proc_name
USING SQLCA;
IF SQLCA.SQLCODE 0 THEN
MessageBox ( 'Error', &
'SELECTBLOB failed:' &
+ '~r~nSQLCode = ' &
+ String ( SQLCA.SQLCode ) &
+ '~r~nSQLDBCode = ' &
+ String ( SQLCA.SQLDBCode ) &
+ '~r~n' &
+ SQLCA.SQLErrText )
RETURN
END IF
MessageBox ( "SELECT and SELECTBLOB", &
String ( ll_proc_length ) &
+ '~r~n' &
+ ls_proc_name &
+ '~r~n' &
+ String ( Len ( ls_source ) ) &
+ '~r~n' &
+ String ( Len ( lb_source ) ) &
+ '~r~n' &
+ ls_proc_name &
+ '~r~n' &
+ Mid ( String ( lb_source ), 1, 500 ) &
+ '~r~n' &
+ " ... " &
+ '~r~n' &
+ Mid ( String ( lb_source ), ll_proc_length - 500 ) )
MessageBox ( "Everything", "OK" )
...and yes, there is a 269K stored procedure in Foxhound :)
answered
13 Jan '10, 12:33
Breck Carter
32.5k●539●724●1050
accept rate:
20%