compile C++ program with embedded SQL

15 pts.
Tags:
C
SQL
I am trying to insert and update into a oracle table from my C++ program. When I compile the program, it does not insert or update anything. Apparently I had to use the DECLARE TABLE to declare the table, because my program cannot find the table. I compile with another user as the schema where the table is. When I add the schema name in front of the table in the DECLARE TABLE, I got the following errors: Error at line 36, column 10 in file embsql_account_test.pc EXEC SQL DECLARE CDRUSER.ACCOUNT_TEST2 TABLE^M .........1 PLS-S-00103, Encountered the symbol "(" when expecting one of the following: . of Error at line 36, column 10 in file embsql_account_test.pc EXEC SQL DECLARE CDRUSER.ACCOUNT_TEST2 TABLE^M .........1 PLS-S-00103, Encountered the symbol "end-of-file" when expecting one of the following: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form current cursor Semantic error at line 36, column 10, file embsql_account_test.pc: EXEC SQL DECLARE CDRUSER.ACCOUNT_TEST2 TABLE^M .........1 PCC-S-02347, PL/SQL found syntax errors When I remove the schema name in front of the table, the errors are on every line of my program. Sorry, I don't have much embedded sql experience. Any suggestions will be highly appreciated. Thanks and regards Bonita
ASKED: May 9, 2006  9:46 AM
UPDATED: May 14, 2006  1:44 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi to all,
As per my knowledge, tables are not supposed to be declared
in a PRO*C program.
Also, at compile time I think that no database object
checks are performed.
The table, just like other database objects, should be
known at run time for the Oracle username which is used
for connecting to the database in the same PRO*C program.
If the connecting user is not the owner of the table,
then you may either prefix the table name with the owner
name IN THE SQL STATEMENT ( SELECT, INSERT, a.s.o.)
or define a private or public synonym for the table at
the database level.

Hope this could help.

Best Rgds,
Iudith

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following