How to declare a global/public variable in Oracle Forms

Hi All,
I have to get the value of a variable which is declared in the event 'When_Button_Pressed', in an another trigger with in the form.
My variable & type
l_db_handle EXEC_SQL.ConnType;
This variable used to get the handle of a new database connection.
(Here I am trying to make connection to two different databases from Form. That is working fine.)
I have tried with Global variable to transfer this variable value to other triggers. But it is not working. It shows 'Wrong type error'
Could you please let me know, how can I declare which DB handle variable as public in form(I mean i have to use this variable all the triggers with in the form)
Thanking You,
Manu

Put the code in a package within the form, have the triggers call functions/procedures within the package. All variables which need to be referenced in more than one procedure can be created as package variables.

Similar Messages

  • How to assign itemrender variables in global public variable of my applicaton.

    Hi Friends,
    How to assign internal item render values in global public variable. can u see below example.
    List have one itemrender,within the itemrender i am using data grid .The  dataGrid have itemrender.now i tried the data grid itemrender assign values to public variable of my application,but the Error came... How can u slove this Problem Any One can Help to me.
    Example:
    public var myData:arrayCollection;
    <mx:List variableRowHeight="true" dataChange="validateNow()"  width="900" id="Lst_userlist" verticalScrollPolicy="off"  horizontalScrollPolicy="off" 
         buttonMode="true">
    <mx:itemRenderer>
      <fx:Component>       
       <mx:VBox paddingTop="-5"  horizontalScrollPolicy="off" verticalScrollPolicy="off" >        
             <fx:Script>
              <![CDATA[        
               override public function set data(value:Object):void
              ]]>
             </fx:Script>
             <mx:VBox id="vbox_grid" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="890"  paddingLeft="10" paddingTop="5"
                     backgroundColor="#317152" color="#FFFFFF">        
              <mx:DataGrid visible="false" includeInLayout="false" height="100%" id="membershipGrid" alternatingItemColors="[#DCDCDC,#F8F8FF]"
                  paddingLeft="5"  horizontalScrollPolicy="off" color="black"
                  horizontalGridLines="false" verticalScrollPolicy="auto"  verticalGridLines="false"   rowHeight="25"
                  borderSkin="{null}" showHeaders="true" borderVisible="false" dataProvider="{data.dataCollection}" width="900" >
               <mx:columns>
                <mx:DataGridColumn width="180" headerText="Name" minWidth="150" sortable="true"  wordWrap="true" >
                 <mx:itemRenderer>
                  <fx:Component>
                   <mx:HBox horizontalScrollPolicy="off"   >
                    <fx:Script>
                     <![CDATA[
                      override public function set data(value:Object):void
                      function Click_Name():void
                        outerDocument.myData=data;  //  Here Error  came                 
                     ]]>
                    </fx:Script>
                    <mx:Image id="fileimg"    buttonMode="true"  toolTip="This is the User's Home Organization"/>          
                    <s:Label  id="lbl_Gridcloumn_name"  width="200" buttonMode="true" textDecoration="underline"  click="Click_Name()"  />
                   </mx:HBox>
                  </fx:Component>
                 </mx:itemRenderer>
                </mx:DataGridColumn>
    </cloumn>
    </datagrid>
    Error:
            Access of possibly undefined property myData through a reference with static  type com.istmanagement.views:ProgramAcessRights_ComponentInnerClass3.
    Thanks,
    Magesh R.

    Hi Flex harUI ,
    Thanks man....because  of i was stugle in last one week.... once again Thanks.......

  • Avoid Global Public variables...

    Hello Experts,
    I have declared few variables in package specification (l_test , l_test_2)and i'm using across the API procedures.
    But when i run the TOAD expert it says "Avoid defining global public variables in the package specification."
    So i thought of moving the code from package specification to package body...
    Is this a good approach and will my code work as it was working before if i declare in the body...
    Plz suggest ...
    Thanks...
    Earlier
    Package Specification Part
    CREATE OR REPLACE PACKAGE PKG_TEST
    AS
    l_test NUMBER(1);
    l_test_2 NUMBER(2);
    END;New
    CREATE OR REPLACE PACKAGE BODY PKG_TEST
    AS
      l_test NUMBER(1);
    l_test_2 NUMBER(2);
       PROCEDURE process
       IS
       END process ;
       PROCEDURE process_2
       IS
       END process_2 ;
    END PKG_TEST;

    Linus,
    Just so you are aware, the scope of those variables are different depending on if they are defined in the PACKAGE (SPEC) or PACKAGE BODY.
    Declared in the PACKAGE (Spec): Globally accessible to everything on the Schema.
    Declared in the PACKAGE (Body): Globally accessible to everything with that particular Package.
    So as you can see, this quite a big difference. TOAD is warning you because putting globals in the PACKAGE is a pretty sloppy coding practice that can easily lead to difficult to maintain code. While you can ignore it, I'd suggest not doing that. ;)
    In fact, I'd suggest avoiding globals altogether when possible. Passing parameters may be more time consuming, but it makes it very clear what each procedure/function should be doing, and future programmers will thank you. Time you'll save on initial programming will be made up when doing maintenance. But admittedly globals are useful, just be careful when using them. Getting your code to work isn't enough; you should aim to make it clear and understandable too.

  • Global Variable in Oracle Forms 6i

    Hi,
    How & where to define global variable in Oracle form 6i and also let me know how to access it.
    Thanks in advance
    Regards,
    Sanket

    hi
    Global variable are forms specifice variable.
    it can store character value upto 255 for all usages.
    We can initialize it when we declare otherwise give error if we did not assign it any value.
    Oracle 10g it can take upto 4000 bytes
    GLOBAL.ur_globalvar := TO_CHAR(15);
    or
    :GLOBAL.ur_globalvar:= '15';
    or
    Remmber numeric values are implicitly converted by oracle 2 character
    :GLOBAL.ur_globalvar:= 15;
    -- which can then subsequently be accessed using...
    :GLOBAL.ur_globalvar;
    -- To destroy a global variable and release its memory, use the ERASE built-in procedure:
    Erase('GLOBAL.my_var'); Regards,
    Abdetu...

  • How to change the font of variables in smart forms dynamicly

    Dear all,
    Is there any suggestion of how to change the font of variables in smart forms dynamicly?
    Thanks in advance.

    Hi,
    You cant change the font dynamically but tell me the scenario I will try to give the solution.
    Regards,
    Nageswar

  • How to access environment variables from Oracle Forms

    Hi,
    Any idea how to use the Environment variables from Oracle Forms.
    My basic problem is that from Oracle form I am calling Batch file which calls excel file with a macro.
    So i want to check whether the macro was successful or not.
    So in my batch file i will set %errorlevel% which I should be able to read from Oracle Forms.
    I am able to read the registry from oracle forms, so is there anyway to read environment variable as well?
    Thanks!
    Avinash.

    Hello,
    Use the TOOL_ENV.Getvar() built-in
    Francois

  • How to call a COM object from an Oracle Form?

    Hi All,
    Pls advice. How to call a COM object from an Oracle Form?
    Thanks.

    try asking the "Form" forum

  • How can i do the following in the oracle forms developer :

    How can i do the following in the oracle forms developer :
    1- delete or add new item to block and canvus at the RUNTIME ????
    2- change the following property at the RUNTIME :
    - item type
    - datatype
    - database item
    - column name

    How can i do the following in the oracle forms
    developer :
    1- delete or add new item to block and canvus at the
    RUNTIME ????It's not possible, you can do enabled/not enabled, or visible/not visible
    2- change the following property at the RUNTIME :
    - item typeno
    - datatypeno
    - database itemno
    - column nameno
    You are not lucky :-)

  • How do I set a public variable in a native ActiveX DLL using Java?

    Hello,
    I have run into an issue that I cannot seem to find any documentation on, and all of my efforts with search engines have returned no useful results.
    Here is my situation:
    I have an Active X DLL that has a very simple configuration, but it is a third party DLL which I cannot modify. To interface with the DLL I have to set a series of public variables and then call a method with no parameters that will use the current values of the variables to perform a calculation. There are no "set" or "get" methods.
    At this point I have a very good idea about how to use JNI to create the class in java, and call the method. However, this does me no good at all if I cannot set the variables.
    Everything I have found so far defaults to an assumption of no direct access to variables, and that getter and setter methods would be available for that purpose. Anyone know of a way that this might be handled? I would provide source code, but it seems useless unless I know how to actually do this.
    Thanks in advance for any input.

    OK. Those are OLE/ActiveX/COM/WhateverTheyCallIt getters and setters, that VB makes look like object 'properties'.
    If you are familiar a bit with C#, they also have 'properties', which are getters and setters hidden behind a syntax that makes them look like member variables.
    I am affraid my help has to stop here, as I don't remember COM anymore.
    But, unless you find someone who really knows COM, you will have to investigate by yourself.
    One suggestion though: open a C++ project in VisualStudio 2005 or 2008 (not Express, it seems not to support what I describe).
    Go to something like References or Add Reference and you will see a tabbed dialog box with a COM tab (I describe all this from memory).
    Add your DLL. After this do View->Object Browser or alike. It should show your COM object. You will be able to examine its methods and properties.
    I think Visual Studio canl generate code for invoking them. This is the C code that somehow you should take from there and place in your JNI code.
    Edited by: baftos on May 9, 2010 11:22 AM
    Correction: VS2008 Express also supports this, but to get there, you do View->Object Browser->Click the "..." button->COM tab.
    VS2008 Express is free.
    Edited by: baftos on May 9, 2010 11:25 AM

  • How can I use a public variable inside a CachedResultSet

    The public variable that I declared cannot be called inside the CachedResultSet class....
    Heres a part of the code:
         public String type;
         public String getType()
             return type;
         public void setType(String s)
             type = s;
         public CachedRowSet first_report(){
              try {
              String t=type;<<it cannot get the String type declared outside.....     
              Statement stmt = con.createStatement();
              String query = "select stock_code, shares_prices, new_shares, trans_date, prev_close from allTrans where name_broker='"+type+"' order by stock_code";
              ResultSet rs = stmt.executeQuery(query);
                CachedRowSetImpl crset = new CachedRowSetImpl();
                crset.populate(rs);
              rs.close();
              stmt.close();
              con.close();
              return crset;
               catch (Exception e)
              {   System.out.println(e.getMessage());
                  return null;
         }

    I am not getting any error but the value of String type is null when entering the CachedRowSet...I don't know why it is null and yet the String type can be used by other classes...Like the getType...
    Heres the code:
    import java.sql.*;
    import sun.jdbc.rowset.*;
    import com.sun.rowset.*;
    import javax.sql.rowset.CachedRowSet;
    public class views
          String url, uname, pwd;
          Connection con;
         public String type;
          public String hstock;
          public String hbroker;
         public String getType()
         {  System.out.println("get:"+type);
             return type;
              public void setType(String s)
             type = s;
         public views()
               try
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               url = "jdbc:odbc:***";
               uname = "root";
               pwd = "yes";
               con = DriverManager.getConnection(url, uname, pwd);
               } catch (Exception e)
                    System.out.println(e.getMessage());
    public CachedRowSet first_report(){
              try {
              String t=type;
                System.out.println(t);
                System.out.println(type);     
              Statement stmt = con.createStatement();
              String query = "select stock_code, shares_prices, new_shares, trans_date, prev_close from allTrans where name_broker='"+type+"' order by stock_code";
              ResultSet rs = stmt.executeQuery(query);
                CachedRowSetImpl crset = new CachedRowSetImpl();
                crset.populate(rs);
              rs.close();
              stmt.close();
              con.close();
              return crset;
               catch (Exception e)
              {   System.out.println(e.getMessage());
                  return null;
         }

  • How are listbox and radiobutton items working in oracle forms?!?

    Hi all.
    I need some help over may be a standard case in every real project.
    Imagine i have a db table PERSONS -> PERSONID, NAME, TOWNID, MATRIALSTATUSID
    and table TOWNS -> TOWNID, TOWNNAME
    and table MATRIALSTATUS -> MATRIALSTATUSID, NAME
    And i have a standard oracle form with text item person name, listbox item with many towns (from TOWNS table) and the town of the concrete person is selected when the form is inited, after that we can change it by selecting other town and saving it to db.
    The same is with matrial status but lets make it as radio group with 3 buttons married, not merried, divorced.
    So my questions is how to populate the listbox(radiogroup) for 1 person by selecting data from other preferenced tables. And most important how this data is populated in the list box for example i.e. every town name is indexed in some way or what. I am a java developer and for example in java the control listbox item has two attributes the name(string) that is displayed in the listbox and a index binded for that name, and i work with indexes and show strings. I read about LOV but couldn't understand how to "index" the populated values. Is it possible.
    And please can you give me some example of how to load (populate + set current town), change and (if it is possible) "index". The same case appears to be valid with radio buttons and check boxes.
    You could give me some tutorials too, i cant find simple and focused on the problem examples.
    Thank you.
    Best Regards.

    Hi,
    well here is what i done for now.
    First I created recordGroup with query SELECT GENDER, GENDERID FROM GENDERS (I want to select all genders and place them in listbox)
    After that i created Listbox and on triger when-new-form i placed this code:
    DECLARE
    it ITEM:=FIND_ITEM('PERSONS_DETAILS.GENDER');
    BEGIN
    CLEAR_LIST(it);
    POPULATE_LIST(it, 'RG_LIST');
    DEFAULT_VALUE(NULL, 'GLOBAL.PERSONID');
    IF :GLOBAL.PERSONID IS NOT NULL THEN
    SET_BLOCK_PROPERTY('PERSONS_DETAILS', ONETIME_WHERE, 'PERSONID=' || :GLOBAL.PERSONID);
    GO_BLOCK('PERSONS_DETAILS');
    EXECUTE_QUERY;
    :GLOBAL.PERSONID:=NULL;
    END IF;
    END;
    Imagine i have a main form PERSONS that displays general information about many persons (the data is retrieved from PERSONS db table). The form PERSONS displays PERSONID, PERSON FIRSTNAME and PERSON LASTNAME. When a user double click on some row from the PERSONS FORM( i have tabular datablock that displays the person data) other form 'PERSONS_DETAILS' must be displayed with detailed information about the selected person. The data about the selected person is loaded well but i want gender to be listbox and the user can change it if he wants. So i have TABLE GENDERS 1:N with PERSONS and the table has GENDERID AND GENDER. When the user double clicks on single person i must populate the list with all possible genders from the GENDERS table and set the gender of the selected person. How to do that?
    P.S.: The example with gender is not very good because it could be only male female, but don't worry about it. You may think about gender list as townlist :)
    It finds me the GENDER LIST and populates it. After that i take the personId (that is global variable and comes from previous form) and displays all the data for the person with id personid.
    When i compile the form it gives me :
    FRM-30351: No list elements defined for list item.
    List GENDER
    Edited by: user9536806 on Nov 19, 2008 3:01 AM

  • Sending email through a public folder from Oracle forms 6i

    Hi,
    I have read a lot about this topic but still can't seem to figure out how to send a email from a public folder that I have access to. I am logged on as myself into Outlook and I have access to a public folder. When I send a email with attachments to a client it MUST show the public folder email address as the "FROM'. How can I get outlook to stop defaulting to my email? I have the proper rights and so forth meaing I can send a test email logged onto this folder and user cc,bcc, BUT not the FROM field.
    Here is my code:
    Declare
    objOutlook OLE2.OBJ_TYPE;
    objMail OLE2.OBJ_TYPE;
    objArg OLE2.LIST_TYPE;
    objArg2 OLE2.LIST_TYPE;
    objAttach OLE2.OBJ_TYPE;
    nameSpace OLE2.OBJ_TYPE;
    args OLE2.LIST_TYPE;
    BEGIN
    objOutlook := OLE2.CREATE_OBJ('Outlook.Application');
    args:=OLE2.create_arglist;
    OLE2.add_arg(args,'MAPI');
    nameSpace:=ole2.invoke_obj(objOutlook,'getNameSpace',args);
    OLE2.destroy_arglist(args);
    OLE2.invoke(nameSpace,'Logon');
    objarg := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(objarg,0);
    objMail := OLE2.INVOKE_OBJ(objOutlook,'CreateItem', objarg);
    OLE2.DESTROY_ARGLIST(objarg);
    objAttach := OLE2.GET_OBJ_PROPERTY(objmail, 'Attachments');
    objarg := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(objarg,'c:\Jan28.txt');
    objarg2 := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(objarg2,'c:\2011_1.pdf'); -- filename
    OLE2.SET_PROPERTY(objmail,'FROM','[email protected]');
    OLE2.SET_PROPERTY(objmail,'To','[email protected]');
    OLE2.SET_PROPERTY(objmail,'Bcc','[email protected]');
    OLE2.SET_PROPERTY(objmail,'Subject','Email sent from Oracle Forms 6i');
    OLE2.SET_PROPERTY(objmail,'Body','Testing email FROM');
    OLE2.INVOKE(objattach, 'Add', objarg);
    OLE2.INVOKE(objattach, 'Add', objarg2);
    OLE2.INVOKE(objmail,'Send');
    OLE2.RELEASE_OBJ(objmail);
    OLE2.RELEASE_OBJ(nameSpace);
    OLE2.RELEASE_OBJ(objOutlook);
    OLE2.DESTROY_ARGLIST(objarg);
    END;
    Please let me know why OLE2.SET_PROPERTY(objmail,'FROM','[email protected]');
    does not work. And how I can get it to work?
    Any suggestions much appreciated...

    You can send emails using the utl_smtp package. There are many examples in the pl/sql forum, or on http://asktom.oracle.com.

  • How to Return a value to a 10g Oracle Form form a Web Service Call

    I've read the demo available from Oracle, 'Calling a Web service from Oracle Forms', that shows how to invoke a call to a Web Service from a Form. The demo only shows how to do a call and how to display messages. I've done some searching, but can't seem to find any examples of how to return a value from the call into a field on the form. If any one could provide an example of that, I would greatly appreciate it.
    We are in the process of modifing a form and we would like to use a webservice, which we have never done before. We have created a webservice which calculates a value based upon what is entered on the form and we want to pass that calculated value back to a field on the form.
    This is the code provided by the demo to do a call.
    DECLARE
    jo ora_java.jobject;
    xo ora_java.jobject;
    rv varchar2(100);
    ex ora_java.jobject;
    BEGIN
    JO := SendServiceSoapClient.new;
    RV := SendServiceSoapClient.sendMessage(JO,:BLOCK3.PHONE_NUMBER, :BLOCK3.MESSAGE_BODY, xo, xo);
    EXCEPTION
    WHEN ORA_JAVA.JAVA_ERROR then
    message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
    WHEN ORA_JAVA.EXCEPTION_THROWN then
    ex := ORA_JAVA.LAST_EXCEPTION;
    message(Exception_.toString(ex));
    END;

    In the future, please be sure to include the exact product versions you are using. In this case, also be sure to include the java versions you are using to build your java code.
    http://blogs.oracle.com/shay/entry/10_commandments_for_the_otn_fo
    Regarding your question, take a look at this older white paper which discusses integrating Forms with SOA.
    http://www.oracle.com/technetwork/developer-tools/forms/documentation/forms-soa-wp-1-129441.pdf

  • Setting system variables for Oracle Forms at runtime

    Hi,
    I've read somewhere that a user can set some Oracle Forms system variables
    like SYSTEM.MESSAGE_LEVEL, SYSTEM.DATE_THRESHOLD, SYSTEM.EFFECTIVE_DATE, SYSTEM.SUPPRESS_WORKING
    at runtime.
    Does anyone know how?
    I want to use the same fmx file with various settings, so do not want to
    hard code any values for these variables.
    TIA,
    Sam

    Frequently I modidied
    :system.message_level := 0 let's say.
    For other system variables I cannot help you.
    Ovidiu

  • How to run a DOS command from an Oracle form.

    How can I run a DOS command from an Oracle form (i.e. open the calculator located at c:\windows\system32\calc.exe)?

    first of all get the environment variable for the c:\windows\system32 direcotry for any of the windows
    you can use get variable from the ora env package
    now cancat the system32 variable with the calc.exe string
    now pass the string with host command as parameters
    this process will work for all type of windows.

Maybe you are looking for

  • How do I access an external hard drive attached to an Airport Extreme using the Finder's "Go to the folder" feature?

    How do I access an external hard drive attached to an Airport Extreme using the Finder's "Go to the folder" feature? I have an external hard drive attached to my Airport Extreme and I can access it just fine through Finder.  I would like to be able t

  • Bug: Project List Items Overprint One Another, Any Tips to Fix?

    From time to time, following import of a project, all the folders and projects in the "All Projects" pane overprint one another on the same line. The "Library" displays okay; the newly imported project name displays okay, then after a half dozen othe

  • N9 IMAP4 messages are not deleted on the server

    Emails deleted on N9 are not deleted (nor marked for deletion) in IMAP4 account on the server? I can see "unprocessed" emails in modest/evolution/thunderbird/webmail (after resync) which I have already deleted on the N9. I have deleted the account, s

  • SAP PP AFS solution configuration

    Dear Friends Can i have any complete  PP configuration steps for SAP AFS solution? Thanks A N M Jamal

  • Read Report

    Dear All, I have a requirement where i need to read the source code of a report into an internal table along with the line number. We have READ REPORT programname INTO tablename but in this case i will get only the source code. Ex : If the source cod