Use of NOCOPY indicator simple no nested procedure

Hello

I walked into a new project and my head knows not much the oracle.

He wanted all the process in some standards that follows his friends in a similar project, which uses the same database schema.

His friends following the creation of the procedure as follows.

CREATE PROCEDURE new_procedure

(

OUT NOCOPY SYS_REFCURSOR O_LIST_REF,

Number of OUT NOCOPY O_RTRN_CD,

O_ERR_NBR OUT NOCOPY VARCHAR2,

O_ERR_DESC OUT NOCOPY VARCHAR2,

O_ERR_OBJECT_NAME OUT VARCHAR2 NOCOPY

)

as

BEGIN

OPEN O_LIST_REF TO SELECT...;

EXCEPTION

WHEN NO_DATA_FOUND THEN

O_RTRN_CD: = 7;

O_ERR_NBR: = SQLCODE;

O_ERR_DESC: = SUBSTR (SQLERRM, 1, 100);

O_ERR_OBJECT_NAME: = 'new_procedure ';

WHILE OTHERS THEN

O_RTRN_CD: = 4;

O_ERR_NBR: = SQLCODE;

O_ERR_DESC: = SUBSTR (SQLERRM, 1, 100);

O_ERR_OBJECT_NAME: = 'new_procedure ';

END new_procedure;

They say that they cannot modify the exception handling. This is the project .NET Standard.In they have a common procedure with the exception of hanle... blah... blah...

I agree... (Nothing else I can do right now.) "Let me see if I can convince them in the future.)

My concern is the NOCOPY indicator. The procedure described above is directly called from .NET. and isn't any procedure/function nested.

My question is with NOCOPY hint in this situation has any benefit? I do not understand why the NOCOPY hint is used in this situation to simple number and varchar2 fields.

Help, please

I walked into a new project and my head knows not much the oracle.

Excellent! The evolution of BEST PRACTICES is for management to be ignorant of all the detailed data that may affect their region. That supports the use of plausible deniability when problems arise.

He want all procedure in certain standards which his friends in similar project ,which uses the same database schema, follows.
 

OK - so do what're told you. After all, he is the boss and is free to set whatever standards he wants. You already said that you cannot chat with him about it so I do not understand why you post.

My concern is the NOCOPY hint.

Why? Why are you concerned? What, precisely, are you concerned about? We are unable to address your "concern" If you don't tell us what it is.

You said your lead 'don't know oracle much' which suggests that you do. So did you read the documentation for NOCOPY?

http://docs.Oracle.com/CD/E11882_01/AppDev.112/e25519/parameter_declaration.htm#LNPLS1271

The above procedure is directly called from .NET. and does not have any nested procedure/function.

OK - now you read the documentation at this link? Have you seen this part?

Request the compiler to pass the real parameter by reference instead of the value (in contrast, see "subroutine parameter passing methods '). Whenever the routine is called, the optimizer decides, in silence, to obey or disregard or not to NOCOPY .

Who says that the optimizer decides 'silently' to 'obey or do not hold account '. Which means that it someone will NOT tell what he decides to do before doing so.

Have you seen the straight section below the one where it says ' the compiler ignores NOCOPY in these cases?

Have you seen the last point?

  • The subprogram is called a link database or as an external subprogram.

NET is a subprogram of "external"?

My question is with NOCOPY hint in this situation has any benefit?

This first doc takes you to a "subroutine parameter passing methods.

http://docs.Oracle.com/CD/E11882_01/AppDev.112/e25519/subprograms.htm#LNPLS99952

  • By reference

    The compiler passes the subprogramme a pointer to the current setting. The actual and formal parameters refer to the same memory location.

  • By value

    The compiler assigns the value of the corresponding actual parameter in the formal parameter. The actual and formal parameters refer to different memory locations.

    If necessary, the compiler implicitly converts the data type of the actual parameter to the data type of the formal parameter. For more information about implicit data conversion, see Oracle database SQL language reference.

See this first ball "by reference"? This corresponds to NOCOPY.

See where it says "refer to the same memory location"?

Oracle knows the "memory location" If an external subroutine is used?

Do you remember this hard ball to front in the section about what NOCOPY is ignored?

I do not understand why the NOCOPY hint is used in this situation to simple number and varchar2 fields.

ONLY those who can tell you WHY that Council is "used in this situation' is the people who use it.

You ask your friends.

1. I have a mailbox at home

2. run a messaging service that can give me an e-mail I receive

3. I ask you to give me any mail I have and send you a mail box to put it in

Can you put the mail in the box to the letters that I sent you?

Can you, instead, use NOCOPY and put the mail directly in the box the letters home?

Oracle doesn't have access to the "places of memory", which are part of the external subroutines. He has ONLY access to his own memory.

Therefore to use NOCOPY the memory used by the parameter MUST DO part of the memory of Oracle to which it has access. Otherwise Oracle can't pass a "reference."

Tags: Database

Similar Questions

  • If I buy the iphone free sim 6s I will be able to use it with my simple mobile operator?

    If I buy the iphone free sim 6s I will be able to use it with my simple mobile operator?

    If you buy directly from Apple online or at an Apple store, it will work with any supported media. Just call the carrier and ask them if they support iPhones.

  • using the same indicator of string in different stacked sequences

    Hi guys, I want to use the same string in different sequences stacked indicator. I tried to plug the output of each string constant through the sequence on my indicator chain outside the block in the sequence, but then I get an error "wire connected to a tunnel not channeled. What is the best way to use the same indicator for all sequences?

    Hi JoVMo,

    You can just use a local Variable of this indicator within the sequence...

    Kind regards

    Nitz...

    (Kudos are always welcome)

  • Case function can be used as a parameter when calling a procedure, please advise...

    Case function can be used as a parameter when calling a procedure, please notify

    The daily procedure is called with the parameter 3 following one of the parameters using a function box between them as shown below.

    Daily_Ins (c1.p_mtrid, c1.p_UOM CASE WHEN "KWH" THEN 1 ELSIF 'KW' THEN 2 END, v_dateHold);

    In my opinion, using decode is illegal, so I think that I cannot say something like :

    Daily_Ins (c1.p_mtrid, ( decode c1.p_UOM, "KWH", 1 'KW', 2), v_dateHold);

    I think I just found something on the net

    SQL > DECLARE

    2 wages NUMBER: = 20000;

    3 employee_id NUMBER: 36325 =;

    4

    5 PROCEDURE give_bonus (emp_id in NUMBER, bonus_amt number) IS

    6 BEGIN

    7 DBMS_OUTPUT. Put_line (emp_id);

    8 DBMS_OUTPUT. Put_line (bonus_amt);

    9 END;

    10

    BEGIN 11

    12 give_bonus (employe_id,

    13 CASES

    14 salary when > = 10000 AND salary<=20000 then="">

    15. WHAT salary > 20000 AND salary<= 40000="" then="">

    16. WHAT > 40000 salary THEN 500

    17 0 OTHERWISE

    18 END);

    END 19;

    20.

    PL/SQL procedure successfully completed.

  • I have the last El Captain MAC update fom and an iMac Mid 2015 retina but Lightroom refuses to use the GPU indicating a display error. Has anyone else experienced the same question?

    I have the latest update of El captain and an iMac Mid 2015 retina but Lightroom refuses to use the GPU indicating a display error. Has anyone else experienced the same question?

    I also got an iMac mid 2015 27 "retina and not have problems. But I have another option 'see the add screen pictures"deselected it's the ravages of a single reading. See screenshot of my graphics card.

  • How to use the nocopy with java stored procedures parameters

    
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    
    

    I'm a PL/SQL programmer, but not a Java programmer. I have the following java function that does what it's supposed to add a pdf at the end of another pdf document:

    import oracle.sql.BLOB;
    import org.apache.pdfbox.util.PDFMergerUtility;
    import oracle.jdbc.OracleConnection;
    import oracle.jdbc.driver.OracleDriver;
    import java.io.OutputStream;
    
    public class PDFUtilities {
    public static BLOB appendPDF(BLOB pdfdoc1, BLOB pdfdoc2) throws Exception {
           
            //create a connection object to the current instance
              OracleConnection conn = (OracleConnection)new OracleDriver().defaultConnection();
            //create the output blob using the connection
              BLOB outPDF = BLOB.createTemporary(conn, true ,BLOB.DURATION_SESSION);
            //create an output stream to the output blob
              OutputStream os = outPDF.setBinaryStream(0);               
            //instantiate the pdf merger utility
              PDFMergerUtility mergerUtility = new PDFMergerUtility();       
            //connect the merger to the output stream
              mergerUtility.setDestinationStream(os);
            //stream from each input blob into the merger utility
              mergerUtility.addSource(pdfdoc1.getBinaryStream());
              mergerUtility.addSource(pdfdoc2.getBinaryStream());
            //merge the 2 input pdfs
              mergerUtility.mergeDocuments();             
            //do not close the output stream
            //return the blob
            return outPDF;
        }
    
    }
    

    CREATE OR REPLACE package PDFTOOLS.pkg_pdf_utilities
    as
    function f_get_merged_pdf (
              pi_pdf1       blob
            , pi_pdf2    blob
      )
      return blob;
    end pkg_pdf_utilities;
    /
    
    CREATE OR REPLACE package body PDFTOOLS.pkg_pdf_utilities
    as
    function f_get_merged_pdf (
              pi_pdf1       blob
            , pi_pdf2    blob
      )
      return blob
      as language java name 
      'com.mycode.pdftools.PDFUtilities.appendPDF(oracle.sql.BLOB, oracle.sql.BLOB) return oracle.sql.BLOB';
    end PDFTOOLS.pkg_pdf_utilities;
    /
    

    It's very basic, but doesn't seem to work. However, I want to my function from PL/SQL to a procedure that looks like this:

    CREATE OR REPLACE package PDFTOOLS.pkg_pdf_utilities
    as
    procedure sp_append_pdf (
              pio_pdf2append2   IN OUT NOCOPY blob
            , pio_pdf2append   IN OUT NOCOPY blob
      )
    end pkg_pdf_utilities;
    /
    

    What is important, what I'm trying to do is to NOCOPY the BLOBs. Otherwise, I have to read my PDF files into 2 BLOBs and create a 3rd blob as output. I prefer to be able to keep the pio_pdf2append2 as the final output. What I actually do call thing in a loop to gradually add a PDF file to a big. I'm not linking this in one operation because of concerns over the use of the system and because the pdfbox library java has would have been question after 850 in PDF format, which is not completely unrealistic in my approach.

    How could I achieve this?

    Post edited by: Pollocks01 only formatted code blocks because atlassian {code} tags didn't work.

    Passage of an argument as input/OUTPUT requires the mapping to a Java array.

    Simplified example that adds one FOR the other:

    create or replace and compile java source named blob_appender_src as
    import oracle.sql.BLOB;
    import java.sql.SQLException;
    import java.io.OutputStream;
    import java.io.InputStream;
    import java.io.IOException;
    
    public class BLOBAppender {
        public static void run (BLOB[] p1, BLOB p2) throws SQLException, IOException { 
    
            InputStream is = p2.getBinaryStream();
            OutputStream os = p1[0].setBinaryStream(p1[0].length()+1);                
    
            byte[] buffer = new byte[1024];
            int len;
            while ((len = is.read(buffer)) != -1) {
                os.write(buffer, 0, len);
            }
            os.close();
            is.close();
        }
    }
    
    create or replace procedure blob_append (
      p_lob1  in out nocopy blob
    , p_lob2  in            blob
    )
    as language java name 'BLOBAppender.run(oracle.sql.BLOB[], oracle.sql.BLOB)' ;
    /
    
    SQL> declare
      2    p_lob1  blob := utl_raw.cast_to_raw('ABC');
      3    p_lob2  blob := utl_raw.cast_to_raw('DEF');
      4  begin
      5    blob_append(p_lob1, p_lob2);
      6    dbms_output.put_line(utl_raw.cast_to_varchar2(p_lob1));
      7  end;
      8  /
    
    ABCDEF
    
    PL/SQL procedure successfully completed.
    
  • image appears in 11 GR 2 with simple pl/sql procedure

    Hi all

    I am facing a strange situation and maybe you could help me.

    I install a simple procedure to load and show images BLOB of a table to the browser in two different databases (10g and 11g) and different servers.

    When I call in 10g:

    https://Server1:4443/chain/Images_API.Get_Gif?p_name=logorecord1.gif against 11R2g db1

    I get the picture

    In the second 11g

    https://Server2:4443/chain/Images_API.Get_Gif?p_name=logorecord1.gif against 10gr 2-db2

    I get:

    The image " " https://orapetakjdev.net1.cec.eu.int:4443/chain/Images_API.Get_Gif?p_name=logorecord1.gif ' cannot be displayed, because it contains errors. .

    my Oracle HTTP server logs and mod_plsql logs show no errors.

    No idea how to solve this problem?

    Otherwise how to debug?

    Thank you in advance.

    (Images) CREATE TABLE

    ID NUMBER (10) NOT NULL,

    name VARCHAR2 (50) NOT NULL,

    the image BLOB NOT NULL

    )


    CREATE or REPLACE PACKAGE images_api AS

    Charge of the PROCEEDINGS (p_name IN images.name%TYPE);

    Get (p_name IN images.name%TYPE PROCEDURE,

    p_type IN VARCHAR2 DEFAULT 'gif');

    PROCEDURE get_gif (p_name IN images.name%TYPE);

    PROCEDURE get_jpeg (p_name IN images.name%TYPE);

    END;

    /


    CREATE or REPLACE PACKAGE BODY images_api AS

    Charge of the PROCEDURE (p_name IN images.name%TYPE) IS

    v_bfile BFILE.

    v_blob BLOB;

    BEGIN

    INSERT INTO images (id, name, image)

    VALUES (images_seq. NEXTVAL, p_name, EMPTY_BLOB())

    TURN the image INTO v_blob.

    v_bfile: = BFILENAME ('IMAGE_DIR', p_name);

    DBMS_LOB. FileOpen (v_bfile, DBMS_LOB.file_readonly);

    DBMS_LOB. LoadFromFile (v_blob, v_bfile, DBMS_LOB.getlength (v_bfile));

    DBMS_LOB. FileClose (v_bfile);

    COMMIT;

    EXCEPTION

    WHILE OTHERS THEN

    ROLLBACK;

    LIFT;

    END;

    Get (p_name IN images.name%TYPE PROCEDURE,

    p_type IN VARCHAR2 DEFAULT 'gif') IS

    v_blob BLOB;

    BEGIN

    CHOOSE the image

    IN v_blob

    Images

    WHERE name = p_name;

    OWA_UTIL.mime_header ("image /" | p_type);

    -Start, 9i method.

    DECLARE

    v_amt NUMBER: = 30;

    v_off NUMBER: = 1;

    v_raw RAW (4096);

    BEGIN

    LOOP

    DBMS_LOB. Read (v_blob, v_amt, v_off, v_raw);

    HTP.prn (UTL_RAW.cast_to_varchar2 (v_raw));

    v_off: = v_off + v_amt;

    v_amt: = 4096;

    END LOOP;

    EXCEPTION

    WHEN NO_DATA_FOUND THEN

    NULL;

    END;

    -End 9i method.

    -10g method.

    -WPG_DOCLOAD.download_file (l_blob);

    END;

    PROCEDURE get_gif (p_name IN images.name%TYPE) IS

    BEGIN

    get (p_name, "gif");

    END;

    PROCEDURE get_jpeg (p_name IN images.name%TYPE) IS

    BEGIN

    get (p_name, "jpeg");

    END;

    END;


    Hi Topas.

    I could be wrong, but this looks a bit like:

    (1) your character set of the client (in this case, mod_plsql) is different from the database character set

    (2) that the Content-Length which is calculated 'automatically' by something somewhere is incorrect.

    Maybe you should do instead * is * include the content-length header.

    Joel

  • Is it possible to see the pages that an image is used on through the use of page indicator?

    I create a book 5 Lightroom and really like that it shows me the number of times that that a photo was used in the book.  Is there a way to see where it is used?

    Click on the mouse exactly on the indicator 'Number' and the pages will go to the yellow-culminating point where this image was used. (be in multi-page view CTRL + E)

  • Using a dynamically allocated variable in a procedure?

    Hello everyone...

    I had a little problem in writing a query...

    In fact, I needed to create a tablespace by using a procedure

    My procedure is:

    create or replace procedure datafile_test as

    df_location varchar2 (600);

    Start

    Select distinct substr (file_name, 1, instr(file_name,'/',-1)) in df_location of dba_data_files;

    dbms_output.put_line (' location of the data file created is ' | df_location);

    end;

    /

    This procedure works fine but now my requirement is to use the value stored in the variable df_location in

    create the my_tbs < df_location > tbs.dbf tablespace size 20 m;  I need to write this statement in my Interior... How can I bring df_location value in my query

    is it possible to do?

    Thanks in advance...

    Hello Raymond vinay

    OK, your initial statement was not right and I haven't checked

    Try this one, it should work:

    create or replace procedure datafile_test

    as

    df_location varchar2 (600);

    v_statement VARCHAR2 (4000);

    Start

    Select distinct substr (file_name, 1, instr(file_name,'/',-1)) in df_location of dba_data_files;

    v_statement: = 'CREATE TABLESPACE MY_TBS DATAFILE ' | CHR (39) | df_location | ' / tbs.dbf'. CHR (39) | 'SIZE 20 M'

    -This is optional, but I use this:

    || "PERMANENT AUTOEXTEND OFF LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO FLASHBACK 8K BLOCKSIZE AUTOALLOCATE ONLINE ON.

    ;


    V_statement EXECUTE IMMEDIATE ;

    dbms_output.put_line ('Tablespace is created: "' |") v_statement | '"'));

    end;

    /

    I hope this helps you!

  • use workflow or a simple CRUD pages?

    Hello

    using JDeveloper 12 c.

    In my case, I use workflows to create a simple CRUD, I have two workflows, for that in the first, I have an Employees table and a button to create a new employee, the button has an action to go to a different workflow where I have a method call CreateInsert which will in turn view activity which has a form to create an employee.

    The problem is, when the principal task made a return to the main traffic but the table does refresh with the new employee, each isolated workflow transactions processed.

    I recommend working the CRUD with workflow or simple pages?

    Thank you much in advance.

    Hello

    Things mentioned above, I had a conclusion that you have two workflows. In the first workflow, you have a table and from there you call the second workflow task, in which you have the form to create employees and on validation, you return to the parent workflow, I'm good?

    How do you return to the parent workflow? Do you use the task flow back?

    Drag-and - déposer run the data control method in the first task flow (execute the method of the view object allows you to view the table) provide a case of control flow to the execute method of the appeal of workflow and task flow call and provide a control case of flow of this method to execute view activity in the first workflow. (see activity who contain the table).

    This is your main taskflow will look like

    View1---> TaskFlow call---> execute |  (To run to give control to flow to View11)

    ^--------------------------------------------------|

    Gijith.

  • Use the utilities from the Oracle stored procedure

    Hi all

    I use Oracle Import to load the data from .dmp file to Oracle table.

    Test/test leader IMP = Data .dmp fromuser = user1 touser = test tables = emp

    But my requirement is to create a stored procedure that will import data into the table and identify the number of loaded records and how impossible to import.

    Can I keep inside the procedure import statement?

    Thank you.

    No, not possible.

    IMP is an exe like sql more who can evoke to the command prompt.

    If you need all the actions on the imported... table export for example/test table, and then go further.

  • How to use PL/SQL indices

    Hello

    If I want to use the PL/SQL procedure tips, it is valid to write it this way:
    begin
     update /*+  INDEX(opp DIM_OPP_REFDB_IDX) */
            scott.rec_dim_opportunity opp
            set opp.mp_opportunity_re ....
    end
    I doubt when I tried the optimizer didn't actually use the index.

    Thanks in advance.

    Oracle 10g R1
    Windows 2003 32-bit

    It is the right way to compel boards,

    the index exists on the column used by your query?
    How big is the table?
    What's the expected release of your query?

  • How to use a button to fire the stored procedure or anonymous block PLSQL

    I am converting an application forms at the APEX, and which was easy became almost unbelievably difficult. I have a page that represents a record with an element called "history_rec". It is an element of the checkbox. Clicking on it causes the column for this record to be filled with the letter 'H', indicating that this recording is now historical and not assets. I also have this page a button that says "Renew Record." This button redirects to the current page and sets the value of 5 elements of the page on the values of the record being replaced with the new record.

    (This, incidentally, is an insurance system of follow-up to the loan guarantees. The insurance must be renewed annually, and this system is used to ensure that it is.)

    I also want the button to trigger a process that updates the old record by filling in the history_rec column. To do this, I created a process called "make_history" that contains the following SQL code:

    "Ensure the update
    Set history_rec = "H".
    "where insureseq =: P22_INSURESEQ.

    I chose for the 'process' Point ' on demand: run this process when requested by AJAX. "

    Is it possible my button 'Renew the Record' and if so, how? If this is not the case, how should I proceed?

    Doug,

    I'm glad you've made any progress.

    What process throws the error, it is the last process?

    "Error Unable to fetch row ' with this code ORA" ORA-01403: no data found. "

    Is page 21 page that you develop?

    I want to make is that demand for return on page 21

    What you already have for the branches Page?

    Jeff

  • How to use the current connection when the db procedure call?

    Hi all

    Use Jdevleoper 11.1.1.3.

    I have a java class that calls a database procedure, now everything is fine with me, but a little slow because am open a new connection, I think it would be certainly faster if the current connection is using
    so, how can I re - write my code so I can use the istead of connection today to define a new connection to the DB:

    public void DeleteApp (int PAppNo) {}
    String username, password, thinConn;
    username = "ACC";
    password = "ACC";
    thinConn = "JDBC: thin: @...» »
    try {}
    DriverManager.registerDriver new (OracleDriver());
    Connection Conn = DriverManager.getConnection (thinConn, username, password);
    CallableStatement cs = conn.prepareCall ("{call myprocedure(?,?,?)}");
    cs.setInt(1,PAppNo);
    ....
    }

    Thanks for all,
    MaLa

    I would like here...

    A big problem, it's that you must hard code connection information into the user interface. No change to a different DB server configure it without changing the code and redeployed.

    Next, why don't you put method in the module of the application and call it? This will keep the valid MVC pattern.

    Timo

  • Best way to use quot &amp; data xml; simple &amp; quot; controls

    Good evening everyone,

    I'm working on an application that retrieves the XML data and uses a DataGrid to display their (the very standard way).
    When a user selects a row in the DataGrid, I want to show more information in another panel - but not in a Datagrid (regarding only ONE item), but in simple controls such as labels or text boxes.
    This information is also stored in the XML data source, but it is not displayed in the DataGrid control.

    I think I'm pretty confused at this point, I think there must be a way easy and smart to do that, but I have not tried.
    I rly want to avoid to "manually" using SOMETHING like "label.text = xmlSource. ....'

    Is anyone an idea? :)

    Best regards
    Florian

    OHAIO

    Suppose you have 3 columns {id, firstName, LastName}
    Set the visible attribute for the column you want to hide to false.
    Add the click event to your DataGrid
    in the click handler function:
    private void clickHandler(e:Event):void
    {
    firstNameText.text. = selectedItem.firstName (e.currentTarget as DataGrid);
    }

Maybe you are looking for