Re: [sqlite] Procedure (Conditional statement) workaround

2011-12-20 Thread Petite Abeille
On Dec 20, 2011, at 9:52 PM, Nico Williams wrote: > It'd be nice to have recursive queries (with tail-call optimization). Yes for recursive with clauses! http://gennick.com/with.html > Then a lot of things get easier. Like solving that damn sodoku puzzle: Solving a Sudoku using Recursive

Re: [sqlite] Procedure (Conditional statement) workaround

2011-12-20 Thread Nico Williams
On Tue, Dec 20, 2011 at 5:21 AM, John Gillespie wrote: > This would make a good entry for an Obfuscated SQL contest. > Well done Thanks, I guess :) It was a fun little SQL ditty to write, and only took a few minutes. (Now I do I a search and see that factorial in SQL is

Re: [sqlite] Procedure (Conditional statement) workaround

2011-12-20 Thread John Gillespie
This would make a good entry for an Obfuscated SQL contest. Well done John On 19 December 2011 21:43, Nico Williams wrote: > You can do conditionals via WHERE clauses, as others have pointed out. > You can also use WHEN clauses on triggers. > > Think of it as IF .

Re: [sqlite] Procedure (Conditional statement) workaround

2011-12-19 Thread Nico Williams
You can do conditionals via WHERE clauses, as others have pointed out. You can also use WHEN clauses on triggers. Think of it as IF . And remember that the WHERE clause can refer to all sorts of things, including parameters from the application (something like WHERE @foo = 1). You can do

Re: [sqlite] Procedure (Conditional statement) workaround

2011-12-17 Thread Abhishek Bhatnagar
One can essentially do a "if exists" on the column value they want to check, and recurse it many times. As an example, you could go select * from table where exists (select colName from table where colName = 7); If the nested select statement returns one or more rows, then it will return a

Re: [sqlite] Procedure (Conditional statement) workaround

2011-12-13 Thread Simon Slavin
On 13 Dec 2011, at 11:04pm, Grace Batumbya wrote: > Since SQLite does not support stored procedures, what are some workarounds > that are used to accomplish things like executing a statement based on a > conditional. Triggers and programming languages. Simon.

Re: [sqlite] Procedure (Conditional statement) workaround

2011-12-13 Thread Igor Tandetnik
On 12/13/2011 6:38 PM, BareFeetWare wrote: If depends on what your statement 1 and statement 2 are. Let's say that they are update statements, then your above example would look something like: update tableX set column2 = 'match' where "column" = 'foo'; update tableX set column2 = 'no match'

Re: [sqlite] Procedure (Conditional statement) workaround

2011-12-13 Thread BareFeetWare
On 14/12/2011, at 10:04 AM, Grace Batumbya wrote: > Since SQLite does not support stored procedures, what are some workarounds > that are used to accomplish things like executing a statement based on a > conditional. > For example. > > IF value OF column IN tableX == 'foo' > DO statement 1 >

Re: [sqlite] Procedure (Conditional statement) workaround

2011-12-13 Thread Igor Tandetnik
On 12/13/2011 6:04 PM, Grace Batumbya wrote: Hey guys, Since SQLite does not support stored procedures, what are some workarounds that are used to accomplish things like executing a statement based on a conditional. For example. IF value OF column IN tableX == 'foo' DO statement 1 ELSE

[sqlite] Procedure (Conditional statement) workaround

2011-12-13 Thread Grace Batumbya
Hey guys, Since SQLite does not support stored procedures, what are some workarounds that are used to accomplish things like executing a statement based on a conditional. For example. IF value OF column IN tableX == 'foo' DO statement 1 ELSE statement 2 Thanks, -- *Grace Batumbya* Research