<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 1 Dec 2008, at 13:38, Giedrius Augys wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br><div class="gmail_quote">2008/12/1 Tilghman Lesher <span dir="ltr">&lt;<a href="mailto:tilghman@mail.jeffandtilghman.com">tilghman@mail.jeffandtilghman.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div class="Ih2E3d">On Monday 01 December 2008 06:15:15 Giedrius Augys wrote:<br> > &nbsp; I'm working with asterisk 1.6. And I have success using func_odbc with<br> > one row query results (SELECT source,destination from cc WHERE ... ):<br> > exten => s,1,Ringing<br> > exten => s,n,Wait(4)<br> > exten => s,n,Answer<br> > exten =><br> > s,n,Set(ARRAY(NUMBER,REALNUMBER1,REALNUMBER2,STATUSAS)=${ODBC_GETVARIABLES(<br> >${NUMERIS})}) exten => s,n,Verbose(1| ${NUMERIS}, ${REALNUMBER1}<br> > ${REALNUMBER1}, ${STATUSAS})<br> ><br> ><br> > But I don't know how to retrieve data, if query returns a lot of rows. In<br> > documentation I read that need to use in config file:<br> > mode=multirow,<br> > and use function ODBC_FETCH. But how to get result-id variable and use<br> > ODBC_FETCH?<br> <br> </div>The initial result in mode=multirow is not data at all, but a query_id that<br> may be used with ODBC_FETCH to return the first row of data and every<br> subsequent row of data (up to the max number of rows, if any).<br> <div class="Ih2E3d"><br> > And another question is, if I execute not SELECT , but stored procedure,<br> > and this procedure will return two, three tables? Is it possible retrieve<br> > these data from couple tables?<br> <br> </div>If you're talking about a JOIN, then yes. &nbsp;As long as the fields have distinct<br> names, then you can retrieve each row in turn, same as any other query.<br> <br> --<br> Tilghman<br> <br> _______________________________________________<br> -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br> <br> asterisk-users mailing list<br> To UNSUBSCRIBE or update options visit:<br> &nbsp; <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br> </blockquote></div><br><br>Thanks for your reply, but I don't get it... Is there any documentation or simple examples how to use ODBC_FETCH and so on.<br><br></blockquote><div><br></div><div>For your own sanity (if nothing else) I'd wrap the stored procedure in a view, then</div><div>get FUNC_ODBC to query that view.</div><div><br></div><div>Tim.</div></div></body></html>