After the previous understanding, now want to use C language to program, search a lot of things, and then decided to use Pro C to learn
After you have installed the Oracle database, you can program it, and there is a command proc to pre-compile the program.
Write a test.pc and then
Proc INAME=TEST.PC oname=test.c
But I can't do this, it's always been a problem.
Later I used
Proc Parse=none code=kr_c line=yes iname=test.pc mode=oracle dbms=v8 unsafe_null=yes
This will generate the test.c file.
Then compile with GCC
GCC TEST.C-L${ORACLE_HOME}/LIB-LCLNTSH-LECPG
I have configured the path of-L here, but why should I write it here?
The problems encountered need further processing.
test.pc
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sqlca.h>
EXEC SQL BEGIN DECLARE section;char *userid= "Scott"; Char *passwd= "XX"; EXEC SQL END DECLARE section;
int main (int argc, char *argv[]) {EXEC SQL Connect:userid identified by:p asswd;
if (Sqlca.sqlcode = = 0) {printf ("ok\n"); } else {printf ("false\n"); Exit (1); EXEC SQL SELECT * from EMP;
return 0;}
Here I also use Select this sentence, how to show the result?
Oracle Learning Record nine PRC C learning