db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dag.Wan...@Sun.COM (Dag H. Wanvik)
Subject Re: IJ scripting (variables in IJ?)
Date Mon, 01 Feb 2010 23:43:28 GMT
Sylvain Leroux <sylvain@chicoree.fr> writes:

> Hi Thomas,
> Maybe you could use a temporary table to "emulate" variables in IJ?
> In that case you will need to rewrite your procedures as functions.
> Regards,
> Sylvain
> Thomas a écrit :
>> Hi,
>> I would like to execute a series of statements in IJ where the value
>> returned by
>> the function call executed in one statement is passed as a parameter to the next
>> statement calling another procedure.
>> Example:
>> CALL "SF_addClient"('lastname', 'firstname') ==> this function
>> creates a new client record returning the client ID
>> automatically generated which was given to the client)
>> CALL "SF_addClientAddresses"('clientid', ....)
>> ==> this would add some client info into a different table where clientid is a
>> field in this table.
>> With values CALL "SF_addClient"() I can see the return value, but
>> how can I store this in a variable /use the
>> return value in further processing?

IJ does not have variables, but Derby has both procedures and
functions, so do you need to have the value outside the SQL domain?

Perhaps, if you rewrite addClient to a function, could you do something like

> CALL "SF_addClientAddresses"("SF_addClient"('lastname', 'firstname'), ...)

Agreed, this approach is limited if you need the value more than once,
but Sylvain's idea could be used if needed.


>> Is this possible to achieve in IJ?
>> Thanks
> -- 
> sylvain@chicoree.fr
> http://www.chicoree.fr

Dag H. Wanvik, staff engineer
Sun Microsystems, Java Core and Desktop - Java DB/Derby
Haakon VII gt. 7b, N-7485 Trondheim, Norway
Tel: x43496/+47 73842196, Fax:  +47 73842101
Sun IM: dw136674, Yahoo IM: dag_h_wanvik

View raw message