What would be Pro*C/C++?

Asked

Viewed 612 times

2

From what I saw it is using in Oracle, but I can use with another Bank?

Pro*C/C++ useful these days?

Could pass a Code Example?

Does it differ from PL/SQL? Or are they used together?

1 answer

2


What would be Pro*C/C++?

A mechanism that allows using these languages within the database as if they were PL/SQL codes. It can give some performance gain and allow more powerful algorithms that would be difficult to do in the Oracle language. It is often used only for performance, so much so that it can compile SQL into a C code to be used.

The gain often occurs because we no longer have to interpret. But it can be bigger when you move the generated code optimizing something that Oracle’s optimizer can’t. It’s a supported API and lets you do whatever you want.

Documentation.

Pro*C/C++ useful these days?

It is useful yes. It has never been of great use, but it can still be interesting here or there.

Of course, if you are a developer and not a DBA you will tend to consider that these improvements should be in the application and not in the database. If it is a DBA in general it will not mess with C. But some optimized query is still useful.

Could pass a Code Example?

/* ... */
for (;;) {
    printf("Give student id number : ");
    scanf("%d", &id);
    EXEC SQL WHENEVER NOT FOUND GOTO notfound;
    EXEC SQL SELECT studentname INTO :st_name
             FROM   student
             WHERE  studentid = :id;
    printf("Name of student is %s.\n", st_name);
    continue;
notfound:
    printf("No record exists for id %d!\n", id);
}
/* ... */

I put in the Github for future reference.

Source.

Does it differ from PL/SQL? Or are they used together?

They can be used together. The API allows you to do everything you can in PL/SQL, but in a very different way. In fact the C or C++ language together with the API replaces the PL/SQL in the parts you want.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.