Dear Reader,
 
Within my C/C++ program y tried to do get some concatenated data output
within a cursor by using the next query:
 
exec sql declare Cursor_Ocupaciones cursor for
             select rpad(to_char(cod_programa),10,' ') ||
             rpad(rtrim(tabla,' '),20) ||
             rpad(to_char(orden),10,' ')
             from guf_ocupaciones;
 
The columns "cod_programa" and "orden" are defined as number(10).
The column "tabla" is defined as varchar2(100).
 
The output of the fetch is send to the host variable "query_out",
defined as char[1000], and initialised before each fetch with nulls.
 
The first problem consists that after de obtained concatenated data, the
rest of the output buffer (query_out) is filled up to de end with
blanks, and de last charter +1 (out of the buffer size) with the "@"
character. I think the output buffer should contain only the obtained
data ended with a null character.
 
The second problem is that if I try to do the same with dinamic SQL
(prepare, declare, open and fetch), first the open fails (-2010),
indicating that the size indicated in the "rtrim" function on the column
"tabla" should be at least de real column size. When I put the size at
100 (real column size), the program executions end in a core dump.
 
The same query tested in the sql client (websql and sqlcli) seems to
works fine.
 
Best regards
 
Elbertus Lochtenberg
Project Manager     
Teleserver S.A.
Mobile: +34628270643
 

Reply via email to