Home IBM Enabling LIMIT and OFFSET in DB2 9.7.2 Enabling LIMIT and OFFSET in DB2 9.7.2 By Antonio Cangiano Posted On June 2, 2010 IBM 5 Comments In order to enable the new LIMIT and OFFSET syntax in DB2 9.7.2, you’ll need to execute the following commands: $ db2set DB2_COMPATIBILITY_VECTOR=MYS $ db2stop $ db2start With this enabled, you’ll be able to execute queries such as: SELECT * FROM users LIMIT 5 SELECT * FROM users LIMIT 5 OFFSET 10 Related Tweet Pin It About The Author Antonio Cangiano Antonio Cangiano is a Software Developer and Technical Evangelist at IBM. He authored 'Ruby on Rails for Microsoft Developers' by Wrox (2009) and 'Technical Blogging' by The Pragmatic Bookshelf (2012). You can follow him on Twitter. More from this author 5 Comments By Leons Petrazickis Posted on June 2, 2010 Wow. Finally. This is tremendous. I’ll enable this in the MediaWiki port shortly.:-) Reply By Arun Srini Posted on June 2, 2010 So what happens if I had already set the compatibility to Oracle? Will I lose the features I already had? like the pl/sql blocks etc?? Reply By Murad Iqbal Posted on May 9, 2012 In my DB 9.7, I am getting SQL exceptions for usage of the LIMIT and OFFSET. After setting db2set DB2_COMPATIBILITY_VECTOR=MYS, nothing changed. Still trying to figure out how to get the LIMIT and OFFSET work. Reply By Antonio Cangiano Posted on May 9, 2012 Have you restarted the server, Murad? $ db2stop $ db2start Reply By Murad Iqbal Posted on May 24, 2012 Yes I did that. But no change. Reply Add a Comment Cancel reply Your email address will not be published. Required fields are marked *Name Email Website Current ye@r * Leave this field empty Notify me of follow-up comments by email.