|
Very clever - and "Doh!" - such a simple idea - those are the best
ideas.
Please share with the list your final solution. I think it would be
good for us, the i-community, to have a standard implementation of this,
that we would see if we go from shop to shop. I am curious if you will
run into anything in the implementation that requires more thought (
return values ? maybe ?) or should the 2 decimal just be a standard
message: 3
date: Tue, 25 May 2010 08:30:06 -0400
from: "Dennis Lovelady" <iseries@xxxxxxxxxxxx>
subject: Quick SQL expression evaluation
I am trying to write a procedure I thought would be extremely simple: a
short SQL evaluation program that would simply take an expression and
return the result of SQL operating on that expression. For a silly
example:
Exec sql set :myResult = 2 + 2 ;
To minimize complexity, I am passing the '2 + 2' part as a string, so
that the meat of this very short procedure is:
Exec sql setl :myResult = :myExpression ;
Dennis E. Lovelady
AIM/Skype: delovelady MSN: fastcounter@xxxxxxxxxxxx
<http://www.linkedin.com/in/dennislovelady>
www.linkedin.com/in/dennislovelady --
You can't have everything. Where would you put it?
------------------------------
message: 4
date: Tue, 25 May 2010 14:51:26 +0200
from: "Birgitta Hauser" <Hauser@xxxxxxxxxxxxxxx>
subject: AW: Quick SQL expression evaluation
Try the following:
D MyResult S 11P 2
D String S 256A Varying
D Expr S 256A Varying inz('2 + 2')
/Free
String = 'Values(' + Expr + ') into ?';
/Exec SQL Prepare DynSQL From :String;
/Exec SQL Execute DynSQL using :MyResult;
Dsply MyResult;
/End-Free
Birgitta Hauser
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.