Can I Access the Value of a Global Variable in a Trigger

I'm using a Global variable in a Package which i use in the BIU Trigger to populate a column. After assigning the value for that global variable, I run an INSERT in the same package. But I find only the default value of the Global variable populated in the column. Can I use a Global Variable in a Trigger? Is there any way to put in a common value across all the tables in an application for all DMLs of a particular session?

Helios,
I'm already having the same setup mentioned in the thread. And I'm doing exactly whats given there. But the issue seems to be something different. I'm assigning the value to the Global Variable in the Package through Apex. Here's the Package Code:
CREATE OR REPLACE PACKAGE Schema1.SPMS_SECURITY_PKG
AS
X_app_user_id NUMBER DEFAULT -1;
FUNCTION USER_ID RETURN NUMBER;
END SPMS_SECURITY_PKG;
CREATE OR REPLACE PACKAGE BODY Schema1.spms_security_pkg
AS
FUNCTION user_id
RETURN NUMBER
IS
BEGIN
-- RAISE_APPLICATION_ERROR(-20001,'USER ID'||'*'||X_app_user_id);
RETURN NVL (x_app_user_id, -1);
-- RETURN NVL (sys_context('USERENV', 'CURRENT_USER'), -1);
EXCEPTION
WHEN OTHERS
THEN
RETURN -1;
END;
And Here is the Trigger Code:
CREATE OR REPLACE TRIGGER Schema1."USER_DETAILS_TRIGGER"
BEFORE INSERT OR UPDATE
ON PMS_SICAL.SPMS_USER_DETAILS REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
IF INSERTING
THEN
:NEW.created_by := spms_security_pkg.user_id;
:NEW.created_date := SYSDATE;
:NEW.START_DATE := SYSDATE;
ELSIF UPDATING
THEN
:NEW.updated_by := SPMS_SECURITY_PKG.X_app_user_id;--spms_security_pkg.user_id;
:NEW.updated_date := SYSDATE;
END IF;
END;
But I always get -1 in the both in the table after the DMLs.

Similar Messages

  • How can I access the values in ProfileArray of a CWIMAQProfileReport?

    Hi all,
    I'm not sure if this is the right board, but I didn't find one related to VB and NI Vision.
    I'm using LineProfile2 from CWIMAQVision1 which gives me a ProfileArray which is a variant. I'd like to access the
    values in the array. Normally I would do it like
    Report(1).ProfileArray(i)
    but that does not work. I can get the bounds of the array with LBound and UBound. I can observe the array in 
    debug modus and it contains reasonable values.
    How can I get access to the contents of the ProfileArray?
    Thanks in advance
    Axel

    Hi Elmar,
    thanks for paying attention to my problems.
    I use Vision 8.5. My email adress is [email protected]
    I don't need the hole intensity of the image/2D array. I only need the
    intensity values of a given line which should be a 1D array of bytes.
    I use the following command
            CWIMAQVision1.LineProfile2 Image, Line, Report
    When I understood the command correctly the intensity values are
    in the Report. I would get them with 
            Report(1).ProfileArray(i)
    But that does not work. I get a runtime error #450.
    Other stuff with the report works and gives reasonable values e.g.
                Report(1).PixelCount
                LBound(Report(1).ProfileArray)
                UBound(Report(1).ProfileArray)
    Or passing the hole array to plot the values also works
            frmLineProfile.CWGraph1.PlotY Report(1).ProfileArray
    Best regards,
    Axel

  • How can we access the value set to a search criteria's attribute

    Hi guys,
    Is there any way to access the value which was set to a search criteria's attribute programmatically in the backing bean?
    Regards !
    Sameera

    Check sample 85 from the adf code corner sampleshttp://www.oracle.com/technetwork/developer-tools/adf/learnmore/85-querycomponent-fieldvalidation-427197.pdf
    Frank shows how to access the variables.
    Timo

  • How can I access the value of a loop index outside the loop?

    I have a sequence structure in Labview 8.6.  At one frame of the sequence I have a while loop.  The loop runs for a while and then stops and the program then moves to the next frame of the sequence.  Several frames further on down the sequence I have a cluster, the elements of which are outputs on the front panel.  The index of the mentioned loop is one of the cluster elements, an numeric output.  While the loop is running, I want the index to be displayed on the front panel in the output contained in the cluster.  How can I do this?

    The easiest way to do this is to use a local variable of your cluster.  You'll need one copy set to read; connect that to a bundle by name, bundle in your index value from the loop, and wire the bundle output to a write copy of your local variable.  You can create a local variable by right-clicking on the cluster terminal (in the block diagram) and choosing create local variable.  You can change the local variable to read or write by right-clicking on it.
    However, in general the use of both local variables and sequence structures is discouraged, and the right solution may be to rewrite your code with a while loop containing a case structure in which you update the cluster every time through the loop.  This will look like a state machine; you'll also need a shift register in place of the loop iteration counter.  If you post your code (ideally the VI, but if not then a screenshot of the block diagram) then we can provide more useful assistance.

  • IF command does not work on the value of a global variable

    Dear all!
    I created a global variable &CurQ, assigned it to my application and my current database and assigned a value "Q3" to it. Then I created a simple business rule: Forecast (IF (&CurQ==Q1) Forecast=Actual; ELSE Forecast=Plan; ENDIF;). "Forecast", "Actual" and "Plan" are Scenario dimension members. After validating and running this command I found that Forecast member always picks the values of "Actual" member although it should pick the values of "Forecast" (given that &CurQ has the value of "Q3"). I tweaked around with my IF command and found that it always picks just the first statement after the condition regardless of whether the condition is true or false. So I am stuck and can't guess where the problem hides. I will be very grateful for any hint!

    Hi,
    Try using your variable in your fix and using the @ISMBR function as your condiation.
    e.g.
    FIX(&CurQ)
    Forecast (
    IF @ISMBR(Q1) Forecast=Actual;
    ELSE Forecast=Plan;
    ENDIF;)
    ENDFIX
    Regards,
    -John

  • How can I do the CNiReal64Vector as a global variable?

    My problem is with the CNiReal64Vector. Ive tried to define this vector as a global variable in the header file:
    public:
    NI::CNiReal64Vector plotData(50);
    but the debuger flushed error : Syntax error ´constant´.
    Of course,  I used usually square brackets:
     public:
    double plotData[50];
    Is it possible define the array of CNiReal64Vector as a global variable?
    Thank You.
    Best Regards
    Emta

    In the header (.h) file, declare the variable like this:
    extern NI::CNiReal64Vector plotData;
    In a source (.cpp) file, define the variable like this:
    NI::CNiReal64Vector plotData(50);
    This will cause the compiler to generate a single instance of the plotData global variable and a call to the CNiReal64Vector constructor that takes an integer that specifies the initial size. I believe that this is what you are trying to do.

  • Setting the value of a java variable in javascript function

    How can i set the value of a java variable in a javascript function?
    <%
    String fName = "";
    %>
    now i want to define a javascript function which can set the value of fName to the value it has been passed.
    <script language="javascript">
    function setJValue(val)
    </script>
    Thanks

    The only way you could simulate this, would be call the same page inside the Javascript function, and send it the parameter that was passed. Then you would have your Java code retrieve this parameter by request.getParameter("value");, and set the variable accordingly.

  • How can I access the Attribute Values from the Search Region

    Hi all,
    I have a table which contains Company id, department id, and PositonId. For a particular Company and Department there may be multiple records.
    I have to pupulate a table which contains the position and other details that comes under a particular Department and Position based on the selection in the Three comboBoxes.
    Also I have to populate a select many Shuttle to add new postions and records under a particular Department.
    I created a query panel *(Search Region)* for the serch and a table to display the data. That is working fine.
    Now the issue is I am using a view criteria to populate the shuttle with two bind variables ie, DepartmentId and CompanyId.
    If the serach will return a resuktant set in the table it will also pupulate the correct records, otherwise ie, if the if the serch result is empty the corresponding iterator and the attribute is setting as null.
    SO I want to access the attribute values from the Search Region itsef to populate the shuttle.
    I don't know how can I access the data from the Search Region.
    Please Help.
    Regards,
    Ranjith

    you could access the parameters entered in search region by the user as follows:
    You can get handle to the value entered by the user using queryListener method in af:query.
    You can intercept the values entered as described
    public void onQueryList(QueryEvent queryEvent) {
    // The generated QueryListener replaced by this method
    //#{bindings.ImplicitViewCriteriaQuery.processQuery}
    QueryDescriptor qdes = queryEvent.getDescriptor();
    //get the name of the QueryCriteria
    System.out.println("NAME "+qdes.getName());
    List<Criterion> searchList = qdes.getConjunctionCriterion().getCriterionList();
    for ( Criterion c : searchList) {
    if (c instanceof AttributeCriterion ) {
    AttributeCriterion a = (AttributeCriterion) c;
    a.getValues();
    for ( Object o : a.getValues()){
    System.out.println(o.toString());
    //call default Query Event
    invokeQueryEventMethodExpression("#{bindings.ImplicitViewCriteriaQuery.processQuery}",queryEvent);
    public void onQueryTable(QueryEvent queryEvent) {
    // The generated QueryListener replaced by this method
    //#{bindings.ImplicitViewCriteriaQuery.processQuery}
    QueryDescriptor qdes = queryEvent.getDescriptor();
    //get the name of the QueryCriteria
    System.out.println("NAME "+qdes.getName());
    invokeQueryEventMethodExpression("#{bindings.ImplicitViewCriteriaQuery.processQuery}",queryEvent);
    private void invokeQueryEventMethodExpression(String expression, QueryEvent queryEvent){
    FacesContext fctx = FacesContext.getCurrentInstance();
    ELContext elctx = fctx.getELContext();
    ExpressionFactory efactory = fctx.getApplication().getExpressionFactory();
    MethodExpression me = efactory.createMethodExpression(elctx,expression, Object.class, new Class[]{QueryEvent.class});
    me.invoke(elctx, new Object[]{queryEvent});
    Thanks,
    Navaneeth

  • Can F4IF_INT_TABLE_VALUE_REQUEST FM return a value in a global variable?

    Hi everybody,
    I need to use F4IF_INT_TABLE_VALUE_REQUEST FM because I have to let users select an specific option before choosing another value. The point is that I need to save in a program global variable what the user selects, and decide something with it in the program.
    Is it possible that F4IF_INT_TABLE_VALUE_REQUEST FM returns the value in a sinple variable or it has to be paramter?
    I look in a lot of previous threads but I didn't find anything, and I don't know if it's possible.
    Thanks and kind regards,
    MMP.

    Hi,
    Sure you can. All you need to do is to store what the function returns in your global variable. It don't need to be returned back to screen field.
    DATA: BEGIN OF VALUES OCCURS 0,
             CARRID TYPE SPFLI-CARRID,
             CONNID TYPE SPFLI-CONNID,
           END OF VALUES.
    DATA: VALUES_TAB TYPE TABLE OF VALUES,
              G_VALUE TYPE SPFLI-CONNID.  "global variable to store what is returned
    "in PAI first populate your table
      SELECT  CARRID CONNID
        FROM  SPFLI
        INTO  CORRESPONDING FIELDS OF TABLE VALUES_TAB
        UP TO 10 ROWS.
    "then call the function but don't return the value to screen field
    "If you specify the import parameters DYNPPROG, DYNPNR, and DYNPROFIELD, the useru2019s selection is
    "returned to the corresponding field on the screen. If you specify the table parameter RETURN_TAB, the
    "selection is returned into the table instead.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                RETFIELD         = 'CONNID'
                VALUE_ORG        = 'S'
           TABLES
                VALUE_TAB        = VALUES_TAB
                RETURN_TAB      = RETURN_TAB.
    "now simply read first row of return tab and store the value returned there in some global var
    READ RETURN_TAB INDEX 1.
    MOVE RETURN_TAB-FIELDVAL TO G_VALUE.
    Regards
    Marcin

  • How can i pass the value one from to another form?

    hi all
    how can i pass the value one from to another form  with out use it when ever i want to needed this value that ican useit?
    like i have two fields U_test1 and U_test2  table name @AUSR
    that i have  four form  A! , A2,A3,A4    please tell me in details....?

    Hi,
    U can assign the values to some variables and access then in ur required forms.
    Vasu Natari.

  • How can I receive the value of a selected item in the backing bean

    I have a table in a jspx file.
    When I go to the detail page I want to do something with the value of the currentrow.
    I want do a calculaction of the value of ClbId.
    How can I receive the value of the selected ClbId in my backing bean
    <af:table value="#{bindings.Searchteamlist.collectionModel}"
    var="row" rows="#{bindings.Searchteamlist.rangeSize}"
    first="#{bindings.Searchteamlist.rangeStart}"
    emptyText="#{bindings.Searchteamlist.viewable ? 'No rows yet.' : 'Access Denied.'}"
    selectionState="#{bindings.Searchteamlist.collectionModel.selectedRow}"
    selectionListener="#{bindings.Searchteamlist.collectionModel.makeCurrent}"
    rendered="#{backing_FirstFlag_Club_Club.searchFirstTimeClub_Club_AdresAndereClubs == false}">
    <af:column sortProperty="Matricule" sortable="true"
    headerText="#{bindings.Searchteamlist.labels.Matricule}">
    <af:outputText value="#{row.Matricule}"/>
    </af:column>
    <af:column sortProperty="ClbId" sortable="true"
    headerText="#{bindings.Searchteamlist.labels.ClbId}">
    <af:outputText value="#{row.ClbId}">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.Searchteamlist.formats.ClbId}"/>
    </af:outputText>
    </af:column>
    <af:column sortProperty="Nom" sortable="true"
    headerText="#{bindings.Searchteamlist.labels.Nom}">
    <af:outputText value="#{row.Nom}"/>
    </af:column>
    <f:facet name="selection">
    <af:tableSelectOne text="Select and">
    <af:commandButton text="Submit"
    action="club_AdresAndereClubsDetail">
    <af:setActionListener from="#{row}"
    to="#{processScope.row}"/>
    </af:commandButton>
    </af:tableSelectOne>
    </f:facet>
    </af:table>

    hi tde
    Using an Expression Language helper class like this one from Steve Muench ...
    http://radio.weblogs.com/0118231/stories/2006/12/18/sourceForMyFavoriteElHelperClass.html
    ... you could write something like this in your backing bean:
    Integer vClbId = (Integer)EL.get("#{row.ClbId}");(Make sure to cast it to the correct type.)
    success
    Jan Vervecken

  • How can I access the properties of Microsoft files (excel, ppt, and word)

    Hi,
    How can I access the properties of common Microsoft file formats (Excel, Word, and Powerpoint) from a Java program. You can access/modify the properties of each document type using File->Properties in each MS application. The properties are essentially name/value pairs.
    Basically, I need to write a java program that scans a directory and accesses the properties in each of the MS files in the directory.
    thanks,
    -john

    By api. That is only way to establish a contract with the MS programs you want to interface with, unless you write an api yourself! I've used POI and it was an awesome way to use Excel in java. I created an excel spreadsheet from the results of a sql query from a batch program and then it was automatically emailed using javamail to my client. I had a lot of VBA experience with Excel, Word, and Outlook and it didn't take me long to get used to using Jakarta-POI.
    Now I see there is Jakarta-POI-HWPF which works with MS Word documents. Go to: http://jakarta.apache.org/poi/

  • How can I access the selected element of a DropDownByIndex-box?

    Hi,
    I want to create a WebDynpro with two web services. I created the first request with the first web service and the results are displayed in a DropDownByIndex-Box. Now the user should choose one of the results and I would like to use this for the request with my second web service. How can I access the selected Element of a DropDownByIndexBox in the Code?
    Thank you!!
    Julia

    Hi Julia,
    when user select one element in drop down it automatically set lead selection of node binded to dropdown.
    For example if you bind a dropdown to node myNode with value attribute myAttribute the lead selection of node myNode is set in the position of element choose from user.
    So to take this chooised element use this code:
    wdContext.currentMyNodeElement.getmyAttribute()
    bye
    Andrea

  • How to access the value of a field of a field symbol.

    Hello All,
    i need to access the value of a field in a field symbol. But when i am trying to get the value like <FS>-POSNR, it's showing that that the <FS> has no structure.
    In my program, the field itself that i need to check should be dynamic. ie i'll get the field in a variable and i need to find the value of that field.
    Am pasting my code below, please tell me what needs to be done.
    here in my sample code i am moving the entry of the <FS> into a work area structure. But in my actual program, i gets the structure as a parameter. So is there any way i can declare a work area dynamically...
    FUNCTION z_39181_dyn_fs_60758.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(PARAMETER) TYPE  VBELN
    *"  TABLES
    *"      DATA_TAB
      BREAK-POINT.
      FIELD-SYMBOLS <fs> TYPE ANY.
      FIELD-SYMBOLS <fs1> TYPE ANY.
      FIELD-SYMBOLS <fstab> TYPE ANY TABLE.
      DATA name(5) VALUE 'POSNR'.
      FIELD-SYMBOLS <f> TYPE ANY.
      DATA: dref TYPE REF TO data,
            dref1 TYPE REF TO data,
            dref2 TYPE REF TO data.
      DATA: lv_lips TYPE string.
      DATA: lv_lipsfld TYPE string,
                lv_fld TYPE string,
                lw_lips TYPE lips.
                lv_lips = 'LIPS'.
                lv_fld = 'LW_lips-POSNR'.
      CREATE DATA dref1 TYPE (lv_lips).
      CREATE DATA dref TYPE STANDARD TABLE OF (lv_lips).
      CREATE DATA dref2 LIKE LINE OF data_tab.
      ASSIGN dref->* TO <fstab>.
      ASSIGN dref1->* TO <fs>.
    assign dref2->* to <fs
      <fstab> = data_tab[].
      LOOP AT <fstab> INTO <fs>.
        lw_lips = <fs>.
        WRITE lw_lips-vbeln.
        ASSIGN (lv_fld) TO <fs1>.
       write <fs>
      ENDLOOP.
    Helpful answers will be rewarded...

    Use syntax
    ASSIGN COMPONENT name OF STRUCTURE struc TO <fs>.

  • Can I set the value of a list binding in my managed bean?

    Dear All,
    This is just an exercise for me and I just wanted to experiment on the bindings of ADF for me to understand it further.
    I wanted to create a custom Model Driven LOV with my data control listed below
    Countries
         -CountryId
         -CountryName..but I wanted to display the label similar to this
    1 - USA
    2 - England
    n - France..so I thought of manipulating the select items in a bean
    <af:selectOneChoice id="soc1" value="#{bindings.Countries.inputValue}">
      <f:selectItems value="#{pageFlowScope.MyBean.countries}" id="si1" valuePassThru="true"/>
    </af:selectOneChoice>..and the code similar to this
    public class MyBean{
         public List<SelectItem> getCountries(){
              //countryMap points to accessing the iterator binding
              //BindingsHelper is a utility class that sets the value
              for(...){
                   SelectItem item = new SelectItem();
                   item.setLabel(countryMap.get("CountryId") + " - " + countryMap.get("CountryName"));
                   item.setValue(countryMap.get("CountryId"));
                   list.add(item);
              //set the item to the first row
              BindingsHelper.setExpressionValue("#{bindings.Countries.inputValue}",
                                     list.get(0).getValue());
              return list;
    }...on the last part I wanted to set the value to the first item but I am encountering numberformatexception when setting the list binding.
    I know I can do this declaratively also by removing the unselected item but as I have said I am experimenting on the bindings.
    Is this not possible?
    Thanks.
    JDev 11G PS5

    Hi ,
    I understand that , you want to show select one choice (dropdown) with label (countyid - country name) and value is (countryid).
    and these informnation is coming from ADf Model ( may be a VO).
    in the UI page you used this list is coming from MyBean
    <af:selectOneChoice id="soc1" value="#{bindings.Countries.inputValue}">
    <f:selectItems value="#{pageFlowScope.MyBean.countries}" id="si1" valuePassThru="true"/>
    </af:selectOneChoice>
    so ,
    The Managed Bean code should be ,
    private List<SelectItem> countries;
    ///setter method
    public void setCountries(List<SelectItem> countries) {
    this.countries= countries;
    // getter method
    public List<SelectItem> getQuoteStatusList() {
    quoteStatusList =
    selectItemsForIterator("countriesVOIterator",
    "countryId", "countryName");
    return quoteStatusList;
    public static List<SelectItem> selectItemsForIterator(String iteratorName, String valueAttrName, String displayAttrName) {
    return selectItemsForIterator(findIterator(iteratorName), valueAttrName, displayAttrName);
    public static DCIteratorBinding findIterator(String name) {
    DCIteratorBinding iter = getDCBindingContainer().findIteratorBinding(name);
    if (iter == null) {
    throw new RuntimeException("Iterator '" + name + "' not found");
    return iter;
    public static List<SelectItem> selectItemsForIterator(DCIteratorBinding iter, String valueAttrName, String displayAttrName) {
    List<SelectItem> selectItems = new ArrayList<SelectItem>();
    for (Row r : iter.getAllRowsInRange()) {
    string labelValue = (String)r.getAttribute(valueAttrName) +"-"+ (String)r.getAttribute(displayAttrName);
    selectItems.add(new SelectItem(r.getAttribute(valueAttrName),labelValue ));
    return selectItems;
    this will give you what you except in the ui
    when you try to get the value form that seclecOneChoice value in MyBean what user selects , you can simply get the value of this selectOneChoice.

Maybe you are looking for

  • Gray thumbnails and can't drag and drop clips

    I've been using iMovie 11 for a while now, and have accumulated more footage than my Mac HD can hold, so I migrated all my iMovie Events to an external HD. Everything still worked fine for several days after I moved the videos, but then a few days la

  • Iphone keyboard shortcut not working

    Hi I used to be able to enjoy the keyboard shortcut but it is not working now. Shortcuts that I have include: omw (On my way), wu (where are you?), myadd (my complete address which is about 30 characters long) are all not working. I tried to delete b

  • Can not edit movie...

    Can someone help me out with this? I had a movie I was working on and today when I come in to work on it and open it up it won't allow me to edit any part of it (won't open a tab in the Browser). I looked at some other movie files and there seems to

  • Safari update + InDesign

    Hi, I updated safari and InDesign (CS2) stopped working. I see that someone else posted this as well. I tried the tricks they posted: I tried removing the preferences, I tried re-installing. I even tried installing the InDesign CS4 to see if that wor

  • Using Flex/PHP to Display MYSQL data and Images

    Does anyone have any good examples of using Flex 3 in conjunction with PHP to display data and images from a mysql database? I've searched a lot and it seems hard to find this combination. I have manged to create a login system using this which allow