Not possible in SQL. "b.answer || a.epxr" is a string. It does not get 
evaluated. Unless you write your own eval() function that executes its 
parameter as an SQL statement, which is going to be very slow as each result 
row needs to prepare, step and finalize its very own statement.

-----Ursprüngliche Nachricht-----
Von: Keshav Tadimeti [mailto:ktadim...@aol.com]
Gesendet: Mittwoch, 02. Juli 2014 20:18
An: sqlite-users@sqlite.org
Betreff: [sqlite] evaluate expression stored in a column

Hello all

I have the following requirement:

Table a
--------
id int
expr text
result integer

Insert into a values (10,' > 2');

Table b
-------
id int
answer text

Insert into b values (10,'10');

I need to evaluate the condition that 10 > 2 and store the result of that 
expression in a.result.

I am failing to have the expression evaluated.

select b.answer || a.expr from a inner join b on a.id = b.id; -- gives 10
> 2
I need to see 1 (since 10 > 2).

Kindly help!!

Best
--
Using Opera's mail client: http://www.opera.com/mail/ 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


-----------------------------------------------------------------------
Gunter Hick
Software Engineer

Scientific Games International GmbH
Klitschgasse 2 – 4, A - 1130 Vienna,
Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This e-mail is confidential and may well also be legally privileged. If you 
have received it in error, you are on notice as to its status and accordingly 
please notify us immediately by reply e-mail and then
delete this message from your system. Please do not copy it or use it for any 
purposes, or disclose its contents to any person as to do so could be a breach 
of confidence. Thank you for your cooperation.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to