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.

Similar Messages

  • Accessing Package variables

    Hi friends..
    I have to access the value of a variable which is declared public in the package in a select statement
    i tried this way
    select package_name.variable_name from dual; which is not working.
    I had a alternate solution..Declare a function in the package to make the value return by a function and access the function in the select statement.
    Is this approach correct or do i have any other alternatives?
    Thanks,
    Dwarak.k

    The reason that this does not work is that the SQL Engine cannot simply read a value residing in the package state in the PL/SQL Engine. SQL has no means to access (read or write) that value - only the PL/SQL Engine has.
    The SQL engine can however call PL/SQL functions - and such a function running in PL/SQL can access whatever it likes within the PL/SQL context.
    Is this a good idea, using package state for static variables from a SQL perspective?
    My initial reaction is that it's not a good idea. Primarily because the majority of database clients today are stateless clients - even within the J2EE context.
    For example, your Java Application Server creates a pool of 10 connections to Oracle. User John connects and is serviced by pool process 5. A PL/SQL state variable is set in that Oracle connection. The very next request from user John is serviced by pool process 9 - as pool process 5 is busy servicing Scott.
    Just who will be reading whose static PL/SQL state variables?
    PL/SQL static/state variables should be limited for use by PL/SQL only. E.g. something that I always do is to create a package called CONST (after the constants declaration in Pascal/Delphi) and define all my PL/SQL statics there.
    The PL/SQL code must be written being aware that each new call can be made from another front-end user (resetting session state becomes important).
    For other constants... - that is why lookup and application configuration tables should be created. Single copy of the data. Concurrency catered for. Data integrity provided.

  • 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.

  • 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 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.

  • 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

  • Global Variables Vs Form Library Package Variables Vs DB Package Variables

    I realise this question has been asked a few times with varying degrees of answers, but I am still seeking comment/advice from others.
    I am aware of following options for retaining persistent data to share between forms.
    1. Package variables in a library that you share in a session.
    This requires usage of SHARE_LIBRARY_DATA, there is risk that this not set, then does not share data.
    2. Package variables in a database package.
    Requires round trip to DB. Is this expensive for performance?
    What about risk of DB package becoming invalid and losing state?
    3. Use global variables
    Can be tricky to manage.
    4. Use parameters
    Only one way, ie called form cannot alter value that caller can see.
    Packages are closest to OO approach in using get and set modules. Allows all variables to be managed in one location. This appears best practice.
    Forms library packages appear risky if caller does not include SHARE_LIBRARY_DATA.
    DB packages have cost of round trip to DB. Does this become expensive is have to reference many times. Also topic of DB package becoming invalid and losing state?
    Forms global variables have regular disadvantages of globals, ie not sure who may modify. Need to manage carefully. Text only
    As a second related question, for value such as current user, for performance (and maintainability) is it better to obtain this from oracle user function each time, or save somewhere (in one of options above) and use that saved value each time.

    My personal opinion:
    I like the "packaged" version with getters and setters. In general, i create a client-side package in a pll which has methods to access the value by getters and setters. With that, the "implementation" is encapsulated and doesn't really matter to the rest of your system. All modules have to access the value using the getter and setter.
    Inside the procedure i use two approaches:
    1. If its for communication purposes between different forms i use globals, which are filled or extracted in the getter and setter (see this http://andreas.weiden.orcl.over-blog.de/article-28180655.html )
    2. If its for someother purpose where the value should be "session persistent" i use a database package with getters and setters, which are called from the client-side package getter and setter. If the value is quite "constant" throughout the session, i read the value once at initialization code of the client-side package and the getter just returns that "cached" value
    Hope this helps.

  • Accessing packages with Oracle Forms 9i

    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?

    If you want to access a client side device I would look at webutil, there are utilities for hooking into C DLLs. Strictly speaking webutil is only certified wil 10g forms but it should work in 9i Forms.
    Grant ROnald
    Forms Product Management

  • 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.

  • 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

  • Access a variable in the Adobe form for Java Scripting

    Hi,
    I am unable to know how to access the variable in a Adobe form.
    The variable is field of an internal table. My adobe form structure is as follows
    MAIN_PAGE->FORMSET->FirstFORM->EXT.
    in the EXT subform the variable(cust)  exists.
    The cust is in turn an internal table.

    Hello Sreelatha,
    I think we cannot hide a page.  as in, page is the main container.  In a container, we can hide any field using some scripting.  Even though if we hide the field, it is present on page but not visible. 
    but if some logic is there, please let me know.
    Thanks,
    Rakesh.
    Edited by: rakhi966 on Sep 8, 2011 8:54 PM

  • To view package variables in Forms 6i debugger

    Can anyone tell me how to view the value of the variables declared in the package spec(from forms side)? i can see only the local variables and global variables(declared using :GLOBAL) in the debugger window.

    In the 6i Debugger the visible Package variables are restricted to the Variables defined in the package body and these are only visible whilst you are instanciating the package for the first time - e.g. running through the anonymous block that you can have at the bottom of the package Definition.
    Otherwise they are invisble. Variables defined within Program units inside the Package are of course visble.
    The new Debugger in Forms 9i has fixed this problem and you can always view (and watch!) Variables defined both in the package Spec and Body.

  • How to access Workflow variables in Form Designer?

    Hello,
    I am wanting to set certain subforms to readonly depending on which part of the workflow the form is currently on. I already have the JavaScript code working to set the subform fields to readonly, but now I cannot figure out how to trigger this and where do I keep a variable to keep track of which part of the workflow I am currently in.
    I assume I will have a variable in the workflow itself and then I can use the Set Value QPAC to change the variable for each workflow step before it goes to the User QPAC, but what about within the form? I don't understand how the form javascript will know to execute, so how does my workflow "talk" to the form to set these fields to readonly?
    Right now the JavaScript code is sitting in the root::initialize part of the form. I was assuming I could have something like "if my workflow variable is equal to XX then set this subform to read only". But, how do I access my workflow variable in the form designer?
    Also, since I have digital signatures, I am having to pass all the form data in document variables, will this affect how I need to do this? I was also thinking of possibly accessing/setting a hidden field in the form, but thought the above way may be better.
    I hope that made sense!
    Thank you,
    Jennifer

    To follow-up, I spoke with Adobe support this morning and they said that I cannot access Workflow variables within Designer (besides those Workflow variables that are already provided).
    He mentioned that if I use the hidden fields, that I would need to Render the form each time before going to the User to trigger this to happen. So, I am not sure what I will do just yet. I probably not worry about making the fields readonly for the time being; it was a little extra thought I had and isn't required for our process.
    Thank you,
    Jennifer

  • Accessing a variable declared in another form

    Can someone tell me how I access a variable outside from the form it was declared in? I've tried examples but they haven't worked.

    There are many right ways and many wrong ways to do what you want, the two below (one code example) and one link to a demo project are but two ways to do this.
    A simple example, form1 as two buttons, form2, two buttons, one text box. This replies on knowing the parent form.
    Public Class Form1
    Public SomeVar As String = "Karen"
    Public Property SomeProp As Integer = 4
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim f As New Form2 With {.Owner = Me}
    Try
    f.ShowDialog()
    Finally
    f.Dispose()
    End Try
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    MessageBox.Show(Me.SomeVar)
    End Sub
    End Class
    Form2
    Public Class Form2
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim MyParent As Form1 = CType(Me.Owner, Form1)
    MessageBox.Show(MyParent.SomeProp.ToString & Environment.NewLine & MyParent.SomeVar)
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    Dim MyParent As Form1 = CType(Me.Owner, Form1)
    MyParent.SomeVar = Me.TextBox1.Text
    End Sub
    End Class
    The following link has a project which is much more involved, I allow non-modal forms to pass data between the two in real time and both forms stick to each other.
    https://onedrive.live.com/redir?resid=a3d5a9a9a28080d1!727&authkey=!AEQ4n6P1H4sD6QI&ithint=file%2czip
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • 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

Maybe you are looking for