Patnaik, Anjela <[email protected]>
wrote: 
> I need to run the following query on a table. How would i formulate
> this in SQLite as it appears that SQLite doesn't do PL/SQL? 
> 
> I can use the tcl SQLite API or do this via SQLiteSPY, but SQLitespy
> doesn't understand the constructs. 
> 
> Thanks
> 
> DECLARE
>   TYPE OpList IS TABLE OF VARCHAR2(100);
>   lcount NUMBER;
>   names OpList ;
>   BEGIN
> 
>  select distinct operation BULK COLLECT INTO names from MYTAB where
> ocrelease  like '10.0.0'; 
> 
>  for indx in names.first..names.last loop
>       select count(*) into lcount from MYTAB where release like
>       '10.0.0' and  operation like names(indx);
>  dbms_output.put_line(names(indx)||' = '||lcount); end loop;
> 
> END;

select t1.operation, count(*)
from MYTAB t1 join MYTAB t2 on (t1.operation = t2.operation)
where t1.ocrelease  = '10.0.0' and t2.release = '10.0.0'
group by t1.operation;

Igor Tandetnik

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to