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 -> Re: Pro*C

Re: Pro*C

From: Jeffery Cann <jcann_at_fairway.com>
Date: Tue, 09 Jun 1998 17:54:35 -0600
Message-ID: <357DCB3B.1AE8FB05@fairway.com>


Lisa Lewis wrote:
>
> I have a table with 128 fields. I read the data to fill the table from a
> file in a pro*c program. I then want to pass the variables to a stored
> procedure/pkg in order to insert into a table. Can I create a struct in the
> C program and pass it to the stored procedure/pkg or do I have to pass the
> variables individually. An example would be greatly appreciated.

/* note: all the member fields in the structure must be legal Pro*C identifiers */
/* note: the order of the member fields must match the order of the columns in your table */
typedef struct
{

	char emp_name[11];
	int emp_number;
	int dept_number;
	float salary

} emp_record;

/* declare new structure */
emp_record new_employee;

/* copy data into structure */
if (strlen("BOB") < sizeof(new_employee.emp_name) {

        strcpy(new_employee.emp_name, "BOB")
}else /* log SEGMENTATION VIOLATION error */

new_employee.emp_number = 1234;
new_employee.dept_number = 20;
new_employee.salary = 4250.00;

EXEC SQL INSERT INTO emp (ename,empno,deptno,sal) values (:new_employee);

> Thanks in advance!
> Lisa

--
Jeffery Cann
Fairway Systems, Inc.
Senior Software Engineer Received on Tue Jun 09 1998 - 18:54:35 CDT

Original text of this message

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