procedure call with sys_refcursor as a parameter in the procedure

Hello
I tried the following procedure after sys_refcursor as parameter of a procedure,
And confused about the procedure call
CREATE OR REPLACE PROCEDURE test_ref (emp_cur IN sys_refcursor) IS
emp_rec Z_emp%ROWTYPE;
BEGIN
LOOP
FETCH emp_cur INTO emp_rec;
EXIT WHEN emp_cur%NOTFOUND;
dbms_output.put_line(emp_rec.ename ||' is a ' || emp_rec.job);
END LOOP;
END;
How can I call the above procedure to get the data

Thank you

You must declare a variable sys_refcursor and open it with the necessary query and then pass that variable as a parameter to your procedure.

Something like that.

set serveroutput on

declare
  my_cursor sys_refcursor;
begin
  open my_cursor for select * from employee;
  test_ref (my_cursor);
end;
/

Tags: Database

Similar Questions

  • my Skype closes and I click on a video call with an error: program of the window is closed due to technical problem

    original title: my Skype close as I click on a video call with error window close program because the problom technique

    I was using Skype program for a long time, but the last two days it stop working when I make a video call, it closes immediately give reason which, due to certain techniques problom window close the program

    Make sure your Windows is fully updated and the latest service pack installed.

    Update of Skype or to download the latest version of their Web site.

    Please update your webcam software and the graphics card driver.

    Check Windows problem and Solution Center and see if there is a new solution it.

  • How the parameter of the procedure with the default table type?

    Hello!

    How the parameter of the procedure with the default table type?
    For example:
    type varchar2lType is table of varchar2(50) index by binary_integer;
    create or replace procedure test1
       (
        s1  varchar2(50)
        sa2 Varchar2Type
       )
    as
    begin
       dbms_output.put_line('yyxxyyy!');
    end;
    /
    Published by: bullbil on 16.01.2012 06:35

    If he should really be an associative array for some reason any (can't think why, but just for fun...) you could declare a dummy array in the packet header and specify as the default:

    create or replace package wr_test
    as
       type varchar2ltype is table of varchar2(50) index by pls_integer;
       g_dflt_varchar2l_tab varchar2ltype;
    
       procedure testit
          ( p_testarray varchar2ltype default g_dflt_varchar2l_tab );
    end wr_test;
    
    create or replace package body wr_test
    as
       procedure testit
          ( p_testarray varchar2ltype default g_dflt_varchar2l_tab )
       is
       begin
          dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements');
       end testit;
    
    end wr_test;
    

    It is a bit of a hack, because it relies on a global variable that is exposed. A more orderly approach would overload the procedure so that a version does not have the table and another argument:

    create or replace package wr_test
    as
       type varchar2ltype is table of varchar2(50) index by pls_integer;
    
       procedure testit;
    
       procedure testit
          ( p_testarray varchar2ltype );
    
    end wr_test;
    
    create or replace package body wr_test
    as
    
       procedure testit
       is
          v_default_array varchar2ltype;
       begin
          testit(v_default_array);
       end testit;
    
       procedure testit
          ( p_testarray varchar2ltype )
       is
       begin
          dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements');
       end testit;
    
    end wr_test;
    
  • How to call a Web service with more than 1 parameter value?

    I have a Web service with a query as an array of String parameter.
    In an invoing xml, it should looks like:

    < GetPersonsData_Request >
    < application >
    < PersonIdList >
    < string 111 > < / string >
    < string > 222 < / string >
    < string > 333 < / string >
    ...
    < / PersonIdList >

    A problem I have:
    How can I assign a different value to this list?

    I posted the first element directly and then tried to add a new with append:
    < bpelx: Add >
    < bpelx: a > '12345' < / bpelx: go >
    < bpelx: to > $GetPersonsData_Request.parameters/ns2:request/ns5:PersonIdList < / bpelx: to >
    < / bpelx: Add >

    I get:
    < GetPersonsData_Request >
    < application >
    < PersonIdList >
    < string 111 > < / string >
    "12345".
    < / PersonIdList >
    < / request >

    Added as a single string, not as a structural element.

    What did I miss?

    I think that now your faced with a problem of namespaces because the element added is not the namespace of the element of the 'old' chain
    you don't have an element definition in your xsd that represents the element in your payoad?

    http://download.Oracle.com/docs/CD/E12483_01/integrate.1013/b28981/manipdoc.htm#CIHDGBGA
    http://oraclebpelindepth.blogspot.com/2008/09/arrays-in-bpel_21.html (search for bpelx: Add)

  • issues related to the parameter in the procedure

    Hi all

    I have a procedure which the code is given below:

    create or replace PROCEDURE seods01.get_cert_tx_lot_tmp (acct_alt_id_in in VARCHAR2

    , acct_alt_id_cntx_cde_in IN VARCHAR2 default 'COLA account number.

    ,                                              ibd_id_in               IN  INTEGER

    qry_rslt_out to sys_refcursor)

    IS

    BEGIN

    OPEN FOR Qry_rslt_out

    SELECT L.tx_lot_seq_nbr

    L.hld_prd_dte

    L.orig_purc_dte

    L.tx_lot_amt

    L.updt_tx_lot_amt

    L.tran_desc_txt

    OF v_acct_alt_id A

    v_cd_tx_lot L

    WHERE A.acct_alt_id = acct_alt_id_in

    AND A.acct_alt_id_cntx_cde = acct_alt_id_cntx_cde_in

    AND A.ibd_id = ibd_id_in

    AND L.eods_acct_id = A.eods_acct_id;

    EXCEPTION

    WHILE OTHERS THEN

    dbms_output.put_line(SQLCODE||) SQLERRM);

    END get_cert_tx_lot_tmp;

    now when I run the SP in the following way it works fine:

    VAR C1 REFCURSOR
    EXECUTE SEODS01.get_cert_tx_lot_tmp ('004000000000000093108026740', 'Number of COLA account', '1',: C1);

    PRINT C1

    When I try to ignore this value by default setting, then it is throwing ' wrong number or types of arguments "error

    VAR C1 REFCURSOR
    EXECUTE SEODS01.get_cert_tx_lot_tmp ('004000000000000093108026740 ', ' 1',: C1);

    PRINT C1

    and when I tried to put this as null or "then it gives me no results. only way through which I can produce results of this procedure without giving the default parameter is the name of the column with the value of the parameter as follows:

    VAR C1 REFCURSOR
    RUN SEODS01.get_cert_tx_lot_tmp (acct_alt_id_in = > '004000000000000093108026740', ibd_id_in = > '1', qry_rslt_out = >: C1);

    PRINT C1

    but the condition is that we do not want our consumers to put names of columns when they do not pass the default value setting, I hope that there should be a way to do it. Could someone help me please on this issue.

    Hello

    If you want to use positional notation, then you can only omit parameters by default when they are at the end of the parameter list. In your case, this would mean

    (acct_alt_id_in in VARCHAR2

    ibd_id_in in FULL

    qry_rslt_out ON sys_refcursor

    acct_alt_id_cntx_cde_in IN VARCHAR2 default 'COLA account number')

    Or you can put the procedure in a package and overload

    PROCEDURE seods01.get_cert_tx_lot_tmp

    (acct_alt_id_in in VARCHAR2

    acct_alt_id_cntx_cde_in IN VARCHAR2

    ibd_id_in in FULL

    qry_rslt_out to sys_refcursor)

    PROCEDURE seods01.get_cert_tx_lot_tmp

    (acct_alt_id_in in VARCHAR2

    ibd_id_in in FULL

    qry_rslt_out to sys_refcursor)

    In the procedure without the acct_alt_id_cntx_cde_in parameter, you can call the other version and provide the default value.

    Concerning

    Marcus

  • the size of the out parameter in the procedure

    Hi all:

    I have a procedure in a pl/sql package like this:
    create or replace procedure MyProc (PRM_STR in VHARCHAR2, PRM_OUTSTR OUT VARCHAR2) is
    V_TEST VARCHAR2 (100)
    Start
    +...+
    V_STR: = SUBSTR (PRM_STR, 22, 31);
    V_TEST: = TRIM (V_STR);
    PRM_OUTSTR: = V_TEST;
    EXCEPTION
    WHILE OTHERS THEN
    +....+
    myproc end;

    When I run it, it always gives me an exception: ORA-06502: PL/SQL: digital or value error: character string buffer too small.
    Then I debug him:
    V_TEST: = TRIM (V_STR)
    is OK.
    While PRM_OUTSTR: = V_TEST, it throws this exception.

    I was confused, the out parameter in the procedure has a size? How can I set it?

    Please help me!
    Thank you very much!

    You must declare the size of the variable you use in the call to the procedure to be big enough.

    The output parameter itself may not be declared with a size:

    for example

    Your appeal should be something like the following:

    declare
    v_prmstr varchar2(4000)  :=  'Your input value';
    v_prmoutstr varchar2(4000);
    begin
    myproc(v_prmstr,v_prmoutstr) ;
    end;
    

    v_prmoutstr must be reported to be large enough to contain the value returned by the parameter
    PRM_OUTSTR

    added example variable
    Published by: Keith Jamieson on August 11, 2011 13:32

  • unsecure calls with CTS 500-32

    Hello

    We have a CTS 500-32 with touch that runs on 1.8.1 and registered to the CUCM 8.6.2a. While we connect calls, calls connect and are unsecured.

    The other points of endpoint CTS we cert installed on phones IP and Codec. Calls to connect course.

    As we use touch that doesn't have a distinct profile on the CUCM. How to make secure calls?

    Hello

    This link contains instructions for configuration and troubleshooting of telepresence security.

    http://www.Cisco.com/en/us/docs/Telepresence/security_solutions/CTSS.PDF

    Chapter 6 focuses on the security of the CTS. Most of the configurations described in here must already be present in your case since you already have rooms making secure calls. Just review the procedure or from the troubleshooting section can help you.

    Best regards.

  • How to run Bluecat API calls with a Scriptable task in vRO 6

    Throw it to the community for tips.  I'm still VERY new to javascript & vRO.

    I have vRO6 running with the Plugin from the IPAM Bluecat up and running with the actions of out-of-the-box & plugins.  Large.

    What I am struggling with, it's that I am creating tasks that contains custom script that can do 'other' things listed in the Handbook for the Bluecat API...  Looking at the guide, some things are easy, but others make absolutely no sense to me.

    An example of what I don't understand is the sequel... the API guide will show a specific example to the api java code, but it does not explain how to do this in a scriptable vRO task.

    Update in Java:

    APIEntity area = service.getEntityById (area ID).

    Properties EntityProperties = new EntityProperties (zone.getProperties ()); Fill with the existing values and then update the only properties that need to be changed.

    properties.addProperty ("TextUDF", "testTextValue");

    properties.addProperty ("IntegerUDF", "1005");

    zone.setProperties (properties.getPropertiesString ());

    service. Update (area);

    So it's 6 lines of code, but the execution of that api call vRO Bluecat seems to expect a single sector of something like this:

    result = BCNProteusAPI.call (profileName, "method()", args);

    I don't make any sense?  Any guidance here?

    Thank you!!!

    The version of the plugin available on SolutionExchange seems to expose a script object unique vRO BCNProteusAPI that acts as a proxy for Proteus service calls. Thus, the Java method calls that look like service.someMethod (args) should be directly translatable to scripts of calls BCNProteusAPI.call (profileName, "someMethod", [args]); For the example you provided, calls Java

    APIEntity zone = service.getEntityById( zoneId );
    service.update(zone);
    

    may arise in the vRO as scripts

    var zone = BCNProteusAPI.call(profileName, "getEntityById", [zoneId] );
    BCNProteusAPI.call(profileName, "update", [zone]);
    

    Unfortunately, the other Proteus API objects, like APIEntity, EntityProperties, etc., are not exposed as vRO scripts of the objects, which can cause problems if some service API requires such object as an input parameter. You will probably be able to pass this object returned by a call to service as input to another call from service (such as area in the example above), but you may have problems to instantiate them directly (like EntityProperties in the Java code example).

    You can contact BlueCat for info, why not not all objects are exposed as vRO script objects and how they recommend to use these objects.

  • ADF Mobile: place a phone call with code AMX

    How to place a call from phone with code AMX?    Why isn't when simple ADF Mobile is a development tool for MOBILE PHONES?

    Just use a goLink. Set the parameter to the URL ""such: any number> "."

    Rich.

  • What is INSIDE and OUTSIDE in parameter of the procedure?

    Hello
    often IN, OUT and IN OUT are used with the parameter in the procedures and functions.
    This means pass by value, by reference, we did in programming c / c++?

    When you create a procedure or function, you can set parameters. There are three types of parameters that may be declared:

    1. - the parameter can be referenced by the procedure or function. The value of the parameter can not be overwritten by the procedure or function.
    2 - the parameter may not be referenced by the procedure or function, but the value of the parameter can be replaced by the procedure or function.
    3 AL '-the parameter can be referenced by the procedure or function and the value of the parameter can be replaced by the procedure or function.

  • How can I put shortcuts to websites in a bar (?) tool bar/browser... dunno what it's called. With IE, I can just drag the tab of the site to the area I want.

    How can I put shortcuts to websites in a bar (?) tool bar/browser... dunno what it's called. With IE, I can just drag the tab of the site to the area I want

    Near the right end of the address bar is a White Star which can be hard to see, but look closely. When you want to add a shortcut to the toolbar, double-click the star. A window opens with the name of the Web page. Under this is the area of folder which will probably read "Unsorted Bookmarks". Click on the drop down arrow and change it to "Bookmarks Toolbar", then click done.

    I have several folders on my toolbar such as music, Mail, etc. in which I add several Web sites. If you want to add a folder, click on the second drop-down arrow next to "Bookmark Toolbar" and click on "New folder" and give it a name.

    To add a bookmark to a folder, once again double click on the star, make sure you're in the bookmarks bar and click one of the fall of two arrows to find the name of the folder.

    For other bookmarks use Menu bookmark. What is added here are accessible through bookmarks in the menu bar. If your Menu bar with bookmark, file, display, etc. is not visible, click the ALT key and they will become visible. To keep the menu bar, click view, toolbars and check the menu bar.

  • Portege M400: Is it possible to receive and make calls with the SIM card

    Is it possible to receive and make calls with the card SIM module in the Portege M400?

    I know that you can send and receive sms messeges, which, according to me, the software is not all good because you can't hold much, and you can't send to ems or mms.

    But there may be other software here?

    Hello

    What software do you mean exactly?

    As far as I know that the MobiLink was preinstalled on some units Portege M400.
    This software supports these features:
    Send and receive SMS, composition and read TEXT messages in several languages, compose and send to multiple recipients, the mobile contacts address book support, Rich edit for the launch of URL and Email using embedded addresses.

    As you can see that you can not use this software to make calls!
    And unfortunately other software does not know me :(

    With regard to the MobiLink Communications Software Suite;
    The details can be verified here:
    http://www.novatelwireless.com/products/solutions/MobiLink.html

    Greetings

  • Calls Wi - fi is not listed in the settings of the phone on my 5s with AT

    Calls Wi - Fi is not listed in the phone settings on my 5s with AT & T. I just installed iOS 9.3.

    Call AT & T and ask them.  Their website mentions that wifi calling is supported only on iPhone 6 or later version - https://www.att.com/shop/wireless/features/wifi-calling.html so they can simply not be supported by your phone.

  • My contacts don't see who I am in a call with?

    Hello

    I'm new to Skype, but I have a question about my calls.

    members of my contacts don't see who I am in a video call with? can they still "call me"? or I will be offline since I am already in a call?

    Thanks for any help.

    If you are in a call, while others see this.
    When you are already in a call and second call comes then you will have the opportunity to put one on hold or join the second call to the current call.

    You can set your status to "do not disturb", if you wish, and then the calls will be rejected automatically or sent to your voicemail if you have.

    You will not be shown offline if you are in a call, your status will remain the same.

    André

    If the answer was helpful, please mark with congratulations , and if the problem is resolved you can mark it with solution. This will help other users found this answer more easily. Thanks in advance!

  • don't use not webcam. can I use video calls with the status of "invisible"?

    If I use no webcam, can I make a video call with Invisible"like status?

    In Invisible mode, you can do exactly the same thing as in online mode.

    Without a webcam, you can not start video calls, but you will be able to receive another person's video.

Maybe you are looking for

  • Sierra of loading

    I tried to update Sierra on my mac pro book, but I don't have enough memory. I have returned to the old operating system and have cleaned memory. But now, I don't know how to re install Sierra. Can anyone help?

  • How can I restore my old profile data for the reinstalled firefox

    had a problem with the opening of firefox and he suggested that I install a new version, I did and I have an "old data firefox" file. My question is how can I reinstall the old file and all the stuff that's about it.

  • Satellite A350 - what software do I need for the special keys on XP?

    Yes, fortunately I have installled common Module on my windows XP. And that creates another question - what is the name of the software that runs my special keys on Satellite A 350 (I mean them for music and turning power switch lights on the keyboar

  • Scan function connects to the Windows 7 computer

    I have a LaserJet M1212nf, CE841A product number and a new Windows 7 computer. The printer works fine from the computer but the scanner is not recognized. I went to this subject through different programs, but nothing seems to work. I also tried to d

  • Please help me understand turbo boost on Pavilion X 2

    I can't find out how to activate the turbo boost on my HP Pavilion 11-h112nr X 2.  I double-checked the product description, which clearly states that the (Core i5-4202Y) processor is clocked at 1.6 Ghz but can be overclocked to 2.0 Ghz with turbo bo