oracle - CREATE PROCEDURE - how to check if successfully compiled? -
i'm using ocilib.
statements of form create or replace procedure aa1 begin xxx; end; successful (ie, no error or warning reported). how can check whether statement compiled correctly?
there should function information (i hope).
here quick & dirty example shows issue:
#include <stdio.h> #include <ocilib.h> void print_error() { printf("error:"); oci_error *err = oci_getlasterror(); if (err) printf(" %d: %s\n", oci_errorgetocicode(err), oci_errorgetstring(err)); else printf(" no error."); printf("\n"); } int main (int argc, char **argv) { oci_connection *cn; oci_statement *st; oci_enablewarnings(true); if (!oci_initialize(null, null, oci_env_default | oci_env_context)) { puts("failed initialize oci"); return 2; } cn = oci_connectioncreate("xe", "<your user>", "<your pwd>", oci_session_default); print_error(); oci_setautocommit(cn, true); print_error(); st = oci_statementcreate(cn); print_error(); oci_executestmt(st, "create or replace procedure aaa begin garbage end;"); print_error(); oci_cleanup(); return 0; } output:
$ ./ocitest error: no error. error: no error. error: no error. error: no error.
there issue in ocilib not reporting sql warnings properly. fixed , ocilib repository date fix :)
Comments
Post a Comment