Last answered:

05 Dec 2022

Posted on:

03 Dec 2022

0

Resolved: Could we have IN-OUT parameters examples

Searched on the internet about IN-OUT parameters very limited information about that also the only thing I got to know is they help to return multple outputs but not completely sure how we Use IN capability of IN-OUT parameter

3 answers ( 2 marked as helpful)
Instructor
Posted on:

05 Dec 2022

0

Hi Mayank!
Thanks for reaching out.

There are three types of parameters in a stored procedure.
IN parameters

IN is the default mode. When you define an IN parameter in a stored procedure, the calling program has to pass an argument to the stored procedure.  In addition, the value of an IN parameter is protected. It means that even you change the value of the IN parameter inside the stored procedure, its original value is unchanged after the stored procedure ends. In other words, the stored procedure only works on the copy of the IN parameter.

OUT parameters

The value of an OUT parameter can be changed inside the stored procedure and its new value is passed back to the calling program.  Notice that the stored procedure cannot access the initial value of the OUT parameter when it starts.

INOUT parameters

An INOUT  parameter is a combination of IN and OUT parameters. It means that the calling program may pass the argument, and the stored procedure can modify the INOUT parameter, and pass the new value back to the calling program.

Hope this helps.
Best,
Tsvetelin

Posted on:

05 Dec 2022

0

Thank you Tsvetelin Tsonkov for this information but I'm in search of an IN-OUT specific example.

Instructor
Posted on:

05 Dec 2022

0

Hi Mayank and Tsvetelin!

I hope you don't mind if I join the conversation.

@Mayank: Currently, I'd say an IN or an OUT parameter is what one'd normally use in their query. Nevertheless, IN-OUT parameters exist, but as of now, we have not added such an examples to our course. Therefore, note taken, but please refer to Tsvetelin's explanation on the subject for the moment.
In the meantime, please consider that we will upload other SQL topics in a few weeks that will surely enlarge your SQL skillset.

Hope this helps.
Kind regards,
Martin

Submit an answer