Oracle Pro*C to ECPG Conversion

An Oracle Precompiler and ECPG are programming tools that enable the user to embedd SQL statements in a high-level source program.

The Oracle Pro*C and ECPG statements are similar but have some differences in:

  • SQL function
  • Work with multithreaded
  • Using host variable
  • Header files, and others

Conversion features

Ispirer MnMTK tool automatically detects EXEC SQL statements and host variables, converts them and pastes additional code.

Oracle Pro*C example (file: simple.pc):

void simple_func (int id){    int   check_id = 0;     EXEC SQL        SELECT NVL(ID, 0)        INTO   :check_id        FROM   customer        WHERE  SET_ID = :id;}

After conversion simple.pc file is converted to simple.pgc (file for ECPG Precompiler):

EXEC SQL INCLUDE simple.pgh;void simple_func(int id){   EXEC SQL int  check_id = 0;    EXEC SQL   SELECT coalesce(ID,0)   INTO   :check_id   FROM   customer   WHERE  SET_ID = :id;}

In this example you can see the converted EXEC SQL statement. Note that declare host variable is converted to EXEC SQL declare statement. Also SQLWays tool creates simple.pgh file (header file for simple.pgc) and adds EXEC SQL INCLUDE statement.

Simple.pgh file contains EXEC SQL statement for declare variable, which is a parameter for simple_function.

In the example there is one declare statement:

EXEC SQL int id;

Please complete the questionnaire to initiate collaboration discussions for your project or get some rough estimation:

If you are interested in these services, please contact us for more information.