Donate Share

OCILIB - C Driver for Oracle

Subscribe

Recovering from a bad statement

You are viewing a single message from this topic. View all messages.

  1. 2009-11-05 09:56:48 UTC
    Hi,

    Of course...

    Here is a test case :

    #include "ocilib.h"

    int main(void)
    {
    OCI_Connection *cn;
    OCI_Statement *st;

    OCI_Initialize(NULL, NULL, OCI_ENV_CONTEXT);

    cn = OCI_ConnectionCreate("db", "usr", "pwd", OCI_SESSION_DEFAULT);
    st = OCI_StatementCreate(cn);

    if (!OCI_ExecuteStmt(st, "select first_bad_col from bad_table"))
    {
    printf("%s\n", OCI_ErrorGetString(OCI_GetLastError()));
    }

    if (!OCI_ExecuteStmt(st, "select second_bad_col from bad_table"))
    {
    printf(OCI_ErrorGetString(OCI_GetLastError()));
    }

    if (!OCI_ExecuteStmt(st, "select 'good_query' from dual"))
    {
    printf("%s\n", OCI_ErrorGetString(OCI_GetLastError()));
    }
    else
    {
    printf("\nok\n");
    }

    OCI_Cleanup();

    return EXIT_SUCCESS;
    }

    and the output

    > ORA-00942: Table ou vue inexistante
    >
    > ORA-00942: Table ou vue inexistante
    >
    > ok


    You can try to add OCI_ENV_THREADED to OCI_Initialize()
< Previous | 1 | Next >

Add a Reply

You may use standard BBCode tags in your post.

Monitor this

Log in to monitor this topic. Not registered? Create an account to receive email updates when replies are posted to this topic. If you do not log in or register, your reply will be added anonymously.