Refcursor in the procedure

Hi all

There will be no effect in performance if we declare refcurosr with suspicion NOCOPY parameter in a Stored procedure procedure/package?

AFAIK variable refcursor who will make reference to the calling environment will hold just pointer not data and so avoid a NOCOPY effect.

Thank you!!

DS says:

One of my senior team members asked me to NOCOPY in all existing procedures where refcursor is returned as a parameter in my output project.

I told him that this will not add any performance improvement and has no effect.

I did it, because I was forced to do so.

Want to just check and take the advice from here in this forum.

I still have the document (in e-mails and in the procedure itself at the top) all these changes so that the future code-reviewers know EXACTLY why this change has been made and who authorized it. Probably you are asking your "senior" you say the reasons to support the change that they requested; You should document those as well.

Sounds like your "senior" team member is not so superior after all. You can use this as a topic of discussion in your dev group.

See the doc of the PL/SQL language.

http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/tuning.htm#i48500

Calls to PL/SQL Tuning subprogramme with NOCOPY hint

By default, OUT and IN OUT parameters are passed by value. The values of a IN OUT settings are copied before the delivery of the subprogramme. During the execution of the subprogramme, temporary variables to maintain the output parameter values. If the subprogram exits normally, these values are copied to the actual parameters. If the subprogram exits with an unhandled exception, the original settings are unchanged.

When the parameters represent structures of large data such as collections, records and instances of object types, this reproduction slows down execution and uses memory. In particular, this overload applies to each call to a method of the object: temporary copies are made of all attributes, so that any changes made by the method are only apply if the method ends normally.

To avoid this overload, you can specify the NOCOPY trick, which allows the PL/SQL compiler to pass OUT and IN OUT parameters by reference. If the subprogram exits normally, the action is the same as usual. If the subprogramme leaves at the beginning with an exception, the values of OUT and IN OUT parameters (or the attributes of the object) can still change. To use this technique, check that the subroutine handles all exceptions.

Note the reference to the "large data structures. As you already know a REFCURSOR isn't a large data structure, so will not use NOCOPY.

The most important side effect is that, as noted in the last paragraph above, the characteristics of the 'exit' are modified if you use NOCOPY.

Point out that the last clause in your "senior": ENSURE THAT THE subprogram MANAGES all THE EXCEPTIONS.

Normally (i.e. without using NOCOPY) a REFCURSOR lucifera is a parameter OUT will NOT have a value if the procedure stops with an exception if the caller is unable to use it eventually. Maybe this isn't the case if you use NOCOPY.

Generally however, the use of NOCOPY would simply be an amendment unnecessary, but harmless.

Tags: Database

Similar Questions

  • 2 refcursors within the same procedure using

    Hello
    Can we use 2 refcursors within the same procedure. This may seem strange. But I have a script to do so - one to dynamically check for some validations and another to return a result set.

    Yes, pass by the example below.

    CREATE OR REPLACE PACKAGE CURSPKG AS
    TYPE T_CURSOR IS REF CURSOR;
    PROCEDURE (EMPCURSOR ON T_CURSOR OPEN_TWO_CURSORS,
    DEPTCURSOR ON T_CURSOR);
    END CURSPKG;
    /
    CREATE OR REPLACE PACKAGE BODY CURSPKG AS
    PROCEDURE (EMPCURSOR ON T_CURSOR OPEN_TWO_CURSORS,
    DEPTCURSOR ON T_CURSOR)
    IS
    V_CURSOR1 T_CURSOR;
    V_CURSOR2 T_CURSOR;
    BEGIN
    V_CURSOR1 OPEN FOR SELECT * FROM EMP;
    V_CURSOR2 OPEN FOR SELECT * FROM THE DEPARTMENT;
    EMPCURSOR: = V_CURSOR1;
    DEPTCURSOR: = V_CURSOR2;
    END OPEN_TWO_CURSORS;
    END CURSPKG;
    /

    I hope that it would be useful.

  • How to return rows by using the procedure?

    Example: There are 3 areas: A, B, C and each region has some people.

    create table person (name varchar2 (2), area varchar2 (2));

    insert into values('A1','A') of the person;  -1st rank

    insert into values('A2','A') of the person;  -line 2

    insert into values('A3','A') of the person;  -tier 3

    insert into values('A4','A') of the person;  -tier 4

    insert into values('B1','B') of the person;  -tier 5

    insert into values('C1','C') of the person;  -tier 6

    insert into values('C2','C') of the person;  -line 7

    result as follows:

    A, B AND C

    --------------

    A1 B1 C1

    A2 C2

    A3

    A4

    If we ' select * from person ", then we had all the lines.

    I want to now choose volunteers in all areas, the rule is to pick one person from each region ordered, until that N people are selected. If N = 6, the sequence is

    A1, A3, A2, B1, C1, C2

    and want to return lines 1,5,6,2,7,3 (order of lines is not important) of the person.

    How to create a procedure for this? And I want to return as rows returned by a select phrase. (can be easily filled in a DataTable object and then be used in a program).

    Thank you!!

    Hello

    2985493 wrote:

    Thank you. Could you write a procedure to do the job? This is just an example, real choice rule is complicated enough to be used by the procedure and the cursor. I wonder how do to write a procedure returns the result as a select phrase.

    Here's one way:

    VARIABLE c REFCURSOR

    CREATE OR REPLACE PROCEDURE top_by_area

    (csr ON SYS_REFCURSOR

    , n_to_return IN PLS_INTEGER: = 6

    )

    IS

    BEGIN

    OPEN FOR CSR

    WITH got_area_num AS

    (

    SELECT name, area

    OF the person

    ORDER BY ROW_NUMBER () (PARTITION BY AREA

    ORDER BY name

    )

    area

    )

    SELECT name, area

    ROWNUM AS r_num

    OF got_area_num

    WHERE ROWNUM<=>

    ORDER BY r_num

    ;

    END top_by_area;

    /

    DISPLAY ERRORS

    EXEC top_by_area (: c);

    PRINTING: c

    PRINT the output of the command, given your sample data is:

    R_NUM DOMAIN NAME

    ---- ---- --------

    A1 1

    B1 B 2

    C1, C 3

    A2 4

    C2 C 5

    A3 A 6

    It's just a way to create and test the procedure.  I don't know how you plan to use it.

  • 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

  • Using the procedure to display the table of multiple data

    Hi, I need help for the procedure in oracle

    I want to create the procedure to display the table of multiples with sample plan

    with a parameter imployee_id to display an employee_id, name, function, start_date, end_date

    IAM using this query to select more than one table

    SELECT e.employee_id, e.first_name, j.job_title, h.start_date, h.end_date

    E EMPLOYEES

    JOIN j jobs

    ON j.job_id = e.job_id

    JOIN the job_history:

    ON h.employee_id = e.employee_id

    WHERE e.employee_id = 200;

    Thanks for the help

    Blu and Billy showed you the 'real' solution. You can display the data returned by a cursor ref in SQL Developer, too:

    http://www.thatjeffsmith.com/archive/2011/12/SQL-Developer-tip-viewing-refcursor-output/

    Yet as a duty for a beginner is generally do not have the expected solution. Usually, teachers want to see you using a LOOP and dbms_output. something like

    DECLARE

    Xy CURSOR IS

    SELECT whatever

    As much as;

    BEGIN

    FOR r IN xy LOOP

    dbms_output.put_line (r.col1 |' # ' | r.col2);

    END LOOP;

    END;

    Of course this suggestion will inaugurate a discussion abusing DBMS output but I keep my position that it is authorized to use it for learning the basics.

  • A loop in a refcursor for the list of dates as a string

    Hello
    I have a simple procedure that gives me the list of dates and dates
    I need to get the dates dates separated by commas
    I don't know if this can be done directly by making a loop on the refcursor or I have to go pick her up in a file/table and then concatenate with comma, or is there anything else that can be done.
    I tried some stuff like below

    PS help out me
    the procedure is that returns the list of dates
    CREATE OR REPLACE procedure SALUSER.prm_sp_rpt_payslip_lop_dates(p_empid in int,p_tran_year in int,p_tran_month in integer,o_dates out sys_refcursor)
    as
    begin
     open o_dates for select  to_char(PHL_LOP_FROM,'DD-Mon-YYYY'),to_char(PHL_LOP_TO,'DD-Mon-yyyy') 
                     from prm_h_lop
                     where phl_emp_id=p_empid
                       and phl_tran_year=p_tran_year
                       and phl_Tran_month=p_tran_month;
    
                   
     end;
    /
    I need my o/p as
    dates :<date1>,<date2>...etc
    Kind regards

    Maybe sth. as

    SQL>  var cur refcursor
    
    SQL>  declare
     cr sys_refcursor;
     procedure prm_sp_rpt_payslip_lop_dates (cr in out sys_refcursor)
     as
     begin
       open cr for select hiredate from emp;
     end prm_sp_rpt_payslip_lop_dates;
    begin
     prm_sp_rpt_payslip_lop_dates(cr);
     open :cur for select 'Dates: ' || column_value dates from xmltable('string-join(//text(), ", ")' passing xmltype(cr));
    end;
    /
    PL/SQL procedure successfully completed.
    
    SQL>  print cur
    
    DATES
    --------------------------------------------------------------------------------
    Dates: 17-Dec-1980, 20-Feb-1981, 22-Feb-1981, 02-Apr-1981, 28-Sep-1981, 01-May-1
    981, 09-Jun-1981, 19-Apr-1987, 17-Nov-1981, 08-Sep-1981, 23-May-1987, 03-Dec-198
    1, 03-Dec-1981, 23-Jan-1982                                                     
    
    1 row selected.
    
  • What is the procedure for upgrading Thunderbird ESR 17.0.7 at 31.6 on Mac OSX 10.10.2?

    What is the procedure for upgrading from Thunderbird ESR 17.0.7 at 31.6 (last public version) on Mac OSX 10.10.2?

    Is it as simple as install new version and then run to see all local folders and my email and its folders from IMAP to my company as before the upgrade?

    Thank you

    Create a full backup of your Thunderbird profiles folder.
    Uninstall the old version of ESR.
    Download the latest version from https://www.mozilla.org/en-US/thunderbird/all.html and install it.

  • the procedure entry point NSSUTIL_EscapeSize could not be located in the dynamic link library nssutil3.dll

    Windows XP with Firefox 18.0.1 does not open when upgraded to the latest version.
    Error messages have been
    (1) the procedure entry that point pr_setcurrentthreadname could not be located in the dynamic library (2) ndpr4.dll the procedure entry point NSSUTIL_EscapeSize could not be located in the dynamic links (3) library nssutil3.dll was not able to load XPCOM

    A ran malware & anti-virus software then deleted Firefox via Control Panel, then residual file file C:\Documents & Folders\ApplicationData\Mozilla Director and program folder.
    Local & installed products ndpr4.dl and nssutil3.dll - fresh reinstall firefox several times - he got rid of the error message 1 but not 2 or 3 always cannot open Firefox.
    All solutions?

    I have this problem and I use Zone Alarm Extreme Security with Force active field. I found that by turning off the virtual Cache in Zone Alarm that this problem has disappeared and has been able to restart firefox.

    Here is a post I found that addresses the issue in some way. http://KB.mozillazine.org/Browser_will_not_start_up#Firefox_does_not_start_after_updating_with_ZoneAlarm_ForceField_enabled

  • After you install a Foxfire 5.0 update, I get this message when you try to open Mozilla: the procedure entry point sqlite3_db_status could not be located in the dynamic link library mozsqlite3.dll.

    I get this message when you try to open Mozilla: the procedure entry point sqlite3_db_status could not be located in the dynamic link library mozsqlite3.dll.

    Do a clean reinstall.

    Download a new copy of Firefox and save the file to the desktop.

    • Uninstall your current version of Firefox.
    • Do not remove the data of a personal nature when you uninstall the current version.

    Delete the program folder Firefox before installing newly downloaded copy of the Firefox installer.

    • It is important to remove the Firefox program folder to delete all the files and make sure that there is no problem with the files that were the remains after uninstallation.

    Your bookmarks and other profile data is stored in the Firefox profile folder and will not be affected by a relocation, but make sure that you do not select delete data of a personal nature if you uninstall Firefox.

  • I downloaded Itunes 12.3.3 and now I tunes does not recognize my Ipad or Iphone. I went through all the procedures and just uninstall and reinstall. Please fix 12.3.3.Thanks.

    I downloaded Itunes 12.3.3 and now I tunes does not recognize my Ipad or Iphone. I went through all the procedures and just uninstall and reinstall. Please fix 12.3.3.Thanks.

    iTunes: fix iPhone or iPod not detected Windows 10

  • The procedure of procurement of the game Clash of Clans first two payments $9.99 $4.44 and the second did not gems continued with the developer of the game and they told me to resolve this ongoing problem with Apple's iTunes... help me solve

    The procedure of procurement of the game Clash of Clans first two payments $9.99 $4.44 and the second did not gems continued with the developer of the game and they told me to solve this problem continue with Apple iTunes... help solve me this problem and the compensatory jewelry

    Double-see your message, my first response to this topic tells you how to contact iTunes Support (we are fellow users): Re: the procurement process of the Clash game Clans the amount was deducted from the iTunes account and do not have t...

  • Hello everyone, I just bought a Thunderbolt Apple display to use with my 2012 15 "27" Macbook Pro, Win10/Bootcamp. Is anyone know the procedure to get the display to work with Bootcamp Windows 10?  I have connected screen but no picture. TY

    Hi all

    I just bought a Thunderbolt Apple display to use with my 2012 15 "27" Macbook Pro Win10/Boot Camp running. Is anyone know the procedure to get the display to work with Bootcamp/Windows 10? Is there a setting in the training Camp that must be turned on to make it work? I have connected screen but could not get a desktop display.  Any help would be really appreciated! TY

    The monitor should have a TB and adapter power connector. The monitor works on both OSX. ? If so, shut down of windows, connect monitor and start Windows. Your TB 2012 monitor is not plug-and-play with Windows.

    Please see ports Thunderbolt and views: frequently asked questions (FAQ) - Apple Support .

    1. the "hot pluggable" Thunderbolt devices using Windows with Boot Camp?

    Thunderbolt hot plugging is supported under Windows 8 or 8.1 on all Macs from 2014 and later.

    For all other Mac computers, Windows 7, 8 and 8.1 scans and active them Thunderbolt devices connected to ports Thunderbolt during the Windows startup process. If your device has been plugged in not at startup, Windows detects not without a reboot.

  • Error "the procedure entry point SMapLS_IP_EBP_12 be found in KERNEL32.dll dynamic link library" when you try to play Red Alert: Command & Conquer

    Original title: the procedure entry point SMapLS_IP_EBP_12 could not be found in KERNEL32.dll dynamic link library.

    Ive been trying to install Red Alert: Command and Conquer on my new pc windows 7 and of course he will not play to come with all can't play because its running windows 6.1 and it's a single program of windows 95. then I went through all troubleshooting and change everything to make sure that it works and it actually installed, but when I went to play this message appears and im like why does this happen to me!

    The procedure entry point SMapLS_IP_EBP_12 be found in KERNEL32.dll dynamic link library.

    It of the message, can someone help me?

    Hi BigAl3000,

    Please note that Command & Conquer: Red Alert 3 is the only version compatible with Windows 7.

    Red Alert 2 and red alert are not compatible with Windows 7.

    See Windows 7 compatibility for Command & Conquer: Red Alert for more information.

    To troubleshoot program compatibility issues in Windows 7, try the following methods:

     

    Method 1: Open the program compatibility problems

     

    Most programs written for Windows Vista are also running Windows 7, but some older programs might run poorly or not at all. If an older program does not work, use the program compatibility issues to simulate the behavior of earlier versions of Windows.

    Method 2: Contact the program vendor or the hardware manufacturer

     

    Contact the program vendor for advice on how to solve the problem. In general, the software vendor's Web site provides a support section that you can use, for example, to search for an error message that you receive from the program.

    Hope this information helps.

    Gokul - Microsoft Support

    [If this post was helpful, please click the button "Vote as helpful" (green triangle). If it can help solve your problem, click on the button 'Propose as answer' or 'mark as answer '. [By proposing / marking a post as answer or useful you help others find the answer more quickly.]

  • the procedure entry point GetFinalPathNameByHandleW could not be found in KERNEL32.dll dynamic link library

    Hello

    While trying to install a program, I see the following on the screen error message:

    The procedure entry point GetFinalPathNameByHandleW could not be found in KERNEL32.dll dynamic link library

    The I set him, is a Windows XP 32-bit environment.

    The I am installing, is a program, created by my own company, using a 32-bit self-extracting installer, which is also created by my own business using InstallAnywhere Flexera software.

    No changes were made on the environment of the installers.

    No change seems is done on the environment for creating installation programs (where the self-extracting installer is created): I checked the monitor of reliability/Action Center / Control Panel and no entries are present between a job and an installer without work.

    The file 'KERNEL32.dll' is mentioned in the error message, I checked his date of change, which is 11/30/2012, this should not be the cause of the problem either.

    Witnin the self-extracting installation program, a few changes were found, those who are considered at the moment, but there is no indication or not those who are causing the error message I see here.

    Does anyone have an idea what may cause the error message mentioned and how to cope?

    Thank you

    Dominique

    These types of error messages mean that the program is looking "inside" the file specified (in this case kernel32.dll) try to find a function/procedure to run called "GetFinalPathNameByHandleW" and find do not.

    The program calls the non-existent function badly or the library file is not in there.  Things do not match somewhere.

    A DLL is a library of dynamic links and files as kernel32.dll are sometimes just a bunch of procedures/functions/subroutines and all located in a single, portable file.

    In a primitive way, you can use a text editor to open the kernel32.dll file (make a copy if it your desire) and search for a string "GetFinalPathNameByHandleW" and you will not find.

    You can even search for "GetFinal", and you won't find it in the XP kernel32.dll file:

    But if you do the same thing on a Windows 7 + kernel32.dll you 'll find:

    If your program calls a function inside a DLL, but this feature does not exist in the Windows XP's kernel32.dll file.

    I think that GetFinalPathNameByHandleW was introduced in Windows Vista, so now here you would be fine.

    If who wrote your program is that it works on XP, they need to stick to the functions that are part of XP and GetFinalPathNameByHandleW isn't here, where the error.

  • 'The procedure entry point DecodePointer could not be found in KERNEL32.dll dynamic link library '.

    ORIGINAL TITLE: How can I fix this please?

    I have an older version of Windows XP (Home edition) Version 5.1.  Trying to get updated with service packs, etc., I get the pop up message in the box below.  How can I fix the problem?

    'The procedure entry point DecodePointer could not be found in KERNEL32.dll dynamic link library '.

    Thank you for your help.

    The other post:

    We get an error "iexplore.exe - point of entry not found in KERNEL32.dll dynamic link library" so he was trying to use internet explore.

    In Firefox, I have automatic updates verified, but for some reason any I do not receive them.  I need all the service packs for Microsoft.

    When I try to use Internet Explorer to connect to the internet, I get a message that says "iexplore.exe - point of entry not found in KERNEL32.dll dynamic link library" How can I fix?  I get a lot of error messages related to the KERNEL32.dll dynamic link library.

    In addition, for some unknown reason, I lost my software of Microsoft - Word, Excel, etc.  I don't have the disc to recharge.

    Thanks for any help.  This kind of thing is frustrating and I really appreciate the availability of Microsoft Answers for assistance.

    Additional post:

    Im trying to update my computer with SP2 and Windows 7.  Even when I try to use I Tunes and do other things that I receive and message entry point (they vary).

    Here are a couple:
    1. the procedure for DecodePointer entry point could not be located in the line of the dynamic library KERNEL32.dll.

    2. the procedure entry point SHRRegGetValueW be found in the library of dynamic links SHLWAPI.dll.

    I have an old computer. Compaq Windows XP - Home Edition, 5.1.

    A month ago I lost my Microsoft Office software. Word and excel... it was all gone.   I have to reload the diskettes of origin provided with this computer which is about 7 years old.

    Is this thing?  I CAN go on the internet and move OK, but I can't download updates, or I Tunes or much else.

    * Original title: do not get the automatic updates.

    http://Windows.Microsoft.com/en-us/Windows/help/learn-how-to-install-Windows-XP-Service-Pack-3-SP3

    Tom Ferguson

Maybe you are looking for