Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL-Pro*C++ : Copying char* into VARCHAR
My question is why did you declare the "dest " variable within the DECLARE
SECTION ?
Wherein you can declare "dest" in the C language.
e.g.
void MyClass::f(char * str)
char dest [20];
{
strcpy (dest,str);
EXEC SQL DECLARE c_sample CURSOR
SELECT * from sampletable where fldvar = :dest ;
}
OR maybe the data from "str" variable contains more than 20 characters.
Serge LUCAS wrote in message <36C08209.A18B7590_at_eurocontrol.fr>...
>I have a littele problem, which must have already be solved by many
>people:
>
>void MyClass::f(char* str)
>{
>EXEC SQL BEGIN DECLARE SECTION;
> VARCHAR dest[20];
>EXEC SQL END DECLARE SECTION;
>
>strcpy(dest,str);
>
>//EXEC SQL INSERT etc...
>}
>
>Since the precompiler transform the VARCHAR as an unsigned char[20], the
>c++ compiler tells me:
>
>Argument type 'unsigned char[20]' does not match expected parameter type
>'const char *'.
>strcpy(dest,str);
> ^^^^
>
>Does anybody has a solution to this very simple problem ?
>
>Thanks!
>--
>Serge LUCAS
>STERIA ATM/Eurocontrol
>BS-012
>Tel 01 69 88 74 15
>Fax 01 69 88 73 33
>Mel lua_at_eurocontrol.fr
Received on Wed Feb 10 1999 - 20:18:01 CST