0

Assuming I have a function in Oracle:

function pass return int
IS
BEGIN
return 213;
END;

And I want to add a parameter of the return value with NO actual name, parameter.Add("hello???", OracleDBType.Int32).Direction = ParameterDirection.ReturnValue; . How should I do that?

6
  • What's wrong with your current approach? Commented Mar 9, 2017 at 12:19
  • Em, this approach requires a parameter's name in " " , and I don't know what to put in there. If i had an actual name, that will work . Commented Mar 9, 2017 at 12:26
  • The name of the parameter that gets the return value is ignored. Name it whatever you like. Something unlikely to cause confusion like RETURN_VALUE seems apposite. Commented Mar 9, 2017 at 12:27
  • in oracle if your function isn not doing any dml then you can call the function as a select statement. create or replace function pass return int IS BEGIN return 213; END; then if you run select pass from dual you get 213 Commented Mar 9, 2017 at 12:31
  • well it's not seems to be ignored : System.ArgumentException: Parameter '@ReturnValue' not found in the collection. Commented Mar 9, 2017 at 12:35

1 Answer 1

1

solved : parameter.Add("ReturnValue", OracleDBType.Int32).Direction = ParameterDirection.ReturnValue

Sign up to request clarification or add additional context in comments.

1 Comment

Something to note for the future, if you add parameters to your Oracle function in the future, the returnvalue parameter must always be the first one specified in the collection for oracle to acknowledge it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.