c precompiler
Date: 1997/03/06
Message-ID: <5fngkt$a5f_at_sol.towson.edu>#1/1
[Quoted] [Quoted] Hi, I got a serious problem with the following program which is used to create a table (DEPT_LOCATION) and insert two lines of values. I compiled the program using oracle C Precompiler and run it successfully. But when I went to my oracle system, I used statement "select Table_Name from USER_TABLES", the table I created using Pre C program didn't show up, which means the table "DEPT_LOCATION" was not created. I don't know does the table created using pre C program only exists during runtime of the program or should exist forever?
I need idea for that. Good luck to everybody!!!
fyang1_at_tiger.towson.eud
#include <stdio.h>
char *username = "fyang1";
char *password = "fuzhen";
[Quoted] char dlocation[15];
int dnumber;
void sql_error();
#include <sqlca.h>
main()
{
[Quoted] EXEC SQL WHENEVER SQLERROR do sql_error("oracle error");
[Quoted] EXEC SQL CONNECT:username IDENTIFIED BY:password; printf("Connected.\n");
[Quoted] EXEC SQL CREATE TABLE DEPT_LOCATION(DNUM int,
DLOC varchar(15));
EXEC SQL COMMIT;
EXEC SQL INSERT INTO DEPT_LOCATION VALUES(1, "Baltimore");
EXEC SQL INSERT INTO DEPT_LOCATION VALUES(2, "Houston");
EXEC SQL COMMIT;
EXEC SQL COMMIT WORK RELEASE;
exit(0);
}
void sql_error(msg)
char *msg;
{
char buf[500];
int buflen, msglen;
EXEC SQL WHENEVER SQLERROR CONTINUE;
EXEC SQL ROLLBACK WORK RELEASE;
[Quoted] buflen = sizeof (buf);
sqlglm(buf, &buflen, &msglen); printf("%s\n", msg); printf("%*.s\n", msglen, buf);
exit(1);
} Received on Thu Mar 06 1997 - 00:00:00 CET