function with out variable and other doubt [message #267822] |
Sat, 15 September 2007 06:17 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
ashish2345
Messages: 50 Registered: September 2007
|
Member |
|
|
Dear friends,
i been told that function should not have an out variable but functions being created by that also with no error.
can anyone tell/refer the reason and its implications.
secondly if i cannot use out how can i return more than 1 paramter.can anyone give example of using record or anything else
thanks
as lot
regards
Ashish
|
|
|
|
|
|
Re: function with out variable and other doubt [message #267833 is a reply to message #267827] |
Sat, 15 September 2007 08:51 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Michel Cadot wrote on Sat, 15 September 2007 14:47 | Quote: | i been told that function should not have an out variable
|
This is plain wrong.
|
No it is not. It is very correct in my opinion. Note the word should, indicating that according to good standards you should not use out-parameters with functions.
(hmm, rereading this, I should add: good standards, again in my opinion)
A function should return a single variable, which could be in the form of a more or less complex structure, like a table%rowtype for instance.
|
|
|
Re: function with out variable and other doubt [message #267834 is a reply to message #267822] |
Sat, 15 September 2007 09:11 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
ashish2345
Messages: 50 Registered: September 2007
|
Member |
|
|
thanks a lot friends..
i have one more doubt .. i want to autoinsert in table for that i want to insert id and increment by one but for that i need to get the last id (means from last row) how to get it..
how to get the first item of last column ie to get element of last row ie identifying last row simply..........
|
|
|
|
Re: function with out variable and other doubt [message #267836 is a reply to message #267833] |
Sat, 15 September 2007 10:42 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68737 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote: | ...indicating that according to good standards you should not use out-parameters with functions.
|
Most C functions only return return code, and real values in out parameters. I don't think this bad practice.
The only bad practice is to not follow the standard you have in your entreprise (and of course not having standard).
Of course, if you want to use this function in SQL, you can only use the return value.
Regards
Michel
|
|
|