Cycling through cursor in a procedure
Hello, Please is there a flow control syntax for cycling through rows in a cursor in a procedure? I can not find any other solution to how to select highest numbers from a table which total falls under certain threshold. :( I have a function that returns sorted rows and can be used as a subquery and I did not get further ... Thank you, Radovan
Hi MonetDB SQL does not support the CURSOR concept in SQL. For that you could consider using your own key-based cursor generator function. regards, Martin On 31/03/14 14:32, Radovan Bičiště wrote:
Hello, Please is there a flow control syntax for cycling through rows in a cursor in a procedure? I can not find any other solution to how to select highest numbers from a table which total falls under certain threshold. :( I have a function that returns sorted rows and can be used as a subquery and I did not get further ... Thank you, Radovan _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
Hi, Thank you for the tip!!! I'm going to try that. Radovan On 03/31/2014 02:35 PM, Martin Kersten wrote:
Hi
MonetDB SQL does not support the CURSOR concept in SQL. For that you could consider using your own key-based cursor generator function.
regards, Martin
On 31/03/14 14:32, Radovan Bičiště wrote:
Hello, Please is there a flow control syntax for cycling through rows in a cursor in a procedure? I can not find any other solution to how to select highest numbers from a table which total falls under certain threshold. :( I have a function that returns sorted rows and can be used as a subquery and I did not get further ... Thank you, Radovan _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
Hi Martin,
Is there an example of this in the documentation?
I think it would be very helpful to have a guide of best practice when porting cursor based code although I'm not sure that is possible in general?
Best regards,
Alastair
________________________________________
From: users-list
Hello, Please is there a flow control syntax for cycling through rows in a cursor in a procedure? I can not find any other solution to how to select highest numbers from a table which total falls under certain threshold. :( I have a function that returns sorted rows and can be used as a subquery and I did not get further ... Thank you, Radovan _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
"highest numbers from a table which total falls under certain threshold" do you mean by any chance mean something like select max(MyAttribute) from MyTable where MyAttribute < MyThreshold; ? If so, no cursors required here ... ;-) apologies, in case I missed your point ... Stefan ----- Original Message -----
Hi Martin,
Is there an example of this in the documentation?
I think it would be very helpful to have a guide of best practice when porting cursor based code although I'm not sure that is possible in general?
Best regards,
Alastair
________________________________________ From: users-list
on behalf of Martin Kersten Sent: 31 March 2014 13:35 To: Communication channel for MonetDB users Subject: Re: Cycling through cursor in a procedure Hi
MonetDB SQL does not support the CURSOR concept in SQL. For that you could consider using your own key-based cursor generator function.
regards, Martin
On 31/03/14 14:32, Radovan Bičiště wrote:
Hello, Please is there a flow control syntax for cycling through rows in a cursor in a procedure? I can not find any other solution to how to select highest numbers from a table which total falls under certain threshold. :( I have a function that returns sorted rows and can be used as a subquery and I did not get further ... Thank you, Radovan _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
or if you need the N highest values: select MyAttribute from MyTable where MyAttribute < MyThreshold order by MyAttribute desc limit N; ----- Original Message -----
"highest numbers from a table which total falls under certain threshold"
do you mean by any chance mean something like
select max(MyAttribute) from MyTable where MyAttribute < MyThreshold;
?
If so, no cursors required here ... ;-)
apologies, in case I missed your point ...
Stefan
----- Original Message -----
Hi Martin,
Is there an example of this in the documentation?
I think it would be very helpful to have a guide of best practice when porting cursor based code although I'm not sure that is possible in general?
Best regards,
Alastair
________________________________________ From: users-list
on behalf of Martin Kersten Sent: 31 March 2014 13:35 To: Communication channel for MonetDB users Subject: Re: Cycling through cursor in a procedure Hi
MonetDB SQL does not support the CURSOR concept in SQL. For that you could consider using your own key-based cursor generator function.
regards, Martin
On 31/03/14 14:32, Radovan Bičiště wrote:
Hello, Please is there a flow control syntax for cycling through rows in a cursor in a procedure? I can not find any other solution to how to select highest numbers from a table which total falls under certain threshold. :( I have a function that returns sorted rows and can be used as a subquery and I did not get further ... Thank you, Radovan _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
participants (4)
-
Alastair McKinley
-
Martin Kersten
-
Radovan Bičiště
-
Stefan Manegold