Re: *********** Pro*C Question *********

From: Hans Forbrich <forbrich_at_tibalt.supernet.ab.ca>
Date: 24 Jun 1994 10:31:59 -0600
Message-ID: <2uf1pv$8en_at_tibalt.supernet.ab.ca>


vkwan1_at_vaxa.hofstra.edu wrote:
> In article <2u0ff1$sij_at_gaia.cc.gatech.edu>, badri_at_cc.gatech.edu (badri) writes:
> > Dear Friends:
> >
> > I am facing a baffling Pro*C behavior. I do the following
> > in Pro*C.
> >
> > Program 1:
> > char my_string[16];
> > VARCHAR sqlcmd[256];
> >
> > sprintf (sqlcmd.arr, "insert into my_table values
> > ('%s')", my_string);
> > sqlcmd.len=strlen(sqlcmd.arr);
 

> |-- sqlcmd.len
 

> >
> > Program 2:
> > char my_string[16];
> >
> > EXEC SQL DECLARE C1 CURSOR FOR
> > SELECT * FROM my_table
> > WHERE only_attribute = my_string;
> >
> >
> > Sure enough the query in program 2 returns nothing! When
> > I print my_string on both the programs, they give the identical
> > value.
> >

> I have the same problem in this case too. It looks like Oracle Proc*C
> doesn't suport wild card.
> However, if I am wrong, or if anyone has a solution, please post it.
> I will appreciate that.
 

> V. Kwan
> Oracle Database Application Developer
> vkwan1_at_vaxb.hofstra.edu

Program 2, as written, does not refer to an oracle value. Should be:

	WHERE only_attribute = :my_string;
			       ^
			       +-- defined in EXEC SQL BEGIN DECL...;

else it is looking for a column or internal called my_string.

Also, when using wildcard, don't forget to use the LIKE keyword instead of '='.

/Hans Received on Fri Jun 24 1994 - 18:31:59 CEST

Original text of this message