Questions tagged [out-parameters]

The tag has no usage guidance.

out-parameters
Filter by
Sorted by
Tagged with
130 votes
10 answers
13k views

Why doesn't 'ref' and 'out' support polymorphism?

Take the following: class A {} class B : A {} class C { C() { var b = new B(); Foo(b); Foo2(ref b); // <= compile-time error: // "The 'ref' ...
Andreas Grech's user avatar
18 votes
2 answers
34k views

Fetch Oracle table type from stored procedure using JDBC

I'm trying to understand different ways of getting table data from Oracle stored procedures / functions using JDBC. The six ways are the following ones: procedure returning a schema-level table type ...
Lukas Eder's user avatar
  • 216k
109 votes
7 answers
89k views

Is there a VB.NET equivalent of C# out parameters?

Does VB.NET have a direct equivalent to C# out function parameters, where the variable passed into a function does not need to be initialised?
cspolton's user avatar
  • 4,513
90 votes
2 answers
37k views

Passing a property as an 'out' parameter in C#

Suppose I have: public class Bob { public int Value { get; set; } } I want to pass the Value member as an out parameter like Int32.TryParse("123", out bob.Value); but I get a compilation error,...
thorncp's user avatar
  • 3,617
50 votes
2 answers
31k views

How can I invoke a method with an out parameter?

I want expose WebClient.DownloadDataInternal method like below: [ComVisible(true)] public class MyWebClient : WebClient { private MethodInfo _DownloadDataInternal; public MyWebClient() { ...
ldp615's user avatar
  • 952
47 votes
10 answers
77k views

How best to implement out params in JavaScript?

I'm using Javascript with jQuery. I'd like to implement out params. In C#, it would look something like this: /* * odp the object to test * error a string that will be filled with the error ...
Nick Heiner's user avatar
7 votes
5 answers
8k views

What is the purpose of OUT in MySQL stored procedures?

What is the purpose of OUT in MySQL stored procedures? If I have a simple stored procedure which looks like this: DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `new_routine`( IN ...
oshirowanen's user avatar
  • 15.7k
6 votes
2 answers
3k views

How to circumvent using an out parameter in an anonymous method block?

The following method does not compile. Visual Studio warns "An out parameter may not be used within an anonymous method". The WithReaderLock(Proc action) method takes a delegate void Proc(). public ...
Anthony Mastrean's user avatar
2 votes
2 answers
1k views

How can I initialize sigset_t or other variables used as "out parameters" in Rust?

I'm trying to learn more about FFI in Rust and linking with C libraries, specifically libc. While on my "quest", I came across the following problem. Normal pattern in C void(* sig_set(int ...
Daniel Robertson's user avatar
16 votes
3 answers
39k views

Out parameters in C

void swap(int &first, int &second){ int temp = first; first = second; second = temp; } int a=3,b=2; swap(a,b); The compiler complaints that void swap(int &first, int &...
user1128265's user avatar
  • 2,979
11 votes
3 answers
27k views

How to create IN OUT or OUT parameters in Java

In PL/SQL (or many other languages), I can have IN OUT or OUT parameters, which are returned from a procedure. How can I achieve a similar thing in Java? I know this trick: public void method(String ...
Lukas Eder's user avatar
  • 216k
2 votes
1 answer
7k views

MyBatis annotations to call Stored Procedure and get Out Params

I am using MyBAtis-3 with MyBAtis-Spring. When i tried to call a stored procedure that returns more than one out params using MyBatis annotations. I don't get anything, I can see that the input ...
user3815000's user avatar
41 votes
3 answers
18k views

Is there a way to omit out parameter? [duplicate]

Let's assume I have a function with out parameter, however I do not need its value. Is there a way to pass no actual parameter if given result will be thrown away anyway? EDIT: Although the question ...
konrad.kruczynski's user avatar
20 votes
6 answers
29k views

Null out parameters in C#?

After reading on stackoverflow that in the case of checking the format of a DateTime you should use DateTime.TryParse. After trying some regex expressions they seem to get long and nasty looking to ...
chobo2's user avatar
  • 84.4k
19 votes
2 answers
12k views

passing out parameter

I wrote a method with an out parameter: -(NSString *)messageDecryption:(NSString *)receivedMessage outParam:(out)messageCondent { messageCondent = [receivedMessage substringFromIndex:2]; ...
Vipin's user avatar
  • 4,718
18 votes
8 answers
17k views

Real-world examples where C# 'out' parameters are useful?

I'm reading up on core C# programming constructs and having a hard time wrapping my head around the out parameter modifier. I know what it does by reading but am trying to think of a scenerio when I ...
clickatwill's user avatar
17 votes
2 answers
29k views

How to pass 'out' parameter into lambda expression

I have a method with the following signature: private PropertyInfo getPropertyForDBField(string dbField, out string prettyName) In it, I find the associated value prettyName based on the given ...
Sarah Vessels's user avatar
4 votes
5 answers
24k views

PHP - MySQL gets value of out parameter from a stored procedure

I have called a MySQL stored procedure from PHP using mysqli. This has one out parameter. $rs = $mysqli->query("CALL addNewUser($name,$age,@id)"); Here, @id is the out parameter. Next, I fire the ...
mtk's user avatar
  • 13.4k
0 votes
4 answers
5k views

Parameter in C#

When I want get total value of memory in C# I found a kernel32 function in MSDN to invoke data from system. MSDN declare function this way: [return: MarshalAs(UnmanagedType.Bool)] [DllImport("...
Amir Borzoei's user avatar
16 votes
2 answers
2k views

Why don't anonymous delegates/lambdas infer types on out/ref parameters?

Several C# questions on StackOverflow ask how to make anonymous delegates/lambdas with out or ref parameters. See, for example: Calling a method with ref or out parameters from an anonymous method ...
John Feminella's user avatar
15 votes
4 answers
9k views

Why is an out parameter not allowed within an anonymous method?

This is not a dupe of Calling a method with ref or out parameters from an anonymous method I am wondering why out parameters are not allowed within anonymous methods. Not allowing ref parameters ...
Chris Ballance's user avatar
14 votes
2 answers
2k views

When is the value of a C# 'out' or 'ref' parameter actually returned to the caller?

When I make an assignment to an out or ref parameter, is the value immediately assigned to the reference provided by the caller, or are the out and ref parameter values assigned to the references when ...
Zach Johnson's user avatar
9 votes
2 answers
49k views

Java MyBatis stored procedure call with OUT parameters

First question: I am trying to return one OUT parameter and not a result set with annotations. First, is it even possible? If it is, how would one do this? MyBatis: 3.0.6 Database: SQL Server 2008 ...
snoozy's user avatar
  • 153
8 votes
4 answers
8k views

C#: How to use generic method with "out" variable

I want to create a simple generic function void Assign<T>(out T result) { Type type = typeof(T); if (type.Name == "String") { // result = "hello"; } else if (type.Name == "Int32"...
Tin Vo's user avatar
  • 81
7 votes
5 answers
2k views

Code analysis comes back with suggestion about not using "out" parameters

I ran the VS 2008 code analysis tool against an object I created and received the following suggestion ... Warning 147 CA1021 : Microsoft.Design : Consider a design that does not require that '...
user avatar
5 votes
3 answers
13k views

Sybase IN and OUT parameters

I'm going nuts about how the Sybase JDBC driver handles stored procedures with mixed IN and OUT parameters. Check out this simple stored procedure: CREATE OR REPLACE PROCEDURE p (IN i1 INT, OUT o1 ...
Lukas Eder's user avatar
  • 216k
5 votes
1 answer
6k views

H2: How to create a stored procedure with out parameters

I am attempting to create a stored procedure with out parameters in a JUnit test that is configured with Spring (non-boot). I understand from documentation and examples that I must alias a static ...
ds390s's user avatar
  • 587
5 votes
1 answer
218 views

Why is the C# compiler claiming 'use of an unassigned variable' prior to 'yield return' and dynamic?

The compiler complains that resultingThing in the code below is being used before being assigned to. private IEnumerable<IThing> FindThings(dynamic spec) { if (spec == null) yield ...
Kit's user avatar
  • 21.1k
4 votes
2 answers
6k views

Problem reading out parameter from stored procedure using c#

I just come across a strange problem where i cannot retrieve the sql stored procedure out parameter value. I struck with this problem for nearly 2 hours. Code is very simple using (var con = new ...
RameshVel's user avatar
  • 65.3k
1 vote
2 answers
10k views

Using ouput parameter of type SYS_refcursor

In my database I have a stored procedure with an OUTPUT parameter of type SYS_REFCURSOR. The application side is wrtitten in C#. Can I assign this procedure's output parameter to a Datatable like: ....
Mikayil Abdullayev's user avatar
1 vote
1 answer
3k views

How can i create out parameters with RAISERROR in stored procedure?

How can i create out parameters with RAISERROR in MSSQL? This id stored procedure for example: BEGIN TRY //OPERATION END TRY BEGIN CATCH DECLARE @ErrorMessage NVARCHAR(4000); DECLARE @...
JohnMalcom's user avatar
0 votes
3 answers
1k views

Can I call a stored procedure in a cfloop and output dynamic out-parameters in Coldfusion?

Last question for tonight, still using Coldfusion8 and MySQL. I have a table with products, each with Price A, B and C. I need to retrieve the min and max values for A,B,C across all prices (A_min, ...
frequent's user avatar
  • 28.1k
0 votes
1 answer
2k views

Cant call pl-sql stored procedure with OUT Parameter oracletypes.cursor

I need some help to call a Oracle Stored Procedure in Groovy and receive a ResultSet by an Output Parameter. I can call stored procedure with output parameters of other data types, but for CURSOR I ...
José Cruz's user avatar
0 votes
1 answer
2k views

error while creating mysql procedure having SYS_REFCURSOR as out param

I'm creating procedure which is having two parameters , one is p_cursor of type SYS_REFCURSOR (OUT param) and the other one is p_rank of type INT(IN param). But it showing an error. DELIMITER $$ ...
Arun Kumar Mudraboyina's user avatar