EXEC SQL 'hangs' on insert [message #93710] |
Sun, 27 October 2002 13:45 |
Rajesh Dorairajan
Messages: 1 Registered: October 2002
|
Junior Member |
|
|
I've two questions. I'll be grateful if someone can answer them for me (SOS) ASAP.
1. I've a simple insert SQL in my Pro*C code. When I execute the control just hangs there. There's no error code. The cursor just keeps blinking. Nothing happens. The code:
EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--n");
EXEC SQL AT DB_NAME INSERT INTO GRADE (LAST, FIRST, CODE, Q1) VALUES(:grade_rec.Gradelast, :grade_rec.Gradefirst, :score_code, :grade_rec.Gradequiz1);
Structure of grade:
typedef struct {
VARCHAR Gradelast[[21]];
VARCHAR Gradefirst[[21]];
char Gradecode[[6]];
int Gradequiz1;
int Gradequiz2;
int Gradequiz3;
int Gradequiz4;
int Gradequiz5;
int Gradeproject1;
int Gradeproject2;
int Gradeproject3;
int Grademidterm;
int Gradefinal;
int Gradetotal;
} Grade;
schema of grade in db:
CREATE TABLE GRADE (
last VARCHAR(20),
first VARCHAR(20),
code CHAR(5),
q1 INTEGER default(0),
q2 INTEGER default(0),
q3 INTEGER default(0),
q4 INTEGER default(0),
q5 INTEGER default(0),
p1 INTEGER default(0),
p2 INTEGER default(0),
p3 INTEGER default(0),
m INTEGER default(0),
f INTEGER default(0),
total INTEGER default(0),
primary key(last, first, code),
foreign key(last, first) references STUDENT,
foreign key(code) references COURSE
);
Other insert statements in the code work just fine.
2. My second question is, Is there any way to substitute a column name in EXEC SQL with an input:
for example let's say, I've
EXEC SQL insert into person (lastname, firstname, address) values ('somebody', 'joe', '123 somecity');
can I do something like:
printf("Enter column name: ");
scanf("%s", c_name);
EXEC SQL insert into person (lastname, firstname, "c_name") values ('somebody', 'joe', '123 somecity');
In other words is it possible for me to input a column name at runtime and specify it in my query?
Needless to say Any help will be deeply appreciated...
Rajesh
|
|
|
Re: EXEC SQL 'hangs' on insert [message #93770 is a reply to message #93710] |
Sun, 05 January 2003 09:22 |
A .shiva kumar
Messages: 3 Registered: January 2003
|
Junior Member |
|
|
hai rajesh sir,
iam shiva
sorry i donot know the answer, but i would like to
know from where we can get this pro *c pre compiler
kindly tell me about that iam dying for that.
sorry again,
i will be thank ful if u can give me the answer
|
|
|
|
|