question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ORACLE: Stored procedure issue using "raw()"

See original GitHub issue

Knex version : 0.12.6

I get what it seems to be a Bluebird error when I try to execute an Oracle stored procedure using raw() :

knex.raw("BEGIN MY.STORED.PROCEDURE(?, ?, ?); END;",
    [
        { "dir": oracledb.BIND_IN, "type": oracledb.NUMBER, "val": 13036 },
        { "dir": oracledb.BIND_OUT, "type": oracledb.NUMBER },
        { "dir": oracledb.BIND_OUT, "type": oracledb.NUMBER }
    ]).then((result) => {
        console.log("Success : " + JSON.stringify(result));
    }).catch((err) => {
        console.log("Error : " + err);
    });

This results in the error :

Error : TypeError: BEGIN MY.STORED.PROCEDURE(:1, :2, :3); END; - expecting an array or an iterable object but got [object Null]

If I debug, I see that the request works, Oracle response is correct. Here’s a screenshot of a breakpoint in file node_modules/knex/lib/dialects/oracledb/index.js, line 162 :

The err is null, there are no rows or resultSet in the results object but a outBinds array, containing the OUT parameters of the stored procedure call.

The error actually occures when line 205 is reached :

resultResolve(results);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
electrotypecommented, Sep 26, 2017

Not a “fix”, but what we do now is to use a raw connection taken from Knex’s connection pool when we need to use a stored proc with out parameters :

export async function withRawConnection(action: (connection: any) => Promise<any>): Promise<any> 
{
    let connection = await client.acquireConnection();
    try {
        return await action(connection);
    }
    finally {
        try {
            await client.releaseConnection(connection);
        }
        catch (err) {
            logger.warning(err, `Unable to release a raw oracledb connection`);
        }
    }
}
1reaction
santimendozacommented, Sep 26, 2017

Hi!

Any update in this? I’m having the same problem using knex and oracledb.

Any workaround to solve this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

RAW datatype - input parameter in procedure — oracle-tech
Hi, I have created a procedure (Pasted below). ... For example, you can build a RAW from a string with HEXTORAW() function.
Read more >
Passing array of raw(32) argument to Oracle Stored ...
When calling a stored procedure once with an array (rather than calling a procedure that takes atomic items, and calling it multiple times), ......
Read more >
Programming in Oracle with PL/SQL
Allows using general programming tools with ... Long raw – stores large blocks of data stored in ... A stored procedure is a...
Read more >
Calling Oracle Stored Procedures Having Out Cursor Parameter
Hey all, I have to call some pre-existing Oracle stored procedures that have cursor out parameters. I've had no luck doing this short...
Read more >
Create and Execute simple SELECT Stored Procedure in ...
... create and run / execute a simple Oracle stored procedure in PL SQL. ... simple SELECT Stored Procedure in Oracle PL SQL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found