Fix fetchnextnumber to work for non-public schema tables

Fix fetchnextnumber() function to work for non-public schema tables.