What would be Pro * C / C ++?

2

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

Pro * C / C ++ is useful today?

Could you pass an example code?

Does it have PL / SQL difference? Or are they used together?

    
asked by anonymous 08.08.2017 / 13:47

1 answer

2
  

What would be Pro * C / C ++?

A mechanism that allows you to use these languages within the database as if they were PL / SQL codes. It can give some performance gain and allow for 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.

Gain often comes about because you no longer have to play. But it can be greater when you tinker with the generated code by optimizing something that the Oracle optimizer can not. It's a supported API and lets you do what you want.

Documentation .

  

Is C / C ++ Pro useful today?

It is useful yes. It has never been of much 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 rather than in the database. If it's a DBA in general it will not mess with C. But some optimized query is still useful.

  

Could you pass an example code?

/* ... */
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 it in GitHub for future reference.

Font .

  

Does it have PL / SQL difference? Or are they used together?

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

    
08.08.2017 / 15:00