Re: ecpg weird behavior
От | Thomas Lockhart |
---|---|
Тема | Re: ecpg weird behavior |
Дата | |
Msg-id | 3C9805FC.1F69702D@fourpalms.org обсуждение исходный текст |
Ответ на | ecpg weird behavior ("Nicolas Bazin" <nbazin@ingenico.com.au>) |
Список | pgsql-interfaces |
> > ... have an Oracle extension to use a cursor to select multiple > > rows into variables declared as arrays. Have you run into this syntax or > > thought about what it would take to implement it? > Do you mean like this: > exec sql begin declare section; > int amount[6]; > char name[6][8]; > exec sql end declare section; > ... > exec sql select * into :name, :amount from "Test"; No (although I was not aware that the above would work). The example looks like exec sql begin declare section; char *name_arr[10]; exec sql end declare section; exec sql declare names cursor for select name from horses; strcpy(msg, "open"); exec sql open names; exec sql fetch names into :name_arr; exec sql close names; So the syntax uses a cursor fetching into an array, rather than a "select into". A couple of details on behavior from the Oracle docs: Each FETCH returns, at most, the number of rows in the array dimension. Fewer rows are returned in the following cases: <snip cases> The cumulative number of rows returned can be foundin the third element of sqlerrd in the SQLCA, called sqlerrd[2] in this guide. The Oracle docs at the following URL are consistant with the examples I was seeing: http://www-rohan.sdsu.edu/doc/oracle/server803/A54661_01/arr.htm#512 I'm guessing that this is a relatively short hop from your existing array capabilities, but don't how close. What do you think? - Thomas
В списке pgsql-interfaces по дате отправления: