Menu

Check whether CREATE PROCEDURE compiled successfully

Carlos
2013-10-08
2013-10-14
  • Carlos

    Carlos - 2013-10-08

    [please ignore previous message sent as anonymous]

    The result of OCI_ExecuteStmt(st, "create or replace procedure a as begin xxx end;"); is always success, and no warning or error is issued.

    What can I use to check whether it was compiled correctly, or, at least, to find out the object name ("A" in this case) so I can check the table USER_ERRORS?

    (Btw, this is an amazing library. It has helped me a lot in my work. Thank you!)

     
  • Vincent Rogier

    Vincent Rogier - 2013-10-09

    Hi,

    When a "create or replace ..." is used with a faulted content, the Oracle client (OCI) raw execute method returns to OCILIB a status OCI_SUCCESS_WITH_INFO, not OCI_ERROR.
    Thus, it is impossible to OCILIB to handle this as an error.

    By default OCILIB handles OCI_SUCCESS_WITH_INFO as OCI_SUCCESS.

    When OCI_EnableWarnings() is set to TRUE, OCILIB catches OCI_SUCCESS_WITH_INFO and generates an OCI_Error object and passed to the global handler passed to OCI_Initialize(). A such error object has its OCI_ErrorGetType() set to OCI_ERR_WARNING.

    I checked your code using a global error handler and the warning is well generated.

    But apparently, there is an issue when using the OCILIB mode OCI_EN_CONTEXT.
    The generated OCI_Error object is passed to the global error handler but IS not retrieved by OCI_GetLastError().

    There is a bug there. Sorry about that. I'm working on it and i will let you know asap when I will have committed the fix within few days (fix will be included for version 4.O)

    Regard,

    Vincent

     
  • Vincent Rogier

    Vincent Rogier - 2013-10-09

    Hi,

    Issue solved. Fix committed into the SVN repository ( at revision 191).

    Basically, now, when one of the OCI_Executexxx() calls encounters a OCI_WITH_SUCCESS (sql warning) return code from OCI client, it returns TRUE as it was used to do.
    But now, the global error handler is triggered (if provided) AND OCI_GetLastError() returns the error :)

    FYI, the piece of code you have provided returns now an error handle with the following information :

    ORA-24344: Success with Compilation Error

     
  • Carlos

    Carlos - 2013-10-14

    Thank you! Although I couldn't compile from SVN, I'll just wait for the release.