Accessing a packaged variable through db link

How do I access a packaged variable remotely? (Syntax)

You cannot do that:
SQL> conn xx/xx@xx
Connected.
SQL> create package p is
  2   a number;
  3  end;
  4  /
Package created.
SQL> conn yy/yy@yy
Connected.
SQL> desc p@yy
SQL> set serveroutput on
SQL> create synonym p1 for p@xx;
Synonym created.
SQL> desc p1;
SQL> begin
  2    p1.a := 1;
  3    dbms_output.put_line(p.a);
  4  end;
  5  /
  p1.a := 1;
ERROR at line 2:
ORA-06550: line 2, column 6:
PLS-00512: Implementation Restriction: 'P1.A': Cannot directly access remote package variable or cursor
ORA-06550: line 2, column 3:
PL/SQL: Statement ignoredInstead you should access these variables via functions and/or procedures. In following example I've created the private variable in package p but this doesn't matter whether it is private or public.
SQL> conn xx/xx@xx
SQL> create or replace package p is
2 procedure set_a (v in number);
3 function get_a return number;
4 end;
5 /
Package created.
SQL> ed
Wrote file afiedt.buf
1 create or replace package body p is
2 a number;
3 procedure set_a (v in number) is
4 begin
5 a := v;
6 end;
7 function get_a return number is
8 begin
9 return a;
10 end;
11* end;
SQL> /
Package body created.
SQL> conn yy/yy@yy
Connected.
SQL> set serveroutput on
SQL> desc p1
FUNCTION GET_A RETURNS NUMBER
PROCEDURE SET_A
Argument Name Type In/Out Default?
V NUMBER IN
SQL> ed
Wrote file afiedt.buf
1 begin
2 p1.set_a(1);
3 dbms_output.put_line(p1.get_a);
4* end;
SQL> /
1
PL/SQL procedure successfully completed.
Gints Plivna
http://www.gplivna.eu

Similar Messages

  • Accessing package variable through DB link

    Hi,
    I have ref cursor variable in remote DB package and want to refer that in another script.
    v_refcur rem_package.generic_cursor_type@REMOTEDB
    and accessing procedure in the remote DB
    I am getting the following error
    ORA-20111: ORA-02064: distributed operation not supported
    ORA-06512: at "user.XXHJ_API", line 1097
    ORA-06512: at line 43
    any help is appreciated..

    Ref Cursors are not supported across databases.
    Explain in more detail as to what you are trying to achieve and someone here can suggest alternatives.

  • Accessing database package variables from Forms

    I have a database package that populates a table of values, i.e.
    type t_route_list is table of rt_route.RTR_ID%type;
    route_list t_route_list
    route_list gets populated by a package function and I want to access route_list in the Form.
    While I can access other package variables by writing a function that returns the variable, Forms doesnt seem to like functions that return a user defined datatype as above. I have also tried using a procedure with an OUT param instead of a function but it also fails with same error.
    i.e.
    declare
    v_route_list pkg_bulk_route_replace.t_route_list;
    begin
    pkg_bulk_route_replace.init;
    pkg_bulk_route_replace.get_route_list(v_route_list);
    message(v_route_list(1));
    end;
    This will not compile, but removing the index (1) from the last line makes it compile but crash with ORA-0600.
    The code above with message replaced with dbms_out.put_line works fine on TOAD.
    So my question is......
    Can my database package return a plsql table to a form and if so, how?!

    Actually I've got this to work now!
    Thde main culprit appears to be a difference in the version of sql or pl/sql used on forms (version 5) and the database (8.1.7).
    I had defined my table as a nested table. By redefining this as a indexed table, simply by adding on 'index by binary_integer' on my server package, I am suddenly able to access the elements of the table on my form. Fortunately this did not break the server code either - the table was populated using bulk collect and that still works.
    Still got a bit of coding to do, but things are looking up now.

  • How to access the LOB objects through database links??????????????

    How to access the LOB objects through database links??????????????

    Hi
    See:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:52297289480186
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5322964030684
    And you also might want to get a new keyboard, your '?' seems to be stucked....

  • After accessing a web site through a link I get the message file not found when trying to access it again.

    This has happened on several sites. I have tried to access the same links through Chrome and do not have a problem there.

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    See also:
    *https://support.mozilla.org/kb/Clear+Recent+History
    Are you using cleanup software like CCleaner or other software that may corrupt the cache?
    You can try to delete the entire cache folder.<br />
    You can find the location of the cache folder on the about:cache page (open via the location bar, like a web page).
    You can check the <b>browser.cache.disk.enable</b> pref on the <b>about:config</b> page to verify that the disk cache is enabled (should be true).

  • Select from dual  into a variable through db links

    HI,I need to select value of current_timestamp in to a variable d1 of a remote database inside function.
    function (db_lnk varchar2)return number
    as
    dbl varchar2(10);
    begin
    dbl:=db_lnk;
    select current_timestamp into d1 from dual@dbl;
    end;
    but getting error table or v iew does not exist.
    if i do
    select current_timestamp into d1 from dual@'||dbl||';
    then it says database link name expected.
    How to achieve this?
    Thanks

    Peter Gjelstrup wrote:
    Foreign languages, foreign languages :-){noformat}*grins*{noformat} I know - and your English is miles better than my Danish (I'm assuming - hopefully correctly?! - that that's your 1st language based on your location!) which I don't even know any words of! *{:-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Passing jsp variable through a link

    hi everybody!!
    can anyone help me? i am in great trouble. Here is my problem description....
    I have one jsp page named a1.jsp in this page i have some checkbox in a form. an html link.
    I select a checkbox and when i click the link then onclick() event of the link execute the javascript function and take the value of the checkbox in a variable.
    I want to take the value to the page a2.jsp when i click the link.
    Please help me!!
    Here is my sample code............
    this is the code of a1.jsp page
    when i click the link named(click the link below i ) i want to go to page a2.jsp by taking the script variable a;
    <script>
    var a=" ";     
    function submitForm()
    a="shakil";
    </script>
    <a href="a2.jsp" onClick="submitForm();">Click the  link</a>_______________________________________________________

    hi,
    a1.jsp
    <script>
    var a=" ";     
    function submitForm()
         a="shakil";
    window.top.location.href ="./a2.jsp?a="+ a;
    </script>
    Click the linka2.jsp
    hello: <%=request.getParameter ( "a" ) %>

  • Calling public package functions and variables through dblink

    Is it possible to call a global public variable in a package in one database from another package procedure in another database using a database link? If so, could you let me know the syntax? Same question for package functions.

    Hi,
    check this documentation link especially the stmt...
    http://www.mcs.csueastbay.edu/support/oracle/doc/10.2/appdev.102/b14251/adfns_packages.htm#i1007858
    You cannot access remote package variables and constants.May be you can write a function in the remote db which when called will return the variable value.
    for calling remote package functions...
    syntax from documentation is [[schema.]package.]function_name[@dblink][(param_1...param_n)]
    an example given in the above link for this...
    EXECUTE fire_emp1@boston_server(1043);
    Ravi Kumar
    Edited by: ravikumar.sv on Aug 31, 2009 11:29 AM

  • Forms 9i accessing package variables

    I created a package in my sql session which contains only variables. When I connect to the database through Oracle Forms and try to access these variables in a trigger I receive the error "Cannot directly access remote package variables or cursor" How can I access these variables from within a forms module?

    You cannot access package variable or constants directly from a remote PL/SQL client. Only PL/SQL running on the server can access these. You need to implement get and set methods in the package.

  • Package Variable accessing...

    Hi all,
    When I try to access a packaged variable from frontend, Its giving a compile-time error :
    Cannot directly access remote package variable or cursor
    Why is it so? Is there any way to directly access them by means of some qualifier, etc.??
    Its working fine when I try to do the same from SQL*Plus session.
    Thanks
    RK Raju

    Package variables cannot be directly accessed from a Form, since it runs on the client, and your package is on the server. Each time your code checked or set a package variable, it would require a network round trip, and it wouldn't take much to ruin your response times.
    The only way is to create a function or procedure in the package that you can call from the Form to set or retrieve the package variable values.

  • Forms 10 and PL/SQL: Using a server package variable

    Hi,
    I have a variable created at package level in the server,
    When I try to assign its value to a Forms item, I get an error.
    "Unable to access distant package variable".
    What should I do to access this variable?
    Many thanks

    Hello,
    Add to the package a procedure to set this variable, and also a function that returns the variable content.
    Francois

  • Package variable

    Can anyone tell me how to access package variables from forms6. When I tried to access, it says 'Implementation Restriction : '|variable name|' : Cannot directly access remote package variable '. Is there any other way to access these variables.
    Thanks in advance,
    Partha

    Anton,
    Thanks for your reply. And this is a very good idea. since I have so many variables to store in the package, I think I need to pass variable name also to the function. I am exploring this feature mainly to replace global variables in forms. could you tell me how best is this idea of replacing global variables in forms with package variables ? and also if you have any sample code using these package variables in forms, could you please send me that.
    Thanks
    Partha
    null

  • Accessing a Global package variable Via Select

    Hi All,
    I want to access a global variable i.e package global variable through a select query. Is this possible or not possible. Please share some inputs on this.
    Thanks

    Just to clarify that you can reference the global variable if your SQL is itself within PLSQL. It will be bound in.
    CREATE OR REPLACE PACKAGE p1
    AS
      my_global NUMBER := 1;
      FUNCTION f_get_my_global
      RETURN NUMBER;
      PROCEDURE p_do_something;
    END;
    CREATE OR REPLACE PACKAGE BODY p1
    AS
      FUNCTION f_get_my_global
      RETURN NUMBER
      AS
      BEGIN
         RETURN my_global;
      END;
      PROCEDURE p_do_something
      AS
        l1 NUMBER;
      BEGIN
        SELECT /*+ find_me */
               my_global
        INTO   l1
        FROM   DUAL;
      END;
    END;
    SQL>  exec p1.p_do_something;
    PL/SQL procedure successfully completed.
    SQL> select sql_text from v$sql where sql_text like '%find_me%';
    SQL_TEXT
    SELECT /*+ find_me */ :B1 FROM DUAL
    SQL>

  • ORA-20001: Unauthorized access (security group package variable not set).

    I'm creating an app that uses APEX authentication and features self-registration (working) and forgot password (not working) forms.
    My forgot password is public (requires no authentication). The user provides username and secret answer, which are validated, then provides the new password. I attempt to use htmldb_util.reset_pw to reset the user's password, but it's not working.
    I have a process on the new password page calling a PL/SQL anonymous block that looks like this (see below), where P16_ITEM1 = username and P18_ITEM1 = new password.
    BEGIN
    apex_040000.htmldb_util.reset_pw( V('P16_ITEM1'), V('P18_ITEM1') );
    END;
    I also don't know how to send accurate success/failure messages from such PL/SQL block back to APEX, but that's a separate issue I guess.
    Anyway, when testing via SQL Developer as the user with APEX_ADMINISTRATOR_ROLE, I get the following error:
    ORA-20001: Unauthorized access (security group package variable not set).
    ORA-06512: at "APEX_040000.WWV_FLOW_FND_USER_API", line 22
    ORA-06512: at "APEX_040000.WWV_FLOW_FND_USER_API", line 1220
    ORA-06512: at "APEX_040000.HTMLDB_UTIL", line 1253
    ORA-06512: at line 8
    I've searched previous threads and tried different suggestions with no luck.
    I'm on Oracle DB XE 11g and APEX 4.x.
    Any help will be appreciated. Thanks,
    Alex.

    Anyway, when testing via SQL Developer as the user with APEX_ADMINISTRATOR_ROLE, I get the following error:
    ORA-20001: Unauthorized access (security group package variable not set).When running code outside Apex that depends on the Apex security group being set, run the following before your own code:
    wwv_flow_api.set_security_group_id(apex_util.find_security_group_id('YOUR_SCHEMA_NAME'));Google "wwv_flow_api.set_security_group_id" for more details, such as this blog post:
    http://www.easyapex.com/index.php?p=502
    - Morten
    http://ora-00001.blogspot.com

  • Accessing function through DB link, giving error.

    Hi All,
    I am using Oracle 10g. I am having a function which is being called in a 'Select' query. And with in the function i have done exception handling, in which in case of exception, i am inserting the records into one table and its is 'pragma automnomous'. So its working fine , when i called this function through the 'Select' query from my own DB. but when i called the function from another DB through DB link, its giving me error stating , DML is not possible in function.
    can you please suggest some other alternatives or hoe to handle this situation?

    930254 wrote:
    Hi All,
    I am using Oracle 10g. I am having a function which is being called in a 'Select' query. And with in the function i have done exception handling, in which in case of exception, i am inserting the records into one table and its is 'pragma automnomous'. So its working fine , when i called this function through the 'Select' query from my own DB. but when i called the function from another DB through DB link, its giving me error stating , DML is not possible in function.
    can you please suggest some other alternatives or hoe to handle this situation?You have tables. We don't.
    You have data. We don't.
    You have code. We don't.
    You have error. We don't.
    You have mystery. We have no clues.
    You're On Your Own (YOYO!)

Maybe you are looking for

  • Please provide link to Oracle 10.2.0.2 installation on HP-UX 11.23

    Hi , I are trying to install Solman 4.0  on Hp-UX 11.23/ Itanium 64 with Oracle 10.2.0.2 as the backend. I am unable to find  any Installtion guide  for Oracle 10.2.0.2 installation at  SAP service market place, however I am able to find UPGRADE Guid

  • HP printers and os 10.9.5

    After the most recent update (Sept 25) of 10.9.5, I'm getting a message "the disk you inserted was not readable by this computer" when connecting by USB printer cable.  Yes, have rebooted, restarted, cleared printers etc.  Now in Printers and Scanner

  • DKU-2 Usb cable connection

    Hi all, Just purchased a DKU-2 usb cable for my Nokia 6230, i installed the pc suite software which came with it and then tried connecting my phone to the pc as the wizard stated, it then froze while attempting to connect the phone to the pc. I then

  • Orange uk will not provide a micro sim replacement

    As the title says, if you are still in contract and not eligible for an upgrade yet but were thinking of getting the iPhone 4 on pay as you go and swapping out your normal size contract sim for a micro one orange will not allow it, they said if you b

  • New G/L was linked in OBYC for direct posting..

    Dear All, My client requirement was tools and spares should be posted directly in consumption(No stock) so i created new a/c assignment category in which G/L Account and cost center kept as hidden fields and in OBYC, linked the reqd G/L in GBB-VBR ke