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 -> Pro*C Problem with Oracle!

Pro*C Problem with Oracle!

From: Steven <MEYOU_at_ComPorts.com>
Date: 1997/10/25
Message-ID: <01bce120$a54fba40$0202a8c0@P200.PFamily.com.PFamily.com>#1/1

Hi all,

I have a problem, I have some Pro*C codes which worked before but now they don't.

Here is some sample source code

int inser_some_record(struct dbkey *dbkey,struct dbdata *dbdata)
{

int err;

 EXEC SQL BEGIN DECLARE SECTION;
    char some_data[11]; /* array size is actual field len + 1 */    

    char        some_more[21]; /* array size is actual field len + 1*/
     EXEC SQL END DECLARE SECTION;

    /*ignore dbkey*/
    strcpy(some_data,dbdata->data[0]);
    strcpy(some_more,dbdata->data[1]);    

EXEC SQL INSERT INTO SOME_TABLE
    (FIELD_NAME1,
     FIELD_NAME2
    )
   values
 VALUES
    (:some_data,

     :some_more
  );        

/* ... */
/* ... */
return err; /* error according to sqlcode */ }

With the same code above now I have various errors such as "values is too large for this column" and some other errors.

But by changing the size of character arrays to be exactly the same as their corresponding field size. The code works.

int inser_some_record(struct dbkey *dbkey,struct dbdata *dbdata)
{

int err;

 EXEC SQL BEGIN DECLARE SECTION;
    char some_data[10]; /* array size is actual field len */

    char        some_more[20]; /* array size is actual field len */
     EXEC SQL END DECLARE SECTION;

    /*ignore dbkey*/
    strcpy(some_data,dbdata->data[0]);
    strcpy(some_more,dbdata->data[1]);    

EXEC SQL INSERT INTO SOME_TABLE
    (FIELD_NAME1,
     FIELD_NAME2
    )
   values
 VALUES
    (:some_data,

     :some_more
  );        

Help! is it normal? or am I missing something? In fact I need to solve this problem very urgently, any help would be greatly appreciated.

Regards,

Steven Received on Sat Oct 25 1997 - 00:00:00 CDT

Original text of this message

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