Can a function take OUT parameters...?

Hi all.
Can a function take OUT parameters...?
Thanks in advance,
Pal

You can do it in PL/SQL but not in SQL. The following example demonstarte that -
satyaki>
satyaki>create or replace package S_glob
  2  as
  3       b varchar2(20);
  4  end;
  5  /
Package created.
satyaki>
satyaki>
satyaki>create or replace function S_test_mul_out(a in number,c out varchar2)
  2  return number
  3  is
  4     cursor c1(eno in number)
  5     is
  6        select ename,job,sal
  7        from emp
  8        where empno = eno;
  9      
10     rec c1%rowtype;
11     d  number(10);
12  begin
13       open c1(a);
14       loop
15         fetch c1 into rec;
16         exit when c1%notfound;
17          glob.b:= rec.ename;
18          c:= rec.job;
19          d:= rec.sal;
20       end loop;
21       close c1;
22       return d;
23  end;
24  /
Function created.
satyaki>
satyaki>
satyaki>set serveroutput on
satyaki>
satyaki>
satyaki>declare
  2        yy  varchar2(30);
  3        zz  number(10);
  4  begin
  5       ZZ:= s_test_mul_out(7566,yy);
  6       
  7       dbms_output.put_line('Ename: '||glob.b);
  8       dbms_output.put_line('Job: '||yy);
  9       dbms_output.put_line('Sal: '||zz);
10  end;
11  /
Ename: JONES
Job: MANAGER
Sal: 1000
PL/SQL procedure successfully completed.
satyaki>Regards.
Satyaki De.
Message was edited by:
Satyaki_De

Similar Messages

  • Can i just take out my SIM card to erase my passcode?

    i Have forgotten my passcode and I haven't synced my phone to a computer, so can I just take out my SIM card to erase it all and start from scratch?

    Nope.  You will need to restore the device from a computer.  whether you've synced to one in the past or not is irrelevant.
    Use iTunes to restore your iOS device to factory settings - Apple Support
    Removing the sim card will simply stop the iPhone from getting cell service. nothing more.

  • Oracle Function with out parameters

    Hi, I'm trying to access a stored function on an oracle server with 2 out parameters, 2 in parameters and an out ref cursor.
    PL/SQL looks like this
    nStatusCode OUT INTEGER,
    sStatusMsg OUT VARCHAR2,
    sUsrNr           IN VARCHAR2,
    sPassword           IN VARCHAR2,
    crsReturn OUT pck_cursor.retRecordSet
    I drag the function onto dataset designer and it successfully maps the results to the datatable, it maps datatypes for first out parameters to decimal and string.
    the method genearated for fill by looks like (out decimal?,out string,string, string, out object)
    problem is, everytime i try to call this function it gives me casting exceptions for the first 2 out parameters, for the decimal it's not specified in more detail. for the other one it says there was an exception casting from OracleString to string. If I change the PL/SQL function to leave the first 2 out parameters away it works fine. Do I manually need to change the TableAdapter definitions??

    Hi,
    I think I found the problem but not a good solution. It seems to be a problem with auto code generation for TableAdapters in the Dataset wizard. In the Parameter Definition for the Command I set DbType.Decimal and DbType.Sting for the SqlDbtype Property of the out params. The GetData and Fill Method is generated with Fill(out decimal? out1, out string out2). When I look in the generated code ith first sets the SqlDbtype as written but after this also the OracleDbtype to OracleDbType.Decimal and OracleDbType.Varchar2. The casting these types before returning the throws the exception. Any idea how to change this behavior?

  • Can a thief take out the sim card and use phone like new?

    I recently left my phone in a public bathroom and when I went back it was gone. So I believe someone has taken it and has turned it off. I am using Find my iPhone but the person has not turned my phone on in 3 days. I'd like to know, what could he/she possibly be doing to my phone? Could she have already taken out the sim card and started using it like a new one? Is that possible? Everyone says that it becomes a useless brick after you go through the procedures of locking it and putting it on lost mode but there is a way around it right..otherwise, why would people steal them?

    If the iPhone has iOS 7, you set up Find My iPhone, and there's a screenlock passcode, then the iPhone is unusable to the thief or anyone he sells or gives the iPhone to.
    http://support.apple.com/kb/PH13695
    The thief could have restored the iPhone which would cause it to no longer appear in Find My iPhone in iCloud, but it won't be usable. People steal them because either the thief is ignorant about Activation Lock, or they depend on buyers looking for a deal will be ignorant, which if you look at the many posts here from people who've bought an iPhone from a stranger and encountered Activation Lock is proof that such ignorance still abounds.
    Regards.
    Message was edited by: varjak paw

  • Out parameters in functions?

    Is it possible to use out parameters in a function? if so in which scenario or situations we use this method?

    Hi,
    Composite type? but composite types are plsql types? Not necessarily,
    CREATE TYPE customer_typ_demo AS OBJECT
        ( customer_id        NUMBER(6)
        , cust_first_name    VARCHAR2(20)
        , cust_last_name     VARCHAR2(20)
        , cust_address       CUST_ADDRESS_TYP
        , phone_numbers      PHONE_LIST_TYP
        , nls_language       VARCHAR2(3)
        , nls_territory      VARCHAR2(30)
        , credit_limit       NUMBER(9,2)
        , cust_email         VARCHAR2(30)
        , cust_orders        ORDER_LIST_TYP
    i've gone through oracle Plsql fundamentals, but in that its given only valid sql datatypes are valid in return statement!!I think you have misread something. It is true though, that if you want to use your function in SQL it should return an SQL datatype (And can have no OUT parameters)
    I understand its a bad practice.. but is there any worst case scenario where we need to use functions with out parameters, that no othr methods r possible?None that I can think of..
    Regards
    Peter

  • I am trying to take out my fan in my Compaq Presario CQ50 but I can't access it....?

    I am following this guide (http://www.insidemylaptop.com/remove-mot… and I skipped removing the memory, WIFI, and DVD. I don't want to do all that. Right now I am at the part where you take over the top cover but I can't get it off. Do I have to go through removing the memory, etc; ???
    13 minutes ago
    - 4 days left to answer.
    Additional Details
    I have to either replace it or clean it. I can't just take out the screws in the back (it doesn't look like they come out. I was trying to unscrew one for an hour.)
    3 minutes ago

    If you were having your appendix removed would you want the surgeon to skip a few steps? Follow the Service Manual would be my best advice, sir. I have not personally taken apart CQ50 but there are likely screws inside the memory compartment or under the optical drive that can only be reached by removing the memory, DVD drive, wifi card, etc. If you do not remove the wifi card and antennae leads the antenna will be in your way holding the top and bottom halves together.
    Official Service Manual

  • Calling a function from SQL that has Out Parameters

    Hello folks,
    I am not sure if this is do-able, but here is my scenrio at hand. I have a database function that accepts a few IN parameters and OUT parameters. I want one of the Out parameters to display as part of my select statement. Is this possible?
    Thanks

    No you cannot use a function with out parameters in sql statements.
    If possible make the function return that value, then use it in select.( imean instead of OUT parameter, get that OUT parameter through RETURN)
    G.

  • Why we can not set oracle static parameters in memory

    Hi,
    I Know i am asking some impenetrable  question here But my intention  is to clear why still some parameter are static. there should be very strong reason behind that. anyone any idea. please somebody explain with any parameter why it is static.
    Warm Regards,
    Santosh Ganjure
    Mumbai
    Maharashtra(I)

    user13432927 wrote:
    Hi,
    One of my interview they asked me a question like we can use procedure using out parameters, why exactly need a function.
    I gave possible answers but they did not happy with them.
    Can you please tell me strong reason in practical way?
    Thanks
    kalpanaPossibly because the function needs to be called by SQL ... you can't use a procedure for that.

  • Problem passing OUT parameters form based on stored procedure to another form?

    Hello,
    I am unable to pass parameters of type OUT from a form based on a stored procedure to another form.
    However, I am able to pass parameters of the type IN to the other form.
    This is the code that I have under the heading
    On successful submission of a form, execute this PL/SQL block or PL/SQL procedure:
    declare
    v_partno varchar2(100);
    v_partdesc varchar2(200);
    blk varchar2(10):='DEFAULT';
    v_names varchar2(1000);
    v_values varchar2(1000);
    begin
    v_partno:=p_session.get_value_as_varchar2
    (p_block_name=>blk,p_attribute_name=>'A_PART_NO');
    v_partdesc:=p_session.get_value_as_varchar2
    (p_block_name=>blk,p_attribute_name=>'A_PART_DESC');
    v_names := '_moduleid:_show_header:pnumber:pdescription';
    v_values := '1325575336:YES:' || LTRIM(TO_CHAR(v_partno)) || ':' || LTRIM(TO_CHAR(v_partdesc)) ;
    PORTAL.wwa_app_module.link (
    p_arg_names => PORTAL.wwv_standard_util.string_to_table2(v_names),
    p_arg_values => PORTAL.wwv_standard_util.string_to_table2(v_values));
    end
    Info:
    1. Passing PART_NO (IN parameter) and PART_DESC (OUT paramter) to another form.
    2. After hitting the submit button, the second form comes up, but with only the PART_NO(type IN) field completed. The PART_DESC(type OUT) field did not get passed to the second form.
    3. The corresponding fields in the second form are pnumber & pdescription.
    4. FYI - I can see all the OUT parameters correctly, if I don't try to pass control to the second form.
    5. Portal 9.0.2 ( the version that ships with IAS 9.0.2)
    Any help would be greatly appreciated. I have been stuck here for a while now!
    Dev

    Re: Error
    Passing OUT parameter to another form.
    You cannot retrieve the value of the OUT parameter from the session object because after executing your procedure,
    the value passed out using the OUT parameter is not loaded in the session object.
    But you can still achieve what you are trying in the following way.
    Let's assume that your procedure has the following str :-
    procedure proc1 (p_in in varchar2,
    p_out out varchar2)
    is
    begin
    /* your processing statements
    end;
    Say, the name of the field, in the 2nd form, where you need to pass the out parameter value is VALUE_FROM_OUT.
    1> Edit the form on procedure proc1
    2> Select the submit button in the left frame and for the PL/SQL button handler choose Submit action.
    3> In the adjacent textarea, comment out the doSubmit statement and use code given below :-
    declare
    l_p_in varchar2(32767);
    l_p_out varchar2(32767);
    l_url varchar2(2000);
    begin
    l_p_in := p_session.get_value_as_varchar2(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_P_IN');
    execute immediate
    'begin <schema>.proc1(:b_in,:b_out); end;'
    using in l_p_in, out l_p_out;
    l_url := 'http://<host>:<port>/pls/<dad>/<portal-schema>.wwa_app_module.link?p_arg_name=_moduleid&p_arg_values=<module_id>&p_arg_names=VALUE_FROM_OUT&p_arg_values='||
    <portal-schema>.wwv_standard_util.url_encode(l_p_out);
    <portal-schema>.wwa_app_module.set_target(l_url,'CALL');
    end;
    NOTE :
    ======
    In the code given above, replace
    <schema> with the schema name that owns the procedure proc1
    <host> with webserver host
    <port> with the port of your webserver
    <dad> with the portal dad
    <portal-schema> with the name of the portal-schema
    <module_id> with the module of the 2nd form i.e. where you need to pass the value of the out variable.
    You will have to grant execute privilege on procedure proc1 to your application schema,
    if the procedure proc1 lies in a schema other than the application schema.
    4> Finish editing the form.

  • Can I take out the underlines in photo gallery?

    Can I take out the underlines in photo gallery? I mean the underlines for "Back to Album", "Previous" and "Next". I understand they are functional but I just don't think they look great with the whole composition. Thank you!

    This might work:
    Create a dummy hyperlink on that page and set the color, rollover color and underline options that you want on those links. Click a couple of times on the *Use for New Links on Page* button. Delete the dummy hyperlink and republish. That should change the links you mentioned.
    OT

  • How to retreive out parameters from function in sql statement

    hi dear,
    Suppose i have a fuction with two "out" parameters, i want to show the values of these paramenters in sql stm.
    like
    select my_function() from dual;
    Thanx

    Can't be done. To use a function in SQL it can only have a single return value.
    Try something like this changing the data types appropriately.
    var x number
    var y number
    var z number
    exec :x := my_function(:y, :z)
    print

  • Did they take out the free section, you know where they might offer a free episode/song/video/etc in one spot (or at least did they for Canada)? I can find the english song of the week, but that is it...

    Did they take out the free section, you know where they might offer a free episode/song/video/etc in one spot (or at least did they for Canada)? I can find the english song of the week (I used to enjoy browsing both the english and french), but that is it...

    Nevermind. For some reason it loaded wrong/poorly/? It was back after I closed itunes down and re-opened it.
    Thanks though

  • After I have combined some files together to make them into one pdf, can I add and take out files?

    After I have combined some files together to make them into one pdf, can I add and take out files?

    Hello djensen1x,
    Could you please let me know what version of Acrobat are you using.
    Also, tell me your workflow of combining those PDF files?
    Please share the screenshot of the error message that you get.
    Hope to get your response.
    Regards,
    Anubha

  • Can I cancel my contract and take out a new one, o...

    We have two landlines in our house, but we only need one and we'd like to stop wasting money. The first line, which is only used for phone calls, has the number which all our personal and professional contacts know – so we really don’t want to get rid of that. The second line is only used for BT Broadband Option 3 – so we want to surrender that line altogether and move the broadband service over to our first line (which, according to the BT website, will also give us much better broadband speeds). Sounds simple …. but somehow I’m concerned that the broadband transfer/line cancellation process could get screwed up. Especially since we would also want to downgrade the broadband service to (today’s equivalent of) Option 2 and add BT Vision to the mix.
    So I’d be grateful for any advice on how best to proceed. Since our BT Broadband contract expired long ago, could I just cancel that and – at the same time – take out a totally new broadband contract (at a better price, and/or a new hub, with luck) on the phone line which we want to keep? Or will BT not let me do that, since both phone lines are registered to the same address/account? Or, if I really want to avoid things going wrong, should I think about leaving BT altogether and taking a competitor’s broadband/tv combination product? I’ve actually had no major problems - over many years - with the BT broadband service, so I’m certainly prepared to stick with the devil I know if I can be (reasonably...) sure that things aren’t going to go wrong and that the cost savings are going to make it all worthwhile.

    Hi mrwoo.
    You look as if you have some difficult descisions to make and I would normally suggest just ringing sales and asking them.
    This looks a little to complicated.
    Why not ask the forum mods what is the best way to go about this, they might even be able to arrange it for you.
    If you fill in this form: http://bt.custhelp.com/app/contact_email/c/4951 with a link back to your post for ref, the mods will get back to you. It can take up to 3 days ( sometimes longer in busy periods), and they will contact you direct via phone or email.
    Please let us know how you get on.
    toekneem
    http://www.no2nuisancecalls.net
    (EASBF)

  • Screen damage and forgot the login password,how can i take out the photos

    my screen damage , totally lost , this iPhone5 is broken 1 year ago,  it has login password and i already forgot the password.i didn't open the icould and backup.  how can i take out my photos from my phone?  the photos is REALLY important for me. and i don't want to replace or fixes it anymore.

    Output of Invoice:
    Billing document (Change Mode) : VF02 --> Enter (takes to main screen) --> on the top line Goto --> Header --> Output  --> maintain output type --> Enter --> back --> Enter printer (in most cases LOCL) --> Enter & SAVE.
    Move out of billing document & revisit Billing Document in change mode(VF02) --> In the initial screen itself, on the top line o to Billing Document --> Output --> Screen / preview > Enter> a screen will pop-up on which printer name is mentioned --> Enter & you will get the preview of Invoice.
    To Configure printer, take assistance from basis consultant.
    Regards,
    Rajesh Banka

Maybe you are looking for