Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: OCI: How can I insert a string including an amphersand (&) from OCI??

Re: OCI: How can I insert a string including an amphersand (&) from OCI??

From: Finn Ellebaek Nielsen <_remove_fen_remove__at_changegroup.dk>
Date: Sun, 13 Oct 2002 10:11:11 +0200
Message-ID: <3da92a9a$0$3671$edfadb0f@dspool01.news.tele.dk>


Hi Ole.

What does your code look like?

Using OTL -- a generic C++ template interface to Oracle etc. available from http://otl.sourceforge.net/home.htm -- the following simple example that inserts rows into SCOTT.DEPT works with strings containing &:

#include <stdio.h>

#include "otlv32.h"

int main()

{
  try {
    otl_connect connection("scott/tiger_at_o901");     otl_stream statement;

    statement.open(1,

        "insert into dept " \
        "values (" \
        "  :deptno<int>, :dname<char[15]>, :loc<char[14]>" \
        ")",
        connection);

    statement << 90 << "1" << "2";

    statement << 91 << "3" << "4";
    statement << 92 << "&5" << "&6";
  }
  catch (otl_exception &e) {
    printf("Exception: %s\n", e.msg);
  }

  return(0);
}

Cheers,

Finn

"Victor Kaminsky" <victorkaminsky_at_yahoo.de> wrote in message news:90a73003.0210121246.57f6feb1_at_posting.google.com... > Ole Hansen <oha_at_city.dk> wrote in message news:<3DA7F142.7060909_at_city.dk>...

> > Hi,
> >
> > I have troble escaping an amphersand (&) from within OCI.
> > Neither single quote (') or backslash (\) seems to work.
> >
> > The statement fails if I try to execute it from OCI if the string
> > includes an amphersand but I dont know how to escape an amphersand (&).
> >
> > I really need to store the amphersand with the string.
> >
> > Any ideas?
> >
> > Thanks in advance!
> > Ole Hansen
>
> maybe you could use the char() function. it is not nice, but could work
Received on Sun Oct 13 2002 - 03:11:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US