Important: Please read the Qt Code of Conduct -

Oracle OCI Result cannot bind to return a SYS_REFCURSOR

  • Hello, I recently built Qt statically and it came out pretty well. One of the issues I have been working around is how to return a SYS_REFCURSOR object from Oracle base to a QSqlResult or something similar. I found a patch

    I have tried the exact same thing, but somehow, it managed to print out:

    ORA-01008: not all variables bound
    Unable to execute statement.

    Here is my code:


    QOCIResult *p_cursor = reinterpret_cast<QOCIResult*>(db.driver()->createResult());

    QSqlQuery content_query(db);
    content_query.prepare("begin ispovedi.get_ord_kategorii_list(:p_cursor); end;");
    content_query.addBindValue(qVariantFromValue(p_cursor), QSql::Out);

    if (content_query.exec())
    qCritical("%s.", qPrintable(content_query.lastError().text()));

    I have a crystal clear connection to database and I can execute other statements, as well, not a problem. The only problem is how to return a SYS_REFCURSOR.

    Thank you.