473,466 Members | 1,367 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

function [returning more than one value]

1 New Member
Hello,
As we know function returns only one value, i had one doubt here that if we have out parameter in function can it return more than one.....
please let me know
Jun 18 '07 #1
7 5485
TRScheel
638 Recognized Expert Contributor
Hello,
As we know function returns only one value, i had one doubt here that if we have out parameter in function can it return more than one.....
please let me know
What language are you using?
Jun 18 '07 #2
bartonc
6,596 Recognized Expert Expert
Hello,
As we know function returns only one value, i had one doubt here that if we have out parameter in function can it return more than one.....
please let me know
Hi Syed. I've moved you post to Miscellaneous Questions. If you tell us the programming language that you are using, you'll be able to get answers from experts in that language.

From my understanding of C, for example, output parameters are a way to force "pass by reference". Which means that you can alter the value of a variable outside the function because a pointer is actually passed into the function instead of the value.

In Python, on the other hand, you can specify any number of variables on the return line and the interpreter packs them into a structure called a "tuple".

Hope that helps.
Jun 18 '07 #3
debasisdas
8,127 Recognized Expert Expert
if you are using Oracle PL/SQL then you can do it.
Jul 12 '07 #4
debasisdas
8,127 Recognized Expert Expert
If uare using oracle PL/SQL to write functions then that is possible

Using the RETURN clause, function can return only one variable. The variable can be of any data type - Number, VARCHAR, REF CURSOR, PL/SQL Table and many more. If the function is returning a data structure like PL/SQL Table, REF CURSOR etc, it is returning more than one value.

Another way of returning values is using OUT parameters. And this applies to both Procedures and Functions. Using OUT parameters, you can return as many values as you need.

If you have a need for OUT parameters, though, you would generally want a procedure, not a function. A function with OUT parameters cannot be called from a SQL statement, which rather defeats the purpose of using a function.


Function can able to return more than one value using ref cursur...

but that is not recomended.
Jul 12 '07 #5
GeertVerhoeven
1 New Member
Hi,

I don't know if it helps but here is a sample that returns a table. This way you can get multiple values (link ).

Greetz,

Geert
Jul 24 '07 #6
kmm
3 New Member
Hello,
As we know function returns only one value, i had one doubt here that if we have out parameter in function can it return more than one.....
please let me know
i think a function always return only a single value whtever the no. of parameters it may be
Jul 24 '07 #7
TRScheel
638 Recognized Expert Contributor
In .NET it is perfectly acceptable to return multiple parameters.

Expand|Select|Wrap|Line Numbers
  1. interface IInterface
  2. {
  3.     private bool MyFunction(out object Parameter1, out object Parameter2, out object Parameter3);
  4. }
  5.  
That function returns a bool, and has 3 parameters set to out.


Using c++ without .NET, you could set as many parameters as you want but they must be sent to the function by reference.
Jul 24 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people...
2
by: sean | last post by:
HI, I would like to know if I can some set a variable to return a single value from a function using the set command. Is this possible? Thanks in advance for your answer Sean
41
by: Materialised | last post by:
I am writing a simple function to initialise 3 variables to pesudo random numbers. I have a function which is as follows int randomise( int x, int y, intz) { srand((unsigned)time(NULL)); x...
14
by: Stegano | last post by:
I am learning C Programming after working with Java for 5 years. I want to know where can I find the source files for C language itself. For example strcat is a function, which concatenates two...
27
by: Marlene Stebbins | last post by:
I am experimenting with function pointers. Unfortunately, my C book has nothing on function pointers as function parameters. I want to pass a pointer to ff() to f() with the result that f() prints...
8
by: ais523 | last post by:
I use this function that I wrote for inputting strings. It's meant to return a pointer to mallocated memory holding one input string, or 0 on error. (Personally, I prefer to use 0 to NULL when...
17
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ...
11
by: aarklon | last post by:
Hi all, I have heard many discussions among my colleagues that main is a user defined function or not. arguments in favour:- 1) if it is built in function it must be defined in some header...
26
by: aruna.mysore | last post by:
Hi all, I have a specific problem passing a function pointer array as a parameter to a function. I am trying to use a function which takes a function pointer array as an argument. I am too sure...
160
by: DiAvOl | last post by:
Hello everyone, Please take a look at the following code: #include <stdio.h> typedef struct person { char name; int age; } Person;
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.