questa è la select:
codice:
select
tabella.ID,
tabella.importoa,
tabella.importob,
tabella.importoc,
tabella.importoa+tabella.importob+tabella.importob as importotolale,
rdb$set_context('USER_SESSION', 'MyVar', tabella.importoa+tabella.importob+tabella.importob),
rdb$get_context('USER_SESSION', 'MyVar')
from tabella
questo il risultato
codice:
ID IMPORTOA IMPORTOB IMPORTOC IMPORTOTOLALE RDB$SET_CONTEXT RDB$GET_CONTEXT
1 55 2378 3402 4811 1 13425
2 56 2283 3022 4622 1 4811
3 57 5943 5130 11943 1 4622
4 57 2132 2133 4321 1 11943
5 57 4618 4027 9293 1 4321
6 57 6686 6457 13429 1 9293
7 57 6595 4045 13247 1 13429
8 57 2309 4344 4675 1 13247
9 57 5942 6884 11941 1 4675
10 57 6725 4567 13507 1 11941
11 57 4615 4181 9287 1 13507
12 57 6685 2360 13427 1 9287
13 57 6684 6868 13425 1 13427
io pensavo che nella colonna 'rdb$set_context' sarebbe stato memorizzato il valore tabella.importoa+tabella.importob+tabella.importob e assegnato alla variabile MyVar
e poi nella colonna RDB$GET_CONTEXT riuscivo a utilizzare il valore assegnato alla variabile.