Re: [Virtuoso-users] Help with stored procedure

2011-11-24 Thread Sebastian Trüg
On 11/24/2011 01:31 PM, Ivan Mikhailov wrote: > Sebastian, > > On Thu, 2011-11-24 at 13:16 +0100, Sebastian Trüg wrote: >> Hi Ivan, >> >> thanks a lot for your proposal. It is almost identical to what I ended >> up doing. Except for the last few lines where I used: >> >>foreach(any row in

Re: [Virtuoso-users] Help with stored procedure

2011-11-24 Thread Ivan Mikhailov
Sebastian, On Thu, 2011-11-24 at 13:16 +0100, Sebastian Trüg wrote: > Hi Ivan, > > thanks a lot for your proposal. It is almost identical to what I ended > up doing. Except for the last few lines where I used: > >foreach(any row in rows) do > { > cnt := cnt + 1; >

Re: [Virtuoso-users] Help with stored procedure

2011-11-24 Thread Sebastian Trüg
Hi Ivan, thanks a lot for your proposal. It is almost identical to what I ended up doing. Except for the last few lines where I used: foreach(any row in rows) do { cnt := cnt + 1; result(sprintf('sparql clear graph <%s>', row[0])); if(state <> '0

Re: [Virtuoso-users] Help with stored procedure

2011-11-24 Thread Ivan Mikhailov
Hello Sebastian, Consider this: create procedure nrl_drop_graphs(in query_base varchar, in query_params any := null) { declare stat, msg varchar; declare metas, rset any; stat := '0'; if (query_params is null) query_params := vector (); exec ('sparql ' || query_base, stat, msg,

Re: [Virtuoso-users] Help with stored procedure

2011-11-24 Thread Mitko Iliev
Hi Sebastian, You cannot declare cursor as a statement string, the cursor can be declared as : declare cr cursor for select x from table where ... In your case when you need to execute a statement give to the procedure as string literal, you can use exec () and and exec_next () , see http://docs

[Virtuoso-users] Help with stored procedure

2011-11-23 Thread Sebastian Trüg
Hello list, I am trying to write a stored procedure which deletes a set of graphs matching a query. This is what I have so far: create procedure nrl_drop_graphs(IN QUERY_BASE STRING) { DECLARE query STRING; query := query_base + ' LIMIT 1000'; declare cnt integer; cnt := 0;