Thanks for you prompt reply.
I added some printf() in string.c and recompiled the library.
I found it returns in the check at function OCI_StringToStringPtr() .
That is wired.
Is the handle in the OCI_Elem struct initialized properly after calling the
OCI_ElemCreate()?
Btw, I didn't encounter problem with OCI_ObjectSetString().
Best,
Xun
________________________________
???: vincent rogier [mailto:vin...@gm...]
????: 2009?11?9? ??? 18:47
???: Xun Chen
??: Re: ??: [Bulk] [Orclib-users] how to pass a varray of varchar2 to oracle
database using ocilib
the check is normal...
OCI_ElemSetString() calls OCI_ElemSetNull() is the passed string is null and
OCI_StringToStringPtr() if not.
2009/11/9 Xun Chen <ch...@av...>
Hi Vincent,
Thanks for your reply.
But I found that the function OCI_ElemSetString() always returns
false.
It returns false when performing the check of
OCI_CHECK(str == NULL, FALSE);
in line 664 of the source file string.c.
Best regards,
Xun
________________________________
???: vin...@gm... [mailto:vin...@gm...] ??
vincent
rogier
????: 2009?11?9? ??? 18:05
???: Xun Chen
??: Re: [Bulk] [Orclib-users] how to pass a varray of varchar2 to
oracle
database using ocilib
Hi Xun,
there is a error in your code.
It should be :
/* .. */
type = OCI_TypeInfoGet(conn, "string_array20",
OCI_TIF_TYPE);
vchars = OCI_CollCreate(type);
elem = OCI_ElemCreate(type);
for (i=0; i<n; i++) {
OCI_ElemSetString(elem, s[i]));
OCI_CollAppend(vchars, elem);
}
/* .. */
Regards,
Vincent
2009/11/9 Xun Chen <ch...@av...>
Hi,
I want to call a procedure which take a varray of varchar2 as
a in
parameter.
As a test, I write the following code to set the data
OCI_Coll * vchars;
OCI_Elem * elem;
OCI_TypeInfo *type;
char s[5][64];
int n;
strcpy(s[0], "2009-01-04 11:22:15");
strcpy(s[1], "2009-03-14 01:12:25");
strcpy(s[2], "2009-04-24 11:42:35");
strcpy(s[3], "2009-05-04 21:52:45");
strcpy(s[4], "2009-06-04 13:32:55");
....
n=5;
type = OCI_TypeInfoGet(conn, "string_array20",
OCI_TIF_TYPE);
vchars = OCI_CollCreate(type);
for (i=0; i<n; i++) {
elem = OCI_ElemCreate(type);
OCI_ElemSetColl(elem, vchars);
OCI_ElemSetString(elem, s[i]));
OCI_CollAppend(vchars, elem);
}
where string_array20 is defined by following pl/sql
statement:
create type string_array20 is varray(20) of varchar2(64);
Run the code show following message:
Elements are not compatible.
It seems that I should not use OCI_ElemSetString() here. If
so, what
should I do to pass
such a data type to the database?
Best regards,
Xun
----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal
Reports 2008
30-Day
trial. Simplify your report design, integration and
deployment - and
focus on
what you do best, core application coding. Discover what's
new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Orclib-users mailing list
Orc...@li...
https://lists.sourceforge.net/lists/listinfo/orclib-users
--
Vincent Rogier
--
Vincent Rogier
|