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

Home -> Community -> Usenet -> c.d.o.misc -> Assigning text in an OCIString

Assigning text in an OCIString

From: Herode <cbrun_at_geomapgis.com>
Date: 17 Mar 2006 07:40:46 -0800
Message-ID: <1142610046.879370.179780@e56g2000cwe.googlegroups.com>


I've tried the sample code of Oracle's documentation. I had to make small changes, since the initial code does not compile... Unfortunately, the final code compiles, but does not work. The OCIString pointer points to a NULL string. Coul you tell me what I'm doing wrong ????
[code]

  OCIString     *vstring1 = (OCIString *)0;
  char          c_string[20];
  sword        status;

  strcpy(c_string, "hello world");
  ub4 lg = strlen(c_string);
/* Assign a text string to an OCIString */
  status = OCIStringAssignText( m_pEnv, m_pErr, (text*) c_string, lg, &vstring1);
/* Memory for vstring1 is allocated as part of string assignment */
  text* ptr = OCIStringPtr( m_pEnv, vstring1 ); [/code]
After the call to OCIStringPtr, ptr == NULL. NB : m_pEnv & m_pErr are allocated & valid

Regards,
C. Received on Fri Mar 17 2006 - 09:40:46 CST

Original text of this message

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