Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle stored procedure with OUT parameters #33

Open
shuracwf opened this issue Apr 22, 2012 · 1 comment
Open

Oracle stored procedure with OUT parameters #33

shuracwf opened this issue Apr 22, 2012 · 1 comment

Comments

@shuracwf
Copy link

I have an Oracle stored procedure like this:

CREATE OR REPLACE PROCEDURE Sp_CheckName(in_Name IN VARCHAR2, out_Ret OUT VARCHAR2) IS
cnt NUMBER;
BEGIN
SELECT COUNT(1) INTO cnt FROM Person WHERE NAME = in_Name;
out_Ret := cnt;
END Sp_CheckName;

Is any idea for me to get out_Ret value in javascript by node-db-oracle?
Thanks.

@jlubean
Copy link

jlubean commented Jan 30, 2013

There is an alternative to calling a stored procedure. You can convert the stored procedure to a function that returns a Table object containing the rows from the cursor. Now you can do a normal select against the table returned from the function!

If your function is called "my_function" and returns a table object, you can do something like this:

db.query("select * from table(my_function(?, ?))",[12345, 67890]).execute(function(error,rows) {...});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants