Precompilers and OCI (MOSC)

MOSC Banner

strings are not transfered correctly

edited Jun 25, 2015 8:17AM in Precompilers and OCI (MOSC) 11 commentsAnswered ✓

drop table arraytest;

create table arraytest (field1 varchar2(4000), D FLOAT, L LONG, T varchar2(50),M

INTEGER);

select * from arraytest;

quit;

The following test program sends some data via OCIBindByPos. It's a general test program that I was using to test various things, so you may

also provide a file data.txt with unmeaningful content just to make it work.

#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <oci.h>
#include <ocidfn.h>

#define BIGBUF 100000

char bigdata[BIGBUF];
void checkerr (OCIError * errhp, sword status);

const char insertSQL[] = "insert into arraytest values ( :1, :2 ,:3, :4,:5)";
/*"2009-07-17-16.05.31" */

char *strColVal[] = { "ABC\rDEFGH\rAAAA\rGGGGGGGGG\r", "111.1", bigdata,"2009-07-17", "56"};

#define MAXBINDS 5
#define NITERS 1
int
main (int argc, char **argv)
{
  int rc = 0,i;
  int status = 0;
  int rowsProcessed = 0;
  int fd;
  struct _stat fstatus;
  char *sid = NULL;
  char *user = NULL;
  char *pwd = NULL;
  char *table = NULL;
  OCIEnv *pEnv = NULL;
  OCIError *pError = NULL;
  OCISvcCtx *pSvc = NULL;
  OCIStmt *pStmt = NULL;
  //OCIBind *pBind = NULL;
  OCIBind

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center