Hi, I'm sorry for spamming so much, but I have to get more into the idea of BATs before I will be a little more self-sufficient. I need a function which takes two table columns as parameters. I would come up with this MAL declaration: command build_chunks(ra:bat[:oid,:dbl], dec:bat[:oid,:dbl], nside_low:int, nside_high:int):bat[:oid,:oid] address OSPSbuild_chunks comment "Build HEALPix groups for further processing."; It should take ra, dec parameters (from my DB table) and then some integer parameters. I guess it should return an oid, because all it does is that it should write some computed result (multiple rows) to another table. I have still no idea how I will do that, but I feel I'm getting closer J. The function produces a c++ vector of some integers, which I want to write down to another table. Is that MAL declaration looking correct? How should I call that function? I understand that SELECT reverse('hello'), but I don't know when the parameter is passed from a query. Thank you very much for pointing me in the right direction. Best regards, Jiri Nadvornik Astronomical Institute AV CR Stellar department Czech Republic mailto:nadvornik.ji@gmail.com nadvornik.ji@gmail.com