Пожалуйста, смотрите мой простой тест после вашего описания.
Данные:
![enter image description here](https://i.stack.imgur.com/h9qhz.png)
Хранимая процедура:
function sample(prefix) {
var collection = getContext().getCollection();
var query = {query: "SELECT c.id,c.number FROM c offset @num limit 1", parameters:
[{name: "@num", value: prefix}]};
console.log(query);
var isAccepted = collection.queryDocuments(
collection.getSelfLink(),
query,
function (err, feed, options) {
if (err) throw err;
// Check the feed and if empty, set the body to 'no docs found',
// else take 1st element from feed
if (!feed || !feed.length) {
var response = getContext().getResponse();
response.setBody('no docs found');
}
else {
var response = getContext().getResponse();
response.setBody(feed);
}
});
if (!isAccepted) throw new Error('The query was not accepted by the server.');
}
Введите:
![enter image description here](https://i.stack.imgur.com/waa3y.png)
Выход:
![enter image description here](https://i.stack.imgur.com/ibhEE.png)