* * *.
The code below
# include & lt; stdio.h>
The exec SQL include sqlca;
Int main () {
The exec SQL begin declare section;
Char userpasswd [30]="openlab/open123";
Int id=100;
Char name [30]="test100";
The exec SQL end declare section;
The exec SQL connect: userpasswd;
if(! The sqlca. Sqlcode) {
Printf (" connect success! \n");
} else {
Printf (" % s \ n ", the sqlca sqlerrm. Sqlerrmc);
}
The exec SQL create table testprocsql (id number/primary key,
Name varchar2 (30));
if(! The sqlca. Sqlcode) {
Printf (" create table success! \n");
} else {
Printf (" % s \ n ", the sqlca sqlerrm. Sqlerrmc);
}
The exec SQL insert into testprocsql values (1, "test1");/* line22 */
if(! The sqlca. Sqlcode) {
The exec SQL commit;
} else {
Printf (" % s \ n ", the sqlca sqlerrm. Sqlerrmc);
}
The exec SQL insert into testprocsql values (: id, name);
The exec SQL commit;
The exec SQL select name into: name the from testprocsql where id=1;
Printf (" name=% s \ n ", name);
The exec SQL commit work release;
}
Input proc SQL. PC following pretreatment mistakes:
Pro * C/C + + : Release 11.2.0.1.0 - Production on Fri Nov 11 13:16:49 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
The System default option values seems the from:/home/oracle/app/oracle/product/11.2.0/dbhome_1/precomp/admin/PCSCFG CFG
The Error at line 22, the column 6 file in SQL. PC
The exec SQL insert into testprocsql values (1, "test1");
. 1
PLS - S - 00201, the identifier 'TESTPROCSQL' must be declared
The Error at line 22, the column 6 file in SQL. PC
The exec SQL insert into testprocsql values (1, "test1");
. 1
PLS - S - 00000, the SQL Statement ignored
Semantic error at line 22, the column 6, the file SQL. PC:
The exec SQL insert into testprocsql values (1, "test1");
. 1
The PCC - S - 02346, PL/SQL found semantic errors
And when I manually build tables in oracle server execute SQL statement create table testprocsql (id number/primary key, name varchar2 (30));
Built after the success of the table, I could be precompiled code with lead, and compile links run successfully, this is why, why, when table does not exist the proc precompiled have no,
Table to exist, the precompiled through, don't build table proc program executing SQL statements, and insert any logic problem?
O brother look,
Thank you,,,
CodePudding user response:
I've never used proc, the result is I guessTo look at the running mechanism of proc, is precompiled good, or at run time to compile
1, the implementation of dynamic table statements, then the SQL should be variable, as for the variables in the proc how to reflect, then don't know the
2, if the table does not exist, the corresponding implementation of the select the from the table, the table can't find, may be an error, should also use variables instead of at this time
CodePudding user response:
Hello, is your problem solved