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 boolean true to the parent select, and hence the where will  hold true.

Getting the else to work is more difficult and might  have to be done manually 
in a separate statement based on the ret value  of the previous statement. In 
Java for example, Xerial can be used to return that value.

> 
> ----- Original Message -----
> From: Grace Batumbya <grace.batum...@senecac.on.ca>
> Date: Tuesday, December 13, 2011 6:04 pm
> Subject: Procedure (Conditional statement) workaround
> To: sqlite-users@sqlite.org
> Cc: Carlin Desautels <carlin.desaut...@senecac.on.ca>, Abhishek Bhatnagar 
> <abhishek.bhatna...@senecac.on.ca>
> 

>                -----------------------------------------------------------


| 
> >      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 Assistant | Seneca CDOT 
> >          Phone: 416-491-5050 x3548 
>          > cdot.senecac.on.ca       >      >     
> |-----------------------------------------------------------


   


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to