How to insert, select LONG, LONG RAW COLUMNS?

From: Jenny Barrett <jbarrett_at_s.psych.uiuc.edu>
Date: 1 Sep 1994 20:13:22 GMT
Message-ID: <345cl2$sik_at_vixen.cso.uiuc.edu>


        I am stuck on the following problem and would really appreciate some help!

        Has anyone had any experience with inserting LONG or LONG RAW into columns and then selecting them using Oracle call interfaces? Does one use VARCHAR2 (code 1) or code 24 as the ftype in the obndrv call when binding the program variables in preparation for for the insert statement?

        This is the way I set up my obndrv call:

	indp = 0;
       	if (obndrv(&cda,                        /* cursor */

(text *) ":longraws", /* sqlvar */
-1, /* sqlvl */
(ub1 *) longraws, /* progv */
numPts + 4, /* progvl */
(sword) VARCHAR2, /* ftype */
-1, /* scale */
(sb2 *) &indp, /* indp */
(text *) 0,
-1, -1))

longraws is the 8th column in the table and is of type LONG RAW. (Actually, I have tried using both LONG and LONG RAW). In the local program longraws is an array of type ub1. The array is of size numPts + 4. When I run my program it seems to be putting a NULL into that column.

In my program for selecting the long raw columns, I defined the output variable as a VARCHAR2:

	    if (odefin(&cda, 
		(sword) 8, 
		data_area, 
		numPts + NUMBYTES,
                (sword) VARCHAR2, 
		(sword) -1, (sb2 *) 
		&indp, 
		(text*) 0,
                (sword) -1, (sword) -1, (ub2*) &rlen, (ub2 *) &rcode)) {
                printf("long raw odefin error\n");
                err_report(&cda);
                do_exit(EXIT_FAILURE);
        }

To fetch a portion of the LONG or LONG RAW column, I used the following:
	             oflng(&cda, 
				(sword) 8, 
				(ub1 *) data_area,
                                (sb4) numPts * NUMBYTES + 4,
                                (sword) VARCHAR2, 
				(ub4*) &retl,
                                (sb4) 0);

I keep getting a return code of 1405, which I believe means that the column is NULL. Am I missing a step somewhere? Is VARCHAR2 the correct external datatype to use? The binary data is several hundred floats that I read from a file and converted to hex characters which I put into the array.

Thanks very much,
Jenny Barrett

Please email me at: jbarrett_at_s.psych.uiuc.edu Received on Thu Sep 01 1994 - 22:13:22 CEST

Original text of this message