Q

Precompilers explained

What is an Oracle precompiler? Is it similar to Pro*C?

It is more correct to say that Pro*C is one of Oracle's precompilers. There used to be many more precompilers in existence (and some may still persist). For instance, there was once a Pro*Fortran precompiler.

Precompilers basically work like this... There is no native SQL methods for a language like C or C++. So I could use special commands in my C program to connect to the database and issue SQL queries. For instance, to connect to the database, I'd add the following line to my C program:

   EXEC SQL CONNECT :username IDENTIFIED BY :password;
The ':username' and ':password' directives are variable placeholders. The following line shows how to put an INSERT statement into your C program:
   EXEC SQL INSERT INTO pay1 VALUES (:emp_name,
:salary);
Now it should be obvious that these two commands will cause a syntax error in your C program. So compiling this program would be fruitless. Before we compile the program, we have to "Pre-Compile" the program. This is done by envoking the 'proc' utility against our source code. This utility basically changes all of the EXEC SQL statements in our C program with valid C statements using Pro*C's libraries. Once this is done, the precompiled program is then compiled.

For More Information

  • What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
  • The Best Oracle Web Links: tips, tutorials, scripts, and more.
  • Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
  • Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
  • Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.

This was last published in March 2002

Dig Deeper on Oracle database design and architecture

PRO+

Content

Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close