Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

AW: MaxDB fetch into problem with concatenated data in oracle mode with emb: msg#00254

db.maxdb

Subject: AW: MaxDB fetch into problem with concatenated data in oracle mode with embedded SQL statment in C/C++ programs

Elbertus Lochtenberg wrote:

>
> 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.

Hope, another guy will answer.

>
> 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.

If in tabla a value is stored longer than 20 bytes, then the behaviour
is correct, no matter if the sql-statement was prepared dynamically or
not.
If the same table-content is used and all data is fetched one by one,
you will find even with non-dynamic statement that this error out of the
server will occur.
The question is, what do you want to receive? Column-content, truncated
to 20 bytes (use substr, it will be filled with blanks by the server) or
do you want to have at least 20 bytes, but usually the full
column-content? I cannot imagine what your idea is.

For the crash, always, always send us the info:
Version used
Trace back (can be found in knldiag)
Statement and table definition (as you did)

In this case the table content (or at least the row content making the
server core) should be send to the list (or, in this case, directly to
me).
To shorten the ping-pong of mails, in this case please prepare a vtrace
according to
http://sapdb.2scale.net/moin.cgi/VTrace
but with DEFAULT SELECT instead of DEFAULT in step 1 and 6 and
akbm instead of akb in step 4 and send the result to ... (see above).
If I knew the trace back I could have said if this vtrace-preparation is
worth doing it or not...

BTW: a number (10) may need (in case of negative value or float-value)
more than 10 character for output.

Elke
SAP Labs Berlin

>
> 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
>

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/maxdb?unsub=gcdm-maxdb@xxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
version-control...    qnx.openqnx.dev...    redhat.rhn.user...    ietf.openpgp/20...    mail.mutt.user/...    web.microformat...    java.sync4j.use...    education.ezpro...    user-groups.blu...    solaris.manager...    org.fitug.debat...    technology.erps...    politics.activi...    linux.redhat.fe...    bug-tracking.ma...    xfce.user/2004-...    hams/2004-11/ms...    kde.users.pim/2...    culture.cooking...    freebsd.devel.x...    gnu.m4.adhoc/20...    ngpt.user/2002-...    apple.fink.deve...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation