on ‎2015 Mar 19 10:41 AM
Hello, I recently updated from sybase 9 to 16, big jump! With minimal modifications, everything is working, except one stored procedure that uses execute immediate to return a table with arbitrary columns, row and types. The error I get is: "returned a result set with a different schema than expected SQLCODE=-866, ODBC 3 State="HY000"". So this is the code:
/////////////////////////////////////////////////////////////
ALTER PROCEDURE TouchDB.tc_get_parametre_valeur_table(in arg_id_session char(40), in arg_id_parametre integer, in arg_valeur long varchar)
begin
declare ls_select long varchar;
declare ls_executeur long varchar;
declare ls_dynamique char(1);
select tc_parametre.executeur, tc_type_parametre.dynamique into ls_executeur, ls_dynamique
from dba.tc_parametre INNER JOIN dba.tc_type_parametre on
tc_parametre.id_tc_type_parametre = tc_type_parametre.id_tc_type_parametre
where id_tc_parametre = arg_id_parametre;
if ls_executeur IS NOT NULL AND ls_dynamique IS NOT NULL THEN
set ls_select = 'select * from ' || ls_executeur || '(' || arg_valeur || ')';
execute immediate WITH RESULT SET ON ls_select;
else
select '';
end if;
end;
/////////////////////////////////////////////////////////////
Any idea?
Thanks for the help and have a nice day, Louis-Philipe
Request clarification before answering.
Try turning client statement plan caching off altogether (you are probably interested in the Power And Glory Of SQL rather than Third-Order Performance Effects anyway 🙂
See max_client_statements_cached option
See max_plans_cached
There have been a bazillion performance [cough] improvements between V9 and 16 so it's quite possible one of them is biting you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Note, in my understanding client statement caching should only have an effect here if the same client issues an identical SQL statement (i.e. including the same parameters IMHO) several times - whereas the statement with the contained procedure call seems to vary between calls... (at least that's my impression).
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.