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.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.