Executing A Procedure In a Package Using DBLink

I need to execute a procedure which is residing in a package using dblink.
The package got a execute PUBLIC grant.
When I execute the following statement, I am getting error ORA: 00904, Invalid Identifier
select PKG_NAME.PROCEDURE_NAME@dblink(null,null,null,null,null,null,null,null,null,null,null) from dual
How can I execute the above statement.
Thanks in advance

I have a database INLABNEW in that i have done this
SQL> create table temp(no number)
  2  /
Table created.
SQL> create or replace package pkg
  2  as
  3     procedure p;
  4  end;
  5  /
Package created.
SQL>  create or replace package body pkg
  2   as
  3      procedure p
  4      is
  5      begin
  6             insert into temp values(1);
  7      end;
  8   end;
  9  /
Package body created.
SQL> select * from temp
  2  /
no rows selectedNow i executed the procedure pkg.p from another database
SQL> exec pkg.p@to_inlabnew
PL/SQL procedure successfully completed.
SQL> commit
  2  /And i query the table tmp in INLABNEW
SQL> select * from temp
  2  /
        NO
         1Now question is have you given your procedure name properly.
as your procedure is in a package it should be Your_package_name.Your_procedure_name@Your_db_link

Similar Messages

  • Execute procedure in a package using the caller privileges?

    Is it possible to execute a procedure within a package using the privileges of the caller rather than the privileges of the package owner? So if we have a procedure that does a select, one that does an insert, and another for update and a 4th for delete, then we just want to grant execute to user X on the select procedure in the package. This is a developer request. I think I just need to tell the requestor to copy or move the procedure out of the package and into it's own procedure so that it's safe to run by user X and not grant execute on the package since I don't believe it is possible to specify what procedures in a package are granted execute since that command is a blanket for the whole package right?
    Example - fails due to specifying the proc:
    grant execute on scmemaname.pkgname.procname to usr;
    There's no other command to do that is there?
    Thanks,
    Dave
    Edited by: Gib on Jan 19, 2010 8:42 AM

    AUTHID is at the package level ... not the individual function or procedure.
    Create a second package.

  • How to execute private procedures in a package

    Hi
    I have created private procedures in a package.
    now i want to execute the private procedure. how to execute the private one

    Hi;
    Pelase see below which could be helpful for your issue:
    Private procedures in a package
    http://stackoverflow.com/questions/924490/how-do-i-execute-private-procedures-in-an-oracle-package
    Regard
    Helios

  • Execute all procedures in a package

    Pls tell me how to execute all the functions and procedures in a Package in a single shot or is there any coding for the same
    Please help me
    Thanks in advance

    You would need to have a procedure or function in the package that ran all of the others. Given a package like:
    CREATE PACKAGE p AS
       FUNCTION f1 RETURN NUMBER;
       FUNCTION f2 RETURN NUMBER;
       PROCEDURE p1;
       PROCEDURE p2;
       PROCEDURE RUN_ALL;
    END;
    CREATE PACKAGE BODY p AS
    FUNCTION f1 RETURN NUMBER IS
    BEGIN
       RETURN 1;
    END; -- f1
    FUNCTION f2 RETURN NUMBER IS
    BEGIN
       RETURN 2;
    END; -- f2
    PROCEDURE p1 IS
    BEGIN
       NULL;
    END; -- p1
    PROCEDURE p2 IS
    BEGIN
       NULL;
    END; -- p2
    PROCEDURE RUN_ALL IS
       l_f1 NUMBER;
       l_f2 NUMBER;
    BEGIN
       l_f1 := f1();
       l_f2 := f2();
       p1;
       p2;
    END; -- run_all
    END; -- package bodyThen you would run all the procedures and functions by calling
    p.run_all;If you will never wnat to run the other procedures and function individually, then you could define the package spec as:
    CREATE PACKAGE p AS
       PROCEDURE RUN_ALL;
    END;HTH
    John

  • Procedure to execute other procedures in a package

    I have written the following package:
    CREATE
    OR REPLACE PACKAGE NCI_LOAD_PKG AS
    PROCEDURE LOAD_W;
    PROCEDURE LOAD_X;
    PROCEDURE LOAD_Y;
    PROCEDURE LOAD_Z;
    END NCI_LOAD_PKG;
    I want to know what is the best way to call these procedures. Do I need to wirte a Unix script for this or just a pls procedure in the package itself. Also keeping in consideration that this package needs to run every night. I am not sure what I need to do. If anyone can give me some direction it will be very helpful.
    Thanks.
    Message was edited by:
    rap1108
    Message was edited by:
    rap1108

    You can call a packaged procedure from PL/SQL just by prefixing the package name, i.e.
    BEGIN
      <<package name>>.<<procedure name>>( <<argument list>> );
    END;If you create a procedure in the package, though, you can call other procedures in the same package without qualifying the procedure name with the package name.
    Justin

  • Result of Executing a Procedure in a Package to check if a file exists

    Hi,
    I have a procedure where i want to check if a name exists in my Oracle Table , for exemple , select name from my_files_processed , if the statement give a result , escape a step and go back to the previous step in the package , if the file doesn't exist in my table go to the next step in my package.
    Any issue on how to do this ??
    Best Regards

    First remove the horrible exception handler(s) which are hiding all errors;
    ie the
    when others
    then
    null;
    end;Then remember the main syntax is
    begin
    packagename.procedurename;
    end;
    /But also remember that procedure name must be declared in the package header if you want to call it. (This is called a public procedure). A private procedure does not have to be declared in the package header and can only be called from within the same package body.
    I always use sqlplus for verification as that is delivered with oracle. You know if it works with sqlplus it will work with any othere client and if it does not, it's usually a client issue.
    from what you have posted, There is nothing obvious as to why it won't work.

  • Execute stored procedure before editing = Problem using DataTemplate

    Héllo,
    I'm working on a Publisher Report, in which I need to perform a pre treatment before editing the report.
    The report is based on a data model "SQL Query", like this :
    "select my_package.myfunction(:par01, :par02)
    from system.dual;"
    The function returns a cursor, with all the data I need to build the report. The first thing I tried is to add to this function the pre-treatment, which insert in several tables rows used by the function.
    But I've got the error "ORA-14551: cannot perform a DML operation inside a query".
    Is there a different way to do what I want ?
    Thanks for your answers.
    Edited by: jbg on 15 déc. 2010 07:10

    By searching on blogs, I found the data template solution. I created the following template :
    <dataTemplate name="dtWeekly" dataSourceRef="ORCL2" defaultpackage="pk_btx_spe_weekly">
    <dataQuery>
    <sqlStatement name="Q1">
    select libelle libelle from super.tmp_trace_pub
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="beforeReport" source="pk_btx_spe_weekly.pre_traitement()"/>
    <dataStructure>
    <group name="G_TEST" source="Q1">
    <element name="libelle" value="libelle"/>
    </group>
    </dataStructure>     
    </dataTemplate>
    the function pre_traitement() simply inserts a row in the "tmp_trace_pub" (I tested it directly in SQL*Plus, without any problem. I've got no errors, but the trigger doesn't seem to execute, and the XML generated is empty :
    <?xml version="1.0" encoding="UTF-8" ?>
    - <DTWEEKLY>
    <LIST_G_TEST />
    </DTWEEKLY>
    Did I do something wrong ?
    Thanks,

  • Error while executing a procedure in Package

    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package "PLLODS.LK" has been invalidated
    ORA-04065: not executed, altered or dropped package "PLLODS.LK"
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at line 1Why did this error arise when I changed a package and recompiled?

    This errors occurs when a package was executed in session A, compiled in session B, and then executed again in session A. The package executed in session A is in Oracle buffer, but its definition was changed in session B (which session A is unaware of). Now session A uses the old definition of the package but Oracle checks what is in buffer to the new definition and finds a difference. Therefore, it generates an error:
    ORA-04068: existing state of packages has been discarded
    and other related errors.
    Just execute the procedure (in the package) again and you should not see the error again.
    Make sure the stae of the package is valid, that is, when it was recompiled, the package compiled successfully.
    Shakti
    http://www.impact-sol.com
    Developers of Guggi Oracle - Tool for Developers and DBAs

  • Executing a procedure in package

    Hi,
    How to execute a procedure in a package? Below is the package
    CREATE OR REPLACE PACKAGE BODY POPULATE_GLTD_TABLES
    IS
    -- LOCAL VARIABLES
    val1 VARCHAR2(10);
    -- Create some job objects:
    v_job1_str VARCHAR2(4000) ;
    v_job1 XXMCK.XXMCK_JOB_OT;
    PROCEDURE populate_gltd_tabs1
    IS
    BEGIN
    dbms_output.put_line('Get_status=> v_job1: ');
    val1:= F_CHECK_GLTD_RECORD_EXISTS('MCK_GLTD_1');
    IF val1 != 'S' THEN
    -- Include message details value - TRUE if yes and FALSE if no
    xxmck.mck_write_log_msg.set_msg_tail(TRUE);
    xxmck.mck_write_log_msg.purge('GLTD-TASK1');
    -- set context will define the source as well as inserts data into cont exit table
    xxmck.mck_write_log_msg.set_context(v_parent_program,v_prog_desc,'GLTD-TASK1');
    xxmck.mck_write_log_msg.log(v_parent_program,'Entering in LOAD_GLTD_TABLES.populate_gltd_tabs1 ','prg','GLTD-TASK1',1);
    xxmck.mck_write_log_msg.log_tail(v_parent_program,'Entering in LOAD_GLTD_TABLES.populate_gltd_tabs1 ','prg','GLTD-TASK1');
    v_job1_str := 'XXCOGNOS.LOAD_GLTD_TABLES.populate_gltd_tabs1;';
    v_job1 := NEW XXMCK.XXMCK_JOB_OT('GLTD-TASK1', v_job1_str, 'Background job test: LOAD_GLTD_TABLES.populate_gltd_tabs1', INTERVAL '60' SECOND);
    v_job1.PRINT(); -- Display basic info about the job
    v_job1.SUBMIT(); -- Submit in background
    v_job1.WAIT();
    v_job1.PRINT();
    v_job1.get_status(v_code, v_message);
    dbms_output.put_line('Get_status=> v_job1: ' || v_code || ':' || v_message);
    -- SELECT DECODE(cont_exit, 'cont', 'cont', 'err', 'err', 'cont') INTO v_result from MCK_LOG_CONT_EXIT_CHK WHERE source = 'GLTD-TASK1';
    --IF v_result = 'err' THEN
    -- raise_application_error(-20000,'Program Aborted');
    --END IF;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN NULL;
    END populate_gltd_tabs1;
    PROCEDURE mainproc
    IS
    BEGIN
    populate_gltd_tabs1; -- CALL TO POPULATE mck_gltd_1 TABLE
    -- Mailing
    xxmck.mck_write_log_msg.send_mail( p_source_prg => v_parent_program
    ,p_source => 'GLTD-TASK1'
    ,p_msg_type => 'prg'
    ,p_from => '[email protected]'
    ,p_to => '[email protected]'
    ,p_server => 'mailhub.mckinsey.com'
    EXCEPTION
    WHEN OTHERS THEN NULL;
    END mainproc;
    END POPULATE_GLTD_TABLES;
    And below is my anonymous block to execute above package
    BEGIN
    POPULATE_MCK_GLTDFILE.mainproc;
    EXCEPTION -- exception handler begin
    WHEN OTHERS THEN NULL;
    END;
    I am trying to run above code in toad. But i am getting error as: identifier 'POPULATE_MCK_GLTDFILE.mainproc' must be declared.
    There are no parameters to be passed.
    The package is compiled successfully.
    I think this must be simplest question any one can I ask, but I cant figure out the solution.
    Please help,
    Aditya

    First remove the horrible exception handler(s) which are hiding all errors;
    ie the
    when others
    then
    null;
    end;Then remember the main syntax is
    begin
    packagename.procedurename;
    end;
    /But also remember that procedure name must be declared in the package header if you want to call it. (This is called a public procedure). A private procedure does not have to be declared in the package header and can only be called from within the same package body.
    I always use sqlplus for verification as that is delivered with oracle. You know if it works with sqlplus it will work with any othere client and if it does not, it's usually a client issue.
    from what you have posted, There is nothing obvious as to why it won't work.

  • Use OCIDescribeAny to describe Procedure in a package?

    I used the following code retrieve the parameter information for
    procedures:
    OCIDescribeAny(svchp, errhp, objptr, objp_len, OCI_OTYPE_NAME,0,
              OCI_PTYPE_PROC, deschp);
    if (OCIAttrGet(deschp, OCI_HTYPE_DESCRIBE, &parmh, 0,
    OCI_ATTR_PARAM, errhp))
              return ;
         if (OCIAttrGet(parmh, OCI_DTYPE_PARAM, &arglst, 0,
    OCI_ATTR_LIST_ARGUMENTS, errhp))
              return ;
         if (OCIAttrGet(arglst,OCI_DTYPE_PARAM, &numargs, 0,
    OCI_ATTR_NUM_PARAMS, errhp))
              return ;
    If I pass a procedure which exists in a package, I will get a
    object does not exist error. How can I describe a procedure in a
    package using OCIDescribeAny ? Thanks.

    I tested it in the SQL Worksheet (rather than the PL/SQL editor), but I see the same behaviour as you when I try with your example in the PL/SQL editor. A little testing suggests that the problem is that the completion insight doesn't understand the context of where it is in the PL/SQL and so doesn't know what options to list.
    If I try adding the end for the new procedure and then going back to after the "(":procedure Proc_test_call
    is
    begin
    pkg_test2.proc_test2(
    end proc_test_call;I just get begin and declare as options - ie completion insight thinks I am no longer in scope of the package (as other package components not listed) and starting a new block.
    If I try adding an assignment before the procedure call (not logical, I know, but I had been testing with a function in my schema):procedure Proc_test_call
    is
    begin
      result := pkg_test2.proc_test2(I get what we should (parameters for proc_test2 and local scope items).
    Your workaround of adding the closing backet for the procedure call helps the completion insight understand the context of where it is and so it can give the right options.
    I have previously avoided parameter completion insight as earlier versions had big performance problems when connected to a schema with a large number of PL/SQL objects (our main schema has 5.5 million records in all_arguments), but the performance has certainly been fixed. However, the PL/SQL editor still seems pretty hit and miss as to whether the parameter completion insight works, which seems largely to be because it doesn't always the context of where it is in the PL/SQL.
    theFurryOne

  • ORA-01722 when executing a procedure

    I am executing a procedure in a package thru a nightly database job. This job has been working fine for the last several months. However recently it started abending with a ORA-01722 error. No changes have been made to the code. The procedure code follows:
    PROCEDURE p_start_batch_merge_sites IS
    p_batch_site_id tf_batch_merge_sites.master_site_id%TYPE;
    p_batch_sub_site_id tf_batch_merge_sites.subordinate_site_id%TYPE;
    p_batch_sub_site_name tf_batch_merge_sites.subordinate_site_name%TYPE;
    v_error number;
    CURSOR batch_merge_sites_cur is
    Select master_site_id, subordinate_site_id, subordinate_site_name
    from tf_batch_merge_sites
    where merge_Date_time is null;
    BEGIN
    OPEN batch_merge_sites_cur;
    LOOP
    FETCH batch_merge_sites_cur into
    p_batch_site_id, p_batch_sub_site_id, p_batch_sub_site_name;
    EXIT WHEN batch_merge_sites_cur%NOTFOUND;
    pkg_tf_merge_sites.p_merge_sites(p_batch_site_id, p_batch_sub_site_id);
    select sql_err_no into v_error
    from tf_merge_log
    where id = (select max(id) from tf_merge_log);
    IF v_error <>0 then
    close batch_merge_sites_cur;
    update tf_batch_merge_sites
    set error_message_text = 'Error in Batch Merge'
    where master_site_id = p_batch_site_id
    and subordinate_site_id = p_batch_sub_site_id;
    ELSE
    update tf_batch_merge_sites
    set error_message_text = 'Batch Merge Sites Successfully Completed',
    merge_date_time = sysdate
    where master_site_id = p_batch_site_id
    and subordinate_site_id = p_batch_sub_site_id;
    pkg_tf_merge_sites.p_delete_subordinate (p_batch_site_id, p_batch_sub_site_id, p_batch_sub_site_name);
    END IF;
    END LOOP;
    CLOSE batch_merge_sites_cur;
    END;
    One call in this procedure passing 2 number fields works ok:
    pkg_tf_merge_sites.p_merge_sites(p_batch_site_id, p_batch_sub_site_id);
    The call that is abending is passing the same 2 number fields as the above call, plus a varchar2 name field.
    pkg_tf_merge_sites.p_delete_subordinate (p_batch_site_id, p_batch_sub_site_id, p_batch_sub_site_name);
    The table structure for the tf_batch_merge_sites is as follows:
    SQL> desc tf_batch_merge_sites
    Name Null? Type
    MASTER_SITE_ID NOT NULL NUMBER(12)
    MASTER_SITE_NAME NOT NULL VARCHAR2(60)
    SUBORDINATE_SITE_ID NOT NULL NUMBER(12)
    SUBORDINATE_SITE_NAME NOT NULL VARCHAR2(60)
    MERGE_DATE_TIME DATE
    ERROR_MESSAGE_TEXT VARCHAR2(100)
    REVISION_USER_NAME NOT NULL VARCHAR2(30)
    REVISION_DATE_TIME NOT NULL DATE
    p_delete_subordinate procedure:
    PROCEDURE p_delete_subordinate(
    p_site_id IN NUMBER,
    p_subordinate_site_id IN NUMBER,
    p_site_name IN VARCHAR2
    IS
    -- PROCEDURE: p_delete_subordinate
    -- NOTES: Deletes the subordinate site after merging with the master site.
    -- HISTORY:
    -- 05-01-2003 BSS Created.
    v_batchid NUMBER;
    CURSOR subordinate_site_cur(
    p_subordinate_site_id NUMBER
    IS
    SELECT rid
    FROM se_i_entities
    WHERE id = p_subordinate_site_id
    AND entity_type = 'SITE';
    BEGIN
    BEGIN
    INSERT INTO tf_merge_sites
    (site_id,
    merged_site_id,
    merged_site_name
    VALUES (p_site_id,
    p_subordinate_site_id,
    p_site_name
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END;
    DELETE FROM tf_site_aliases
    WHERE primary_site_id = p_subordinate_site_id;
    -- OR secondary_site_id = p_subordinate_site_id;
    DELETE FROM tf_former_site_names
    WHERE site_id = p_subordinate_site_id;
    FOR k IN subordinate_site_cur(p_subordinate_site_id)
    LOOP
    DELETE FROM se_i_entity_relationships
    WHERE entity_rid_2 = k.rid
    AND entity_type_2 = 'SITE';
    END LOOP;
    DELETE FROM se_i_entities
    WHERE id = p_subordinate_site_id
    AND entity_type = 'SITE';
    DELETE FROM tf_sites
    WHERE site_id = p_subordinate_site_id;
    DELETE FROM e_masters
    WHERE id = p_subordinate_site_id;
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END;
    I've looked at the data and it looks fine. Does anyone have any idea why I would get this message after it has been running fine for several months?
    Thanks!!
    Shellie Bricker

    ORA-01722: invalid number
    Cause: The attempted conversion of a character string to a number failed because the character string was not a valid numeric literal. Only numeric fields or character fields containing numeric data may be used in arithmetic functions or expressions. Only numeric fields may be added to or subtracted from dates.
    Action: Check the character strings in the function or expression. Check that they contain only numbers, a sign, a decimal point, and the character "E" or "e" and retry the operation.
    Maybe you have bad data?

  • Can you tell me how to execute the procedure?

    create or replace get_dob
    (ss_number varchar2,dob out date)
    as
    begin
    select birth_dae
    into dob
    from person
    where soc_sec_num=ss_num;
    exception when no_data_found
    error_notify(ss_num);
    end;
    the question is that when i want to execute this procedure,how can I use the command?
    I try to use the "execute get_dob('wang');"in the sql/plus,but the system give me wrong information.

    Errors:
    1. You left out the word PROCEDURE after CREATE OR REPLACE.
    2. You used ss_number in one place and ss_num in two others. These must be the same name.
    3. You left out the word THEN after WHEN NO_DATA_FOUND.
    Possible errors:
    1. Is birth_dae spelled correctly? Or, should it be birth_date?
    2. Is error_notify a user-defined procedure?
    Additional suggestions:
    1. It is better to use table_name.column_name%TYPE instead of specifying NUMBER, VARCHAR2, DATE, etc. for your parameters. That way if the column data types are changed in the future, you don't have to change your code.
    2. You will need to SET SERVEROUTPUT ON and use DBMS_OUTPUT.PUT_LINE to display the contents of the variable that holds the value of the out parameter.
    3. Please see suggested code for creation of procedure and execution of procedure below. I have included one row of test data so that some output will be displayed. I commented out the exception section, in order to test it, since I don't have your error_notify procedure.
    SQL> -- test data:
    SQL> CREATE TABLE person
      2    (birth_dae   DATE,
      3     soc_sec_num NUMBER)
      4  /
    Table created.
    SQL> INSERT INTO person
      2  VALUES (SYSDATE, '123456789')
      3  /
    1 row created.
    SQL> SELECT * FROM person
      2  /
    BIRTH_DAE SOC_SEC_NUM
    06-DEC-02   123456789
    SQL>
    SQL>
    SQL> -- create procedure:
    SQL> CREATE OR REPLACE PROCEDURE get_dob
      2    (ss_number IN  person.soc_sec_num%TYPE,
      3     dob       OUT person.birth_dae%TYPE)
      4  AS
      5  BEGIN
      6    SELECT birth_dae
      7    INTO      dob
      8    FROM      person
      9    WHERE  soc_sec_num = ss_number;
    10  -- EXCEPTION
    11  --  WHEN NO_DATA_FOUND THEN
    12  --    error_notify (ss_number);
    13  END get_dob;
    14  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL>
    SQL>
    SQL> -- execute procedure:
    SQL> SET SERVEROUTPUT ON
    SQL> DECLARE
      2    v_dob DATE;
      3  BEGIN
      4    get_dob ('123456789', v_dob);
      5    DBMS_OUTPUT.PUT_LINE (v_dob);
      6  END;
      7  /
    06-DEC-02
    PL/SQL procedure successfully completed.

  • Execute concatenated procedure

    Hello,
    How can I execute a procedure from a package in another procedure in that package when I combined the name of this procedure from a table.
    I have a table containing procedure names and parameters that go with it.
    With a cursor in another procedure I want to combine this together and execute that combined procedure.
    Here is some code to clarify
    CURSOR c_sel IS
         SELECT ids,proc_nm,period_1,period_2,period_3,period_4
         FROM fep_adm_prcs
         WHERE select_bl ='Y';
    CURSOR c_trunc(p_procids IN NUMBER) IS
         SELECT tab_name
         FROM FEP_ADM_TABS
         WHERE PROC_IDS = p_procids;
    period1_t VARCHAR2(10);
    period2_t VARCHAR2(10);
    period3_t VARCHAR2(10);
    period4_t VARCHAR2(10);
    BEGIN
    -- Start looping all procedures named in the collection
         FOR r_sel IN c_sel LOOP
         -- Fisrt truncate every table related to the selected procedure before start of load new data
              FOR r_trunc IN c_trunc(r_sel.ids) LOOP
              DBMS_OUTPUT.PUT_LINE('TRUNCATE TABLE '||r_trunc.tab_name);
              EXECUTE IMMEDIATE ('TRUNCATE TABLE '||r_trunc.tab_name);
              END LOOP;
         -- Second loop through the 4 periods and generate execution script when period is not null
              IF r_sel.period_1 IS NOT NULL THEN
                   DBMS_OUTPUT.PUT_LINE('execute fep_compute_tables.'||r_sel.proc_nm||'('''||r_sel.period_1||''')');
                   --EXECUTE IMMEDIATE('execute FEP_COMPUTE_TABLES.'||r_sel.proc_nm||'('''||r_sel.period_1||''')');
                   FEP_COMPUTE_TABLES.r_sel.proc_nm(r_sel.period_1);
              END IF;
    This last one is not working, but how can I get it to work?
    Thanks a lot

    this is the error I get
    ORA-00900 invalid SQL statement
    Cause: The statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed.
    Action: Correct the syntax or install the Procedural Option.

  • How to Execute Remote procedures that use DBLinks?

    Using Oracle 10g (RAC Linux) to remote connect Windows 10g to dblink to AS/400 <
    <I have created a procedure that I execute remotely by issuing the following:
    CALL GLOBAL.REFRESH_STAGING@KRONOSLINK();
    The procedure errors as
    Error at line 2
    ORA-20001: ERROR OCCURED
    ORA-06512: at "GLOBAL.REFRESH_STAGING", line 47
    ORA-06512: at line 1
    The procedure runs without error from the host database. The problem is when the procedure makes a call to the dblink.
    I unsuccessfully attempted to capture the error message.
    Question: Is it possible to execute remote procedures that use dblinks? If so, How is that accomplished.
    Question: What is the proper way to handle exceptions in this case?
    Bonus: What can be done to improve this procedure? (Suggestions, like adding return on the procedure).
    CREATE OR REPLACE PROCEDURE GLOBAL.REFRESH_STAGING IS
    NOOBJECT EXCEPTION;
    OBJECTEXIST EXCEPTION;
    PRAGMA EXCEPTION_INIT(NOOBJECT, -00942); -- Exception handling for ORA-00942 - table or view does not exist
    PRAGMA EXCEPTION_INIT(OBJECTEXIST, -00955); -- Exception handling for ORA-009555 - name is already used by an existing object
    sT LONG := '';
    sS LONG := '';
    sST LONG := '';
    cursor csrO is
    SELECT
    SCHEMANAME,
    TABLENAME
    FROM GLOBAL.STAGING_TABLES;
    csrR csrO%ROWTYPE;
    BEGIN
    FOR csrR IN csrO
    LOOP
    sT := csrR.TABLENAME;
    sS := csrR.SCHEMANAME;
    sST := sS || '.' || sT;
    BEGIN
    EXECUTE IMMEDIATE 'drop table global.' || sT || ' purge';
    EXCEPTION
    WHEN NOOBJECT THEN
    NULL;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
    RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
    END;
    BEGIN
    EXECUTE IMMEDIATE 'create table global.' || sT || ' nologging as select * from ' || sST || '@thebosslink';
    COMMIT;
    EXCEPTION
    WHEN OBJECTEXIST THEN
    NULL;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_CALL_STACK);
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.FORMAT_ERROR_STACK);
    DBMS_OUTPUT.PUT_LINE(SQLCODE || ' - ' || SQLERRM);
    RAISE_APPLICATION_ERROR (-20001, 'ERROR OCCURED');
    END;
    END LOOP;
    END REFRESH_STAGING;
    Thanks,
    blevels

    SET LINESIZE 500;
    COLUMN DB_LINK FORMAT a20
    COLUMN HOST FORMAT a20
    COLUMN USERNAME FORMAT a20
    COLUMN OWNER FORMAT a10
    COLUMN TABLE_NAME FORMAT a20
    select db_link,username, host from all_db_links where db_link = 'KRONOSLINK';
    select privilege from dba_sys_privs where grantee = 'SYSTEM';
    select owner, table_name from dba_tab_privs where grantee='SYSTEM';
    DBLINK_ USERNAME HOST
    KRONOSLINK SYSTEM ORCL
    1 row selected.
    PRIVILEGE
    GLOBAL QUERY REWRITE
    CREATE MATERIALIZED VIEW
    CREATE TABLE
    UNLIMITED TABLESPACE
    SELECT ANY TABLE
    5 rows selected.
    OWNER TABLENAME_
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCEXP
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCVID
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS INCFIL
    SYS DBMS_ALERT
    SYS DBMS_SYS_ERROR
    SYS DBMS_RULE_EXIMP
    SYS DBMS_AQ
    SYS DBMS_AQADM
    SYS DBMS_AQ_IMPORT_INTER
    NAL
    SYS DBMS_AQELM
    SYS DBMS_TRANSFORM_EXIMP
    SYS SYS_GROUP
    SYS DBMS_DEFER_IMPORT_IN
    TERNAL
    SYS DBMS_REPCAT
    WMSYS WM$UDTRIG_INFO
    SYS SET_TABLESPACE
    SYS CHECK_UPGRADE
    SYS AVINASH
    SYS AVINASH
    SYS AVINASH1
    SYS AVINASH1
    SYS DB_PMP
    SYS DB_PMP
    SYS DIR_TESTCASE
    SYS DIR_TESTCASE
    SYS EXPORT_FULL_DIR
    SYS EXPORT_FULL_DIR
    SYS PUMP
    SYS PUMP
    SYS LOGS
    SYS LOGS
    SYS DPUMP_DIR2
    SYS DPUMP_DIR2
    SYS AVIS
    SYS AVIS
    SYS DPDIR_LCLLGS
    SYS DPDIR_LCLLGS
    67 rows selected.
    Edited by: user10860953 on Jan 28, 2010 10:43 AM

  • Strange problem in executing procedure using dblink

    I have this strange problem coming in the execution of a procedure accessed using dblink. I will try to explain the scenario. We have one procedure in our schema which is executed using a dblink from another database as we have a integration of systems. This was working fine but after we did a fresh export and import of this schema as we migrated our database to a new better configuration DB server, the execution of this procedure is hanging when it is executed from the dblink from the other database. I hope, I have been able to explain the scenario.
    I hope, my question is clear.
    Please, help in solving the doubt.
    regards

    No starting version number.
    No current version number.
    No indication of whether the link is valid and you can SELECT across it.
    No error message of any kind.
    Nothing from your alert log.
    No indication of whether you have a global names issue.
    Please do the research required to identify the nature of the problem, check the related docs at metalink, and if you still have a problem give us the rest of the story.
    Then perhaps we can help you.

Maybe you are looking for

  • MBP screen black after using DVI to HDMI cable

    Over a week ago I attempted to connect my MBP 2007 model to my samsung television with HDMI in. I have used this cable before but always have trouble getting it to work with this TV and my computer. Well, I plugged it in and the screen on my computer

  • How can you block a URL from access?

    This URl (http://reduled.info/3131) keeps coming up as mal in Avast. Can a specific URL be blocked?

  • Close file FileChooser

    Hi. I have a rather interesting problem you guys might have some ideas for: I have a desktop application that maintains a list of open resource files. The user can add or remove (i.e. open or close) any of those resource files at any time. But there

  • What is the datasource for 9.3.1? Does OLEDB supports ODBC

    Plz some one let me know what is the datasource for hyperion 9.3.1 and does OLE DB supports ODBC In hyperion 11 the datasource is through ODBC. thanks

  • Block ttransfer order confirmation for storage types:

    Gurus, IS there any functionality in WM to vlock the transfer order confirmationfor particluar storage type. I know LS06 but that wil not allow to create Transfer order. I need transfer order to be creaed but it should get confirmed.I am not referrri