Call stored procedures and using its output parameters in a report

Hello

I have a procedure defined in a package on the database. This procedure returns a number of output parameters. How to call this procedure and use the output parameters in my report?

Thank you, Mark

Depends on the level at which the procedure should be called. If its at the State level, call the form in the trigger-REPORT-BEFORE (or AFTER-PARAMFORM) and store the off-values space reserved columns. These you can use anywhere in your report.

Tags: Oracle Development

Similar Questions

  • Call the stored procedure, and bind parameters by name

    Hello

    I use the Oracle ODBC 12 c driver to pass values from one Interface to our database Oracle 11.2. The Interface software collects data from modbus protocoll and calls a stored procedure. Right now my syntax to call the stored procedure looks like this:

    CALL procedure-name ('STRING', 'Timestamp as String', numValue1);

    It works very well. Now, I have to add a default setting to my procedure. To stay flexible to make other changes, I want to call the procedure and bind the parameters by name. Release 10.2.0.1.0 ISC ODBC Notes:

    Added support for the named parameter, binding the parameters by name. ODBC Oracle driver now allows the application to specify the parameters of a stored procedure by name, in the procedure call. Named parameters are to be used in calls to stored procedures and should not be used in other SQL statements.

    So, it shouldn't be a problem to use named notation, but how do I do this in ODBC? I tried like this, but oracle returns an ora-00936 error of missing expression:

    call procedure-name (paramName1 = > 'STRING',= paramName2 > 'Timestamp as String',paramName3 = > numValue1).


    Thank you for your help.

    Finally, I was able to find the error. The syntax of the statement was very good. The problem was caused by another declaration that I edited before and the error has not attracted Attention immediately.

    Thanks for reading and looking for an answer.

  • Calling stored procedures with parameters with the database connectivity Toolkit

    Hi all

    I'm new to the forum and struggling to find a solution to a particular problem I have in this respect, using the LabVIEW Database Connectivity Toolkit on a project, I am currently working on my work.  I have a database in which I tables and stored procedures with parameters.  Some of these stored procedures have input, output and return parameters.

    I tried to follow this example, but to no avail: http://digital.ni.com/public.nsf/allkb/07FD130746083E0686257300006326C4?OpenDocument

    Such a stored procedure I am working on the implementation is named "dbo.getAllowablePNs", running "SELECT * from DeviceType" (DeviceType is the table).  In this case, it requires no input parameter, it has an output parameter that generates the table [cluster] and has a return parameter that returns an integer value (status code for execution) to show if an error occurred.  The DeviceType table has 3 columns; ID (PK, int not null), PN (nvarchar ((15), null) and NumMACAddresses (int, null).)  I have surpassed many examples and I talk to the support OR try to implement this and similar procedures stored in LabVIEW but have not been successful.  I am able to connect to the database with the VI of open connection without error, but spin in some confusion as a result of this step.  I then try to use the VI of parameter query create to call the stored procedure and set the parameters.  I guess I would then use the Set parameter value for each parameter that is connected to the entry of parameters on the previous query with parameters VI VI?  I am also having some confusion during and after these steps as well.  I would greatly appreciate advice or suggestions that anyone could have in this situation because I am not a SQL expert.  Also, I would be happy to provide more information that might be useful.

    Kind regards

    Jon

    Here's what I use to do this.  I think I had to change him create parameterized query VI for him to work.  There is a post on the forum about this somewhere.

  • Call stored procedures in the object module and application of entity

    Hello

    I've implemented a helper methods that contains the EntiyImpl base class to call stored procedures.

    Now, I need to call procedures stored from the module of the application.

    Apart from the creation of a module base class asks and the programme of assistance of duplication of code in the method is possible
    to share methods of assistance for calling stored procedures between the entity impl and application module impl?


    Concerning
    Paul

    Support code depends on characteristics of an object instance given entity beyond its database transaction?

    If so, I'm not sure I see how it could be used with a class of application module.

    Otherwise, here's what you do:

    Step 1:

    Set up the database transaction - you can even choose to. So instead of

    {myHelperMethod (Object someParam) protected
    DBTransaction trans = getDBTransaction();
    ...
    }

    This is for change

    protected myHelperMethod (DBTransaction trans, someParam Object) {}
    ...
    }

    Step 2: make the method public and static - once you set DBTransaction, you should be able to do.

    public static myHelperMethod (DBTransaction trans, someParam Object) {}
    ...
    }

    Step 3: Remove your EntityImpl base class method in a utility class:

    Public MustInherit class PlSqlUtils {}
    private PlSqlUtils() {}

    public static myHelperMethod (DBTransaction trans, someParam Object) {}
    ...
    }
    }

    When you call the method of application module, object entity or class of same view object, call

    PlSqlUtils.myHelperMethod (getDBTransaction (), paramValue);

    Unlike Transaction.executeCommand (), allows you to provide features like the setting procedure of parameter values, recovery of the values of the parameters, etc.

    Hope this helps,
    Avrom

  • NullPointerException when calling stored procedure

    I have the stored procedure

    create or replace PROCEDURE GREETING_PROC

    (

    TEXT_PARAM IN VARCHAR2

    MSG_TEXT VARCHAR2 OUT

    ) AS

    BEGIN

    MSG_TEXT: = "Hello" | TEXT_PARAM;

    END;

    My stored procedure call method

    public class UserBean {}

    public UserBean() {}

    Super();

    }

    Public Shared Sub main (String [] args) {}

    UserBean userBean = new UserBean();

    userBean.callP ();

    userBean.callStoreProcedure ();

    }

    public void callStoreProcedure() {}

    CallableStatement st = null;

    SysUser SysUserEOImpl = new SysUserEOImpl();

    try {}

    String sql = "BEGIN GREETING_PROC (: TEXT_PARAM,: MSG_TEXT); END; « ;

    St = sysUser.getDBTransaction () .createCallableStatement (sql, sysUser.getDBTransaction (). DEFAULT VALUE);

    st.setObject ("TEXT_PARAM", "Scoot");

    st.registerOutParameter ("MSG_TEXT", Types.VARCHAR);

    St.Execute ();

    System.out.println ((String) St.GetObject ("MSG_TEXT"));

    } catch (SQLException e) {}

    throw new Aexception.getLocalizedMessage (e);

    }

    }

    then I got an exception:

    Exception in thread "main" java.lang.NullPointerException

    at cic.opsi.model.bean.UserBean.callStoreProcedure(UserBean.java:35)

    at cic.opsi.model.bean.UserBean.main(UserBean.java:27)

    Hello

    What statemet is UserBean.java:35)?

    Second, create a new SysUserEOImpl()!

    If you want to call stored proc, put the java code calling stored proc in ViewRowImpl/ViewObjectImpl/ApplicationModuleImpl and export this code in the customer interface. Then put this method in the pageDef as a call him as an OperationBinding

    Zeeshan Baig blog: the PL/SQL procedure call and function in the Oracle ADF application

    Extending the functionality of the components Business

    ADF/OFA for Oracle Techies: ADF call stored procedure with Out parameters

    Latest Oracle technology: call Store procedures for Oracle ADF Application

  • Calling stored procedure - re-edited NullPointerException

    Hi all

    I am re-editing that my first attempt was quite low.

    I want to create a Java application that communicates with an Oracle XE database edition to:

    Class.forName ("oracle.jdbc.driver.OracleDriver");
    JOptionPane.showMessageDialog (null, "Driver loaded");
    Connection con = DriverManager.getConnection ("jdbc:oracle:thin:@//localhost:1521/xe", "SYSTEM", "root");
    JOptionPane.showMessageDialog (null, "database connected");

    This all works fine and I can perform queries and transactional instructions within the instance of java.

    However, I can't call stored procedures that I will receive a null pointer exception. The stored procedure, I try to call returns values however I know it works as I can run it in SQL Developer. The code below is the statement that calls the stored procedure, alll the sources I looked at it's correct, I also tried, cs.executeUpdate and Resultset rs when you try to call the java statement.

    public void thread_actionsperformed (ActionEvent c) //generates son
    {
    Try
    {
    CallableStatement cs = con.prepareCall ("{call PROCEDURE2}"); Calls a stored procedure that would generate threaded emails
    CS. Execute();
    JOptionPane.showMessageDialog (null, "Algorithm Threading successfully Executed");
    }
    catch (SQLException ex)
    {
    ex.printStackTrace ();
    JOptionPane.showMessageDialog (null, "Threading algorithm Executed without success"); Error response
    }
    catch (NullPointerException ex)
    {
    ex.printStackTrace ();
    JOptionPane.showMessageDialog (null, "Threading algorithm Executed without success"); Error response
    }
    }

    The Java application cannot 'see' the sp? Or is it something to do with privileges? I was puzzled by this during some time now, any help would be greatly appreciated.

    java.lang.NullPointerException
    at ETA_Final.thread_actionPerformed (ETA_Final.java:332)
    to ETA_Final$ 5.actionPerformed(ETA_Final.java:141)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    in javax.swing.AbstractButton$ Handler.actionPerformed (AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
    in javax.swing.plaf.basic.BasicMenuItemUI$ Handler.mouseReleased (BasicMenuItemUI.java:1264)
    at java.awt.Component.processMouseEvent(Component.java:6263)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
    at java.awt.Component.processEvent(Component.java:6028)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4630)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

    Thank you and best regards,

    K

    Published by: Outbound86 on April 28, 2010 13:58

    Hi Kev,

    I expected this - so is it possible that your dumb object is null when you are in the ActionListener who manages the procedures?
    How will you spend until you use it (line 332), are you using Threads?

    Thnaks,
    Ivaylo

  • stored procedure and in the app engine peoplecode

    Hey all,.
    I want to call a stored procedure in peoplecode using sqlexec. I guess that the syntax is correct.
    SqlExec ("exec sp_name');

    My question is
    the peoplecode will wait until the end of the stored procedure?
    or
    is it just to send the command to the database to run the stored procedure and continue following the instructions after the exec sql.

    Please let me know if I'm not better explain and need an example.

    Please help me.
    Thank you.

    «.. . "will be the peoplecode wait for the completion of the stored procedure.
    Yes.

    Nicolas.

  • How to run a stored procedure by using the steps in database?

    Hello

    I'm trying to run some procedures of the store and it will not work.

    See the file attached is seq.

    I have a varchar parameter (50), which must also be provided to the stored procedure and it returns an int.

    To do this I had to only use data in an open statement

  • How to query the DDL lock functions or stored procedures and packages?

    Hello!

    The subject says it all: how to display existing DDL locks on the functions or stored procedures and packages?

    While running a procedure, it cannot be deleted or replaced, so there must be a DDL lock on it. The information does not seem to be in V$ LOCK or V$ LOCKED_OBJECTS.

    Thank you!
    Marcus

    Published by: David on November 21, 2009 15:43

    Hello

    You have the DBA_DDL_LOCKS view.

    Best regards
    Jean Valentine

  • two related issues: to call the stored procedure and passing in an array of elements using htmldb_Get

    I need to save items of ApEx generated dynamically via AJAX.  I use the APEX_ITEM API to generate the elements.  At runtime, I have no idea how much of elements are generated on the page, but I know that they're all separate and discreet 'name' attributes, i.e. f01, f02, f03, etc..  As a basic example, if I have to generate a selection list, I know that the parameter "p_idx" of the APEX_ITEM call is to say '3', so select all lists that get generated have a "name" attribute in "f03" DOM, all text elements will be "f01", etc.

    I want to record these data in the database using AJAX.  It is common to call the javascript htmldb_Get function that is standard for the use of an application process, but I am interested in the use of the rarely called upon 'internal' and queryString"options of this javascript function so that I can build the query string to the fly according to what is on the DOM when it tries to save the data they have entered into these items generated by APEX_ITEM.  Someone at - there are good examples of the use of the 'procedure' and 'queryString' the javascript htmldb_Get function parameters?

    I have found a handful of some blogs, messages, etc. online linked to this, but just for most people regurgitate the documentation.  I found this post (https://forums.oracle.com/thread/2549237), which has had a glimpse of hope to move from a table (which is something I need) as a parameter, but as someone in their right mind would check this before you go this route.

    Shane.

    ApEx 4.2.1

    Shane

    Since you mention that you are on 4.2 APEX I advise to use apex.server.process which is replacing the htmldb_Get officially undocumented documented.

    In the literature, it is that the first parameter is the ajaxidentifier but it's actually the name of the process.

    The data object would be something like

    var lData ={f01 : get_value_array('f01')}
    

    Where is get_value_array

    function get_value_array(pColumnName) {
      var l_values =[];
      apex.jQuery('[name="'+pColumnName+'"]').each(
       function(){
        var l_value;
        l_value = apex.item(this.id).getValue();
        l_values.push(l_value);
       }
      );
      return l_values
    }
    

    For an example see this demo.

    Nicolette

  • java.sql.SQLException: ORA-06550 and ORA-00900 call stored procedures

    Hi all

    I have 2 a stored procedures that I want to call from my Session bean. One of them takes a few settings, but not the other. When I call the procedures, I get the following errors described below. I tested the two stored procedures in sql plus and sqldveleoper and they work well. The funniest, it is, I have another stored procedure that I can call successfully from the same bean in session with no problems, so I'm a bit confused as to why his play now.

    I use stand-alone 10.1.3.4 OC4J and Oracle 10 g Db 10.2.0.4 and platform DB that I use is Oracle10gPlatform and Eclipselink as my JPA provider. I have also tried against toplink (not toplink essentials) and still no joy

    Here is the error I get when I try and call the procedure which takes the parameters of the session bean
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'HASHDATA'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    
    Error Code: 6550
    Call: BEGIN HashData(input=>?, hashedValue=>?, hashed=>?); END;
         bind => [password1, => hashedValue, => hashed]
    Query: DataReadQuery()
    Here are my stored procedure that take parameters
    create or replace procedure hashData(input IN VARCHAR2, hashedValue OUT BLOB, hashed OUT BOOLEAN)  as  
    
    inputRaw RAW(2000);
    --hashed BOOLEAN := false;
    begin 
    
    dbms_output.put_line('the data to be hashed is '||input);
    
    dbms_output.put_line('converting input to raw ...');
    inputRaw := utl_i18n.string_to_raw(input,'AL32UTF8');
    
    dbms_output.put_line('Hashing Data ...');
    hashedValue := DBMS_CRYPTO.Hash (src=>inputRaw,typ=>DBMS_CRYPTO.HASH_SH1);
    
    dbms_output.put_line('hash is '||UTL_I18N.raw_to_char(dbms_lob.substr(hashedValue, 4000,1)));
    
    if (hashedValue  is not null) then 
     
    
     hashed :=true;
      dbms_output.put_line('hashedValue IS NOT  null');
     else
     hashed := false;
      dbms_output.put_line('hashedValue IS null');
     end if;
    
    end;
    Here is my code in the session bean to call the procedure that takes as parameters (Hashdata)

    public UserBean() {
              // TODO Auto-generated constructor stub
    
              sessMan = SessionManager.getManager();
              session = sessMan.getSession("Session", Thread.currentThread()
                        .getContextClassLoader());
    
         }
    
    public Serializable hashData(String input){
    
              logger.debug("Hashing Data ... "); 
              hashedValue= null; 
              boolean hashed=false; 
         
              StoredProcedureCall call = new StoredProcedureCall();
    
              ValueReadQuery query = new ValueReadQuery();
              call.setProcedureName("HashData");
              call.addNamedArgumentValue("input", input);
              call.addNamedOutputArgument("hashedValue", "hashedValue", java.sql.Blob.class);
              call.addNamedOutputArgument("hashed", "hashed", java.lang.Integer.class);
                        
              query.addArgument("input");
              
              query.setCall(call);
              
              session.executeQuery(query);
               
              if ((Boolean)hashed){
                   logger.debug("The data has been hashed and the hash value is: "+hashedValue);
              }
              
              else{
                   logger.debug("The data has could not be hashed");
                   hashedValue=null;
              }
              
              return (Serializable)hashedValue;
              }
    When I call the other takes no parameters, I get the following error.
    Internal Exception: java.sql.SQLException: ORA-00900: invalid SQL statement
    
    Error Code: 900
    Call: BEGIN testJPAProc(); END;
    Query: DataReadQuery()
    Here is the procedure which takes no parameters
    create or replace procedure testJPAProc is 
     
     begin
     dbms_output.put_line('testJPAProc called');
     end;
    Heres is the code to call procedures that take no parameters
                                    StoredProcedureCall call = new StoredProcedureCall();
      
              ValueReadQuery query = new ValueReadQuery();
              
              call.setProcedureName("testJPAProc");
              query.setCall(call);
              
              session.executeQuery(query);
    You guys can tell me where I'm wrong if I do something wrong. Why make these mistakes? because as far as I can tell the code (java and pl/sql) are both correct unless there is something I missed. It's kinda funny because I have another stored procedure I can call successfully.


    Thank you

    The first question is that the Boolean in Oracle is not a supported JDBC type, but a PLSQL type.
    Change to an INTEGER is probably the best, you can also use the PLSQLStoredProcedureCall class to access.

    The second problem is perhaps that the stored procedure is not valid, make sure that it compiled correctly. It can also be the type of your query, you must use a DataModifyQuery, not a read request that it returns nothing.
    If still no luck, try to call directly through JDBC, it works?

    ---
    James: http://www.eclipselink.org: http://en.wikibooks.org/wiki/Java_Persistence

  • Insert a record, call a stored procedure and execute a shell script

    Hello

    I am trying to build a page APEX do these three things in order.

    #1. Insert a new record in a database table (pk, donnees_xml, attr1 and attr2, etc.) and download the XML file to the donnees_xml column

    #2. Save this XML file on a file system

    #3. Parse the XML file on a file system and update the database with the parsed data table

    I can do #1 with a regular shape based on the database table. I can do #2 with a stored procedure.

    I can do #3 with a shell script.

    I wonder how these tasks can be combined into a single action in APEX.

    do #1;

    If successful, do #2;

    If successful, do #3;

    I'd appreciate comments on this.

    Thank you

    Define a process of PL/SQL page submit that runs after the record is inserted, if P1_FILE is not null.

  • Problem with stored procedure and validation

    I have the following stored procedure:

    create or replace PROCEDURE SOME_PROC)

    /*

    Some settings

    */

    ) AS

    NUMBER of errors

    BEGIN

    errors: = FN_CHECK_BUSINESS_RULE_1 (/ * some args * /);

    if(Errors > 0) then

    raise_application_error (ERR_CONSTANTS. SOME_ERROR_NUMBER, ERR_CONSTANTS. SOME_ERROR_MESSAGE);

    end if;

    INSERT INTO une_table (/ * columns * /) VALUES (/ * values * /);

    END SOME_PROC;

    Because the business rule 1 is placed inside the stored procedure I can't check it out without calling the stored procedure.

    I need to call the stored procedure 10 times with a different set of parameters and validation of the changes only after all calls to the stored procedure

    are successful. I want to show the user all the errors that occurred during the stored procedure calls. If for a first example of stored procedure call

    succeeds and a second failure no data has to be stored in a database.

    How to prevent the stored procedure for insert lines until I call the method commit of ApplicationModule?

    Thanks in advance.

    No, other users only see the lines until you commit. The search term is the transaction isolation level. Tom Kite write a paper on this here ask Tom: on transaction isolation levels. This article gives some samples, according to theory, and you should read it.

    Timo

  • Calling stored procedure with an input of DATE parameter

    Hello. A question about the Date input parameters when you call a stored procedure.

    I have a procedure that takes a DATE as input parameter. I would DATE this value to include a time element.

    My Application Module method takes an input as a java.util.Date (myParamDate) parameter - that will preserve a time element (?).

    However when I create the CallableStatement, I am trying to set the parameter using setDate like this (for the param 5):
                st = getDBTransaction().createCallableStatement("begin cs_my_pck.request_values(?,?,?,?,?,?,?,?); end;", 0);            
                Connection myConn = st.getConnection();
                ArrayDescriptor myArrDesc  =  ArrayDescriptor.createDescriptor("CS_FIELD_TABT", myConn);
                Array sqlParamNameArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramNames.toArray());
                Array sqlParamValueArray = new oracle.sql.ARRAY(myArrDesc, myConn, paramValues.toArray());
                Array sqlFilterNameArray = new oracle.sql.ARRAY(myArrDesc,myConn,filterNames.toArray());
                    
                st.setString(1, repType);
                st.setObject(2, sqlParamNameArray);
                st.setObject(3,sqlParamValueArray);
                st.setObject(4,sqlFilterNameArray);
    
                java.sql.Date myRepDate = new java.sql.Date(myParamDate.getTime());
    
                st.setDate(5,myRepDate);
                
                System.out.println("Report Date = " + myRepDate.toString());
                st.setString(6,repUser);
                st.setString(7,repAttach);
                // set out param
                st.registerOutParameter(8, Types.NUMERIC);
                st.execute();
    I understand java.sql.Date does NOT include a time element. But setDate() only accepts a java.sql.Date so my parameter of the procedure ends with a zero time element.

    How to call this procedure keeping the time element?

    Thank you.

    It includes the time element, if you want more precision with time stamp.

    http://docs.Oracle.com/javase/6/docs/API/Java/SQL/date.html

  • Call a procedure and a function over a db link

    I feel a few errors with the following and would be very happy in the view of some experts here.

    My use case is to insert records into a table via a database link. Inserted records will be interviewed for a same table in the local data dictionary. Everything works, but sometimes, I get a unique constraint violation if I'm trying to insert a duplicate record, so I wrote a simple function to check for the scenario. My problem is that I can run my procedure using the link to the db and I can run my function using the db link, but I can't use the two together without errors.

    My test scenario uses only the standard emp table:

    create or replace procedure test_insert(p_instance varchar2)
    IS
    l_sql varchar2(4000);
    begin
        l_sql := 'insert into EMP@'||p_instance||' (EMPNO, ENAME, JOB, MGR, SAL, DEPTNO) (Select EMPNO, ENAME, JOB, MGR, SAL, DEPTNO from EMP)';
    execute immediate l_sql;
    END;
    
    

    BEGIN
    test_insert('myLink');
    END;
    
    

    It works very well and the insert occurs without any problem.

    If I run the same process a second time, I get:

    00001 00000 - "forced single (s.%s) violated" which is what I've been waiting for EMPNO has a unique constraint. So far so good.

    Now, I create a function to check if the record exists:

    create or replace function record_exists(p_empno IN NUMBER, p_instance IN varchar2) return number
    IS
    l_sql varchar2(4000);
    l_count number;
    BEGIN
    l_sql := 'select count(*) from EMP@'||p_instance||' where empno = '||p_empno;
    execute immediate l_sql into l_count;
    IF
    l_count > 0
    THEN return 1;
    ELSE
    return 0;
    END IF;
    END;
    
    

    I test this situation as follows:

    select record_exists(8020, 'myLink') from dual;
    
    

    RECORD_EXISTS(8020,'myLink')

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

    1

    That works well, so now I'll add this feature to my procedure:

    create or replace procedure test_insert(p_instance varchar2)
    IS
    l_sql varchar2(4000);
    begin
        l_sql := 'insert into EMP@'||p_instance||' (EMPNO, ENAME, JOB, MGR, SAL, DEPTNO) (Select EMPNO, ENAME, JOB, MGR, SAL, DEPTNO from EMP WHERE record_exists( EMPNO, '''||p_instance||''') = 0)';
    execute immediate l_sql;
    END;
    
    

    I test this situation as follows:

    BEGIN
    test_insert('myLink');
    END;
    
    

    As a result:

    Error report:
    ORA-02069: global_names parameter must be set to TRUE for this operation
    ORA-06512: at "FUSION.TEST_INSERT", line 6
    ORA-06512: at line 2
    02069. 00000 -  "global_names parameter must be set to TRUE for this operation"
    *Cause:    A remote mapping of the statement is required but cannot be achieved
               because global_names should be set to TRUE for it to be achieved
    *Action:   Issue alter session set global_names = true if possible
    
    

    I don't know why I'm getting this. The function works, the works of the procedure, but when I combine I get an error. If I set the global setting to true names and then run again I get:

    
    02085. 00000 -  "database link %s connects to %s"
    *Cause:    a database link connected to a database with a different name.
               The connection is rejected.
    *Action:   create a database link with the same name as the database it
               connects to, or set global_names=false.
    
    

    All opinions are appreciated. I do not understand why I can run the procedure and function of each separately on the db connection, but they don't work together.

    Thank you

    John

    The procedure depends on what how would you define failure and it should mean - error to the caller, sign and continue, just continue. Constraints are created to ensure if it receives no invalid data in a table. Generally, they provide the most effective mechanism for the verification of the invalid data and return useful exceptions that can deal with the appellant. You also double the workload of the checking uniqueness by adding your own control.

    In general I would say use Exceptions, they are your friend

Maybe you are looking for

  • pre-installed applications on apple tv3

    What applications are pre-installed on apple tv 3rd generation?

  • mSATA SSD as cache

    Hi, guys. I'm debating getting a mSATA SSD. Is it possible to to use as a cache for the hard drive, rather than as a boot device, a concept similar to Intel's SRT? What software does take?

  • E3000 Problem Internet Radio Station

    I had a W120N wireless router, which has received all the stations internet radio without any problem I just bought an E3000 and she seems not to cross the 2 special internet stations that worked well on the 120N What configuration settings affect in

  • Cannot burn songs to an audio CD / music

    I used to be able to burn audio CDs / music without any problem, but lately, only 1 or 2 songs get burned on the CD when the album has 9 songs and all parents are 9 songs in my music library.  I use blank discs new CD - R and CD - RW recommended for

  • How to remove BlackBerry Smartphones company BB 9780 settings

    Please help me remove bb 9780 company settings to remove.