How can I dynamically specify a Column Name in a Where Clause of a DB

I have a page that query the Database based on the column Name and values entered by the user. on this page I have a drop down list of all the Column names and a text field. The user can choose from any of the dropdown list option to set the column Name and also enter a value.How can I dynamically pass the option choosed by the user from the drop down list to the dataProvider in seesionBean1 as a column Name???Help

Hi,
This is a working example of a search form.
In the JSP page we have several texts box, a table bound to a DataProvider with the rowSet in the SessionBean and a search button.
JSP source:
                <ui:body binding="#{PackageAirtime.body1}" id="body1">
                    <ui:form binding="#{PackageAirtime.form1}" id="form1">
                        <table border="0">
                            <tr>
                                <td>
                                    <table border="0" width="100%">
                                        <tr>
                                            <td>
                                                <ui:label binding="#{PackageAirtime.pageTitle}" id="pageTitle" text="Package Airtime"/>
                                                <br/>
                                                <br/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <table border="0" cellpadding="2" cellspacing="2">
                                                    <tr>
                                                        <td>Package ID:</td>
                                                        <td>
                                                            <ui:textField binding="#{PackageAirtime.textPackageID}"
                                                                id="textPackageID"/>
                                                            <ui:button
                                                                binding="#{PackageAirtime.buttonPackageID}" id="buttonPackageID"
                                                                onClick="handlePackageIDPopup(); return false;" text="..." toolTip="Open package locator"/>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>Airtime Code:</td>
                                                        <td>
                                                            <ui:textField binding="#{PackageAirtime.textAirtimeCode}"
                                                                id="textAirtimeCode"/>
                                                            <ui:button
                                                                action="#{PackageAirtime.buttonAirtimeCode_action}"
                                                                binding="#{PackageAirtime.buttonAirtimeCode}" id="buttonAirtimeCode"
                                                                onClick="handleAirtimeCodePopup(); return false;" text="..." toolTip="Open airtime code locator"/>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td></td>
                                                        <td>
                                                            <ui:button action="#{PackageAirtime.searchButton_action}" binding="#{PackageAirtime.searchButton}"
                                                                id="searchButton" text="Search" toolTip="Search records"/>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <br/>
                                                <ui:staticText binding="#{PackageAirtime.staticTextSearchResults}" id="staticTextSearchResults"/>
                                                <br/>
                                                <ui:table binding="#{PackageAirtime.searchResults}" id="searchResults" paginationControls="true">
                                                    <script>
/* ----- Functions for Table Preferences Panel ----- */
* Toggle the table preferences panel open or closed
function togglePreferencesPanel() {
  var table = document.getElementById("form1:table1");
  table.toggleTblePreferencesPanel();
/* ----- Functions for Filter Panel ----- */
* Return true if the filter menu has actually changed,
* so the corresponding event should be allowed to continue.
function filterMenuChanged() {
  var table = document.getElementById("form1:table1");
  return table.filterMenuChanged();
* Toggle the custom filter panel (if any) open or closed.
function toggleFilterPanel() {
  var table = document.getElementById("form1:table1");
  return table.toggleTableFilterPanel();
/* ----- Functions for Table Actions ----- */
* Initialize all rows of the table when the state
* of selected rows changes.
function initAllRows() {
  var table = document.getElementById("form1:table1");
  table.initAllRows();
* Set the selected state for the given row groups
* displayed in the table.  This functionality requires
* the 'selectId' of the tableColumn to be set.
* @param rowGroupId HTML element id of the tableRowGroup component
* @param selected Flag indicating whether components should be selected
function selectGroupRows(rowGroupId, selected) {
  var table = document.getElementById("form1:table1");
  table.selectGroupRows(rowGroupId, selected);
* Disable all table actions if no rows have been selected.
function disableActions() {
  // Determine whether any rows are currently selected
  var table = document.getElementById("form1:table1");
  var disabled = (table.getAllSelectedRowsCount()>0)?false : true;
  // Set disabled state for top actions
  document.getElementById("form1:table1:tableActionsTop:deleteTop").setDisabled(disabled);
  // Set disabled state for bottom actions
  document.getElementById("form1:table1:tableActionsBottom:deleteBottom").setDisabled(disabled);
}</script>
                                                    <f:facet name="title">
                                                        <ui:staticText binding="#{PackageAirtime.table1Title}" id="table1Title" text="Package Airtime search results"/>
                                                    </f:facet>
                                                    <ui:tableRowGroup binding="#{PackageAirtime.tableRowGroup1}"
                                                        emptyDataMsg="No records matching the search criteria" id="tableRowGroup1"
                                                        sourceData="#{PackageAirtime.s23_package_airtimeDataProvider}" sourceVar="currentRow">
                                                        <ui:tableColumn binding="#{PackageAirtime.tableColumn1}" headerText="Package ID" id="tableColumn1" sort="S23_PACKAGE">
                                                            <ui:staticText binding="#{PackageAirtime.staticText1}" id="staticText1" text="#{currentRow.value['S23_PACKAGE']}"/>
                                                        </ui:tableColumn>
                                                        <ui:tableColumn binding="#{PackageAirtime.tableColumn2}" headerText="Airtime Code" id="tableColumn2" sort="S23_AT_CODE">
                                                            <ui:staticText binding="#{PackageAirtime.staticText2}" id="staticText2" text="#{currentRow.value['S23_AT_CODE']}"/>
                                                        </ui:tableColumn>
                                                        <ui:tableColumn binding="#{PackageAirtime.tableColumn7}" headerText="Prepaid Value" id="tableColumn7">
                                                            <ui:staticText binding="#{PackageAirtime.staticText6}" id="staticText6" text="#{currentRow.value['SUBR_AT_PREPAID_PERIOD_VAL']}"/>
                                                        </ui:tableColumn>
                                                        <ui:tableColumn binding="#{PackageAirtime.tableColumn8}" headerText="Prepaid Type" id="tableColumn8">
                                                            <ui:staticText binding="#{PackageAirtime.staticText7}" id="staticText7" text="#{currentRow.value['SUBR_AT_PREPAID_TYPE']}"/>
                                                        </ui:tableColumn>
                                                        <ui:tableColumn binding="#{PackageAirtime.tableColumn4}" headerText="Start" id="tableColumn4" sort="PRSM_PK_START">
                                                            <ui:staticText binding="#{PackageAirtime.staticText3}" id="staticText3" text="#{currentRow.value['PRSM_PK_START']}"/>
                                                        </ui:tableColumn>
                                                        <ui:tableColumn binding="#{PackageAirtime.tableColumn5}" headerText="End" id="tableColumn5">
                                                            <ui:staticText binding="#{PackageAirtime.staticText4}" id="staticText4" text="#{currentRow.value['PRSM_PK_END']}"/>
                                                        </ui:tableColumn>
                                                        <ui:tableColumn binding="#{PackageAirtime.tableColumn6}" headerText="Units" id="tableColumn6">
                                                            <ui:staticText binding="#{PackageAirtime.staticText5}" id="staticText5" text="#{currentRow.value['PRSM_PK_UNITS']}"/>
                                                        </ui:tableColumn>
                                                        <ui:tableColumn binding="#{PackageAirtime.tableColumn9}" headerText="Carry-over limit" id="tableColumn9" valign="Top">
                                                            <ui:staticText binding="#{PackageAirtime.staticText8}" id="staticText8" text="#{currentRow.value['ROM_PLAN_CARRY_LMT']}"/>
                                                        </ui:tableColumn>
                                                        <ui:tableColumn binding="#{PackageAirtime.tableColumn3}" headerText="Details" id="tableColumn3" width="100">
                                                            <ui:hyperlink action="#{PackageAirtime.viewpackageAT_action}" binding="#{PackageAirtime.hyperlink1}"
                                                                id="hyperlink1" text="View"/>
                                                        </ui:tableColumn>
                                                    </ui:tableRowGroup>
                                                </ui:table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </ui:form>
                </ui:body>
...JAVA source:
    public void prerender() {
        search_action();
    public String search_action() {
        try {
            String command = "SELECT s23_package, s23_at_code, prsm_pk_start, prsm_pk_end,  prsm_pk_units, subr_at_prepaid_period_val,  subr_at_prepaid_type, subr_disc_type, subr_disc_rate,  subr_disc_value, subr_disc_perm,  subr_at_prepaid_bill_per_val, subr_at_prepaid_recurring,  s23_package_fwd, s23_at_code_fwd, prsm_pk_start_fwd,  subr_ppa_infinite, subr_ppa_carry_over, rom_plan_carry_lmt  FROM s23_package_airtime, ROM_23_PPLAN_COMP  where rom_23_pack_plan = s23_package";
            String where = "";
            String packageID = (String)textPackageID.getText();
            if (packageID == null) {
                packageID = "";
            packageID = packageID.replace("'", "''");
            if (packageID != "") {
                if (where != "") {
                    where += " AND ";
                where += "upper(S23_PACKAGE) LIKE upper('" + packageID + "%')";
            String airtimeCode = (String)textAirtimeCode.getText();
            if (airtimeCode == null) {
                airtimeCode = "";
            airtimeCode = airtimeCode.replace("'", "''");
            if (airtimeCode != "") {
                if (where != "") {
                    where += " AND ";
                where += " upper(S23_AT_CODE) LIKE upper('" + airtimeCode + "%')";
            if (where != "") {
                command += " AND " + where;
            this.getSessionBean1().getS23_package_airtimeRowSet().setCommand(command);
            this.staticTextSearchResults.setText(tdi.business.Utils.getRowCountMessage(s23_package_airtimeDataProvider.getRowCount()));
        catch (Exception e) {
            log("Error during search for packages airtime", e);
        return null;
    public String searchButton_action() {
        search_action();
        this.tableRowGroup1.setFirst(0);
        return "";
    }I put the search_action() call in the prerender() to have data in my table when the page is open. For a large resultset the best aproach is to let the user select some search criteria and then call the search_action() using a button (searchButton_action() ).
I've added a hyperlink column to my table, it is used to display the current record details in a new page.
I have defined in my SessionBean a getRowkey/setRowkey methods.
When the user click on a "View" hiperlink the following code is executed:
    public String viewpackageAT_action() {
        RowKey row = tableRowGroup1.getRowKey();
        this.getSessionBean1().setPackageAirtimeRowKey(row);
        return "packageairtime_details";
    }I will step over the "Page Navigation".
In the Detail Page I have the following code:
    public void init() {
       this.s23_package_airtimeDataProvider.setCursorRow(this.getSessionBean1().getPackageAirtimeRowKey());
}Now I have the detail page opened and also the DataProvider opened at the saved RowKey value.
Finally, in the SessionBean:
     * Holds value of property packageAirtimeRowKey.
    private RowKey packageAirtimeRowKey;
     * Getter for property packageAirtimeRowKey.
     * @return Value of property packageAirtimeRowKey.
    public RowKey getPackageAirtimeRowKey() {
        return this.packageAirtimeRowKey;
     * Setter for property packageAirtimeRowKey.
     * @param packageAirtimeRowKey New value of property packageAirtimeRowKey.
    public void setPackageAirtimeRowKey(RowKey packageAirtimeRowKey) {
        this.packageAirtimeRowKey = packageAirtimeRowKey;
    }Note: You should enable page navigation in the result(s) table.
That's about it :)
Hope this helps,
Catalin Florean.

Similar Messages

  • How to change recordset bahaviour to accept dynamic column names in the where clause

    Hi
    im using php-mysql and i make a recordset and i want to make the column names in the where clause to be dynamic like
    "select id,name from mytable where $tablename-$myvar";
    but when i do this my i break the recordset and it disappear
    and when i use variables from advanced recordset it only dynamic for the value of the column not for the column name
    and when i write the column name to dynamic as above by hand it truns a red exclamation mark on the server behaviour panel
    so i think the only way is to change the recordset behaviour is it? if so How to make it accept dynamic column names?
    thanks in advance.

    As bregent has already explained to you, customizing the recordset code will result in Dreamweaver no longer recognizing the server behavior. This isn't a problem, but it does mean that you need to lay out your dynamic text with the Bindings panel before making any changes. Once you have changed the recordset code, the Bindings panel will no longer recognize the recordset fields.
    Using a variable to choose a column name is quite simple, but you need to take some security measures to ensure that the value passed through the query string isn't attempting SQL injection. An effective way of doing this is to create an array of acceptable column names, and check that the value matches.
    // create array of acceptable values
    $valid = array('column_name1', 'column_name2', 'column_name3');
    // if the query string contains an acceptable column name, use it
    if (isset($_GET['colname']) && in_array($_GET['colname'], $valid)) {
      $col = $GET['colname'];
    } else {
      // set a default value if the submitted one was invalid
      $col = 'column_name1'
    You can then use $col directly in the SQL query.

  • How can I list all the column names of a table by programming?

    Hi,
    Now I want to write an function which has the following features:
    Firstly, The function was given a parameter as table name.
    Then, it will lists all the columns names of the table.
    e.g
    table: person
    ---firstName------lastName----+
           Michale               Jackson
    We can get the columns 'firstname' and 'lastName' by calling the function with table name 'person'.
    And I also wonder that where I can get reference book or any other materials?
    Thanks.
    Edited by: wenjing wang on Feb 15, 2008 6:42 AM
    Edited by: wenjing wang on Feb 15, 2008 6:57 AM

    hi,
    hope the below code helps u. Just take the headee which contains the field name and split it like below and compare it with the field name u want here 'last name'.
    here,
    'First name' will be in wt_filedata1 and remaining field names in wt_filedata2, so 'do' continues.
    c_tab must be the separator, either , or + or tab etc..
    CODE:
    read table person into wl_header index 1.
    do.
        split wl_header at c_tab into: wt_filedata1 wt_filedata2.
        if wt_filedata1 <> 'lastname'.
          cnt1 = cnt1 + 1.
          wl_header = wt_filedata2.
        else.
          exit.
        endif.
      enddo.
    Please reward if it is useful.
    regards,
    sri

  • Dynamically stating the field name in the WHERE clause

    Hello All,
    Consider the following select statement.
    SELECT kunnr INTO TABLE gt_kunnr
          FROM kna1
          FOR ALL ENTRIES IN gt_table
          WHERE kunnr = gt_table-<b>cust_id</b>.
    Suppose there is a case where I do not know the name of the internal table field
    (say, "cust_id" in the above case) with which comparison is to be done in the WHERE clause. Only at runtime that fieldname is available. So in the WHERE clause can I mention it dynamically?
    I tried using the following.
    lv_fieldname =  'cust_id'.
    SELECT kunnr INTO TABLE gt_kunnr
          FROM kna1
          FOR ALL ENTRIES IN gt_table
          WHERE kunnr = gt_table-<b>(lv_fieldname).</b>
    But this is  giving a syntax error.
    Could anyone suggest an alternate approach?
    Regards
    Indrajit.

    Hi,
    It is fine with Enterprise version but when I am trying to run the following code in Rel 4.6C, I am getting a syntax error.
    TYPES: BEGIN OF ty_wherecond,
             data(72) TYPE c,
           END OF ty_wherecond.
    DATA: gt_itab1 TYPE STANDARD TABLE OF kna1,
          gt_itab2 TYPE STANDARD TABLE OF kna1.
    DATA:  BEGIN OF gt_kunnr OCCURS 0,
                kunnr TYPE kunnr,
           END OF gt_kunnr.
    PERFORM fill_itabs TABLES gt_itab1
                              gt_itab2.
    *&      Form  fill_itabs
          text
         -->P_T_TABLE  text
    FORM fill_itabs  TABLES   p_t_table
                              pt_table_dummy.
      DATA: lv_fieldname(30)   TYPE c VALUE 'pt_table_dummy-kunnr'.
      DATA: lt_wherecond   TYPE STANDARD TABLE OF ty_wherecond,
            lt_condtab     TYPE STANDARD TABLE OF hrcond,
            ls_condtab     TYPE hrcond.
      FIELD-SYMBOLS <fs_wherecond> TYPE ty_wherecond.
      pt_table_dummy[] = p_t_table[].
      CLEAR ls_condtab.
      REFRESH: lt_wherecond[],
               lt_condtab[].
      ls_condtab-field = 'KUNNR'.
      ls_condtab-opera = 'EQ'.
      ls_condtab-low   = lv_fieldname.
      APPEND ls_condtab TO lt_condtab.
      CALL FUNCTION 'RH_DYNAMIC_WHERE_BUILD'
        EXPORTING
          dbtable         = space " can be empty
        TABLES
          condtab         = lt_condtab
          where_clause    = lt_wherecond
        EXCEPTIONS
          empty_condtab   = 01
          no_db_field     = 02
          unknown_db      = 03
          wrong_condition = 04.
      LOOP AT lt_wherecond ASSIGNING <fs_wherecond>.
        REPLACE '''' WITH '' INTO <fs_wherecond>-data.
        REPLACE '''' WITH '' INTO <fs_wherecond>-data.
      ENDLOOP.
      SELECT kunnr INTO TABLE gt_kunnr
          FROM kna1
          FOR ALL ENTRIES IN pt_table_dummy
          WHERE (lt_wherecond).
      IF sy-subrc EQ 0.
      ENDIF.
    ENDFORM.                    "fill_itabs
    The syntax error says "The WHERE condition does not refer to the FOR ALL ENTRIES table".
    Even after using the FM 'RH_DYNAMIC_WHERE_BUILD' as suggested by you, the syntax error is coming.
    Could you please suggest how to ignore this?
    Regards
    Indrajit.

  • How can I insert an aggregated column name as a string in the target table?

    I have a large source table, with almost 70 million records.  I need to pull the sum of four of the columns into another target table, but instead of having the same four target columns I just want to have two.
    So, let's take SUM(col1), SUM(col2), SUM(col3), and SUM(col4) from the source DB & insert them into the target like this:
    SOURCE_COLUMN
    | AMOUNT
    1 col1
    | SUM_AMOUNT
    2 col2
    | SUM_AMOUNT
    3 col3
    | SUM_AMOUNT
    4 col4
    | SUM_AMOUNT
    I know how to do this in four separate Data Flows using the source, an Aggregation Transformation, a Derived Column (to hard code the SOURCE_COLUMN label), and destination... but with this many records, it takes over 3 hours to run because it has to loop
    through these records four separate times instead of once.  Isn't there a way to do this with one Data Flow?  I'm thinking maybe Conditional Split?
    Any help is appreciated, thanks!

    Hi ,
      This could be achieved using UNPIVOT transformation. The below sample uses the below source query
    SELECT 1 AS COL1,2 AS COL2,3 AS COL3,4 AS COL4
    setup the UNPIVOT transformation as below
    The output of unpivot transformation will be as below
    Hope this helps.
    Best Regards Sorna

  • Dynamically Pass the Column Name cursor. || Dynamic Column Name

    Hi,
    I need to dynamically pass the column name based on a Mapping table in a loop ( Right now i have hardcoded stuff )just like using Execute immediate.... Inside the procedure, I have commented as where i hit the problem.
    Thanks for all of your time...
    Thanks
    Muthu
    CREATE OR REPLACE PROCEDURE xml_testing_clob AS
    doc xmldom.DOMDocument;
    main_node xmldom.DOMNode;
    root_node xmldom.DOMNode;
    user_node xmldom.DOMNode; item_node xmldom.DOMNode;
    root_elmt xmldom.DOMElement;
    item_elmt xmldom.DOMElement;
    item_text xmldom.DOMText;
    item_test xmldom.DOMText;
    nodelist xmldom.DOMNodeList;
    sub_variable varchar2(4000);
    x varchar2(200);
    y varchar2(200);
    sub_var varchar2(4000);
    CURSOR get_users IS
    SELECT FIRST_NAME,LAST_NAME,ROWNUM FROM USER_INFO_TBL WHERE WEIN_NUMBER = '1234' ;
    CURSOR get_cdisc_name IS
    select CTS_COL_NAME,CDISC_NAME from CTS2CDISC_DICTIONARY where CTS_TABLE_NAME = 'USER_INFO_TBL';
    BEGIN
    -- get document
    doc := xmldom.newDOMDocument;
    doc := xmldom.NewDomDocument;
    xmldom.setVersion(doc, '1.0');
    xmldom.setStandalone(doc, 'no');
    xmldom.setCharSet(doc, 'ISO-8859-1');
    -- create root element main_node := xmldom.makeNode(doc);
    root_elmt := xmldom.createElement(doc,'AdminData');
    root_node := xmldom.appendChild(main_node,xmldom.makeNode(root_elmt));
    FOR get_users_rec IN get_users LOOP
    item_elmt := xmldom.createElement(doc,'User');
    xmldom.setAttribute(item_elmt,'OID' , get_users_rec.rownum);
    user_node := xmldom.appendChild(root_node,xmldom.makeNode(item_elmt));
    FOR cv_get_cdisc_name IN get_cdisc_name LOOP
    EXIT WHEN get_cdisc_name%NOTFOUND;
    sub_var := cv_get_cdisc_name.cts_col_name;
    sub_variable := 'get_users_rec.';
    sub_variable := 'get_users_rec.'||cv_get_cdisc_name.cts_col_name;
    x := sub_variable;
    dbms_output.put_line(x); -------------- Here i just see the literal string
    y := get_users_rec.FIRST_NAME;
    dbms_output.put_line(y); -------------- Here i just see actual value ( data )
    item_elmt := xmldom.createElement(doc,cv_get_cdisc_name.cdisc_name);
    item_node := xmldom.appendChild(user_node,xmldom.makeNode(item_elmt));
    item_text := xmldom.createTextNode(doc,x ); ---- This is the place i am hitting with an error .
    If i use variable X then i am able to see only the literal
    string in the output. BUT if i put cursor name.coulmname,
    then the resumt (XML) is fine.I wanted acheive this
    dynamically just like execute Immediate
    item_node := xmldom.appendChild( item_node , xmldom.makeNode(item_text));
    END LOOP;
    END LOOP;
    -- write document to file using default character set from database
    xmldom.WRITETOCLOB(doc,);
    xmldom.writeToFile(doc, 'c:\ash\testing_out.xml');
    -- free resources
    xmldom.freeDocument(doc);
    END;
    +++++++++++++++++++++++++++++++++++ XML OUTPUT +++++++++++++++++++++++++++++++++++++++++
    <?xml version="1.0" ?>
    - <AdminData>
    - <User OID="1">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName> </User>
    - <User OID="2">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName>
    </User>
    - <User OID="3">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName>
    </User>
    - <User OID="4">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName>
    </User>
    - <User OID="5">
    <FirstName>get_users_rec.FIRST_NAME</FirstName>
    <LastName>get_users_rec.LAST_NAME</LastName>
    </User>
    ++++++++++++++++++++++++++++++++++++++++++++++++++++ MAPPING TABLE DETAILS +++++++++++++++++
    CTS_COL_NAME     CDISC_NAME     CTS_TABLE_NAME     XML_TAG     -----------> Column Name
    FIRST_NAME     FirstName     USER_INFO_TBL     Element     -----------> Records
    LAST_NAME     LastName     USER_INFO_TBL     Element     -----------> Records

    My scenario is little different, let me explain:
    My columns will remain same but values changes (based on column formula) according to the selected prompt value
    If I select 'Oct' from prompt then
    Curr will contain data for 'Oct' only
    Next1 will contain data for 'Nov' only
    Next2 will contain data for 'Dec' only
    Next3 will contain data for 'Jan' of next year only.
    Later if I select 'Jul' from prompt then
    Curr will contain data for 'Jul' only
    Next1 will contain data for 'Aug' only
    Next2 will contain data for 'Sep' only
    Next3 will contain data for 'Oct' only.
    I don't have different columns for each months but the columns are capable to reflect data for any month.
    So, how can I reflect the column name as month name for which that contains data.
    Regards,
    S Anand

  • How to use a value as column name in Triggers?

    Hello All!!!!!
    How can i use a column value instead of field name in triggers? e.g. table X has one column and having following data.
    COL1*
    Id
    Name
    Contact No.
    now in triggers i want to use "Id" instead of :new.id, is it possible?
    Any solution?

    actually i am trying to write a trigger on lets say Table2 and i dont want to specify the column name in the trigger.
    CREATE OR REPLACE TRIGGER TR_AIUDR_002
    AFTER UPDATE
    ON mytable
    FOR EACH ROW
    DECLARE
    CURSOR C IS
    SELECT * FROM t_table_columns;
    BEGIN
    IF UPDATING then
    FOR I IN C LOOP
    IF *:new.column_name <> :OLD.column_name* THEN
    insert into....
    END IF;
    END LOOP;
    END IF;
    END TR_AIUDR_002;
    instead of :new.column_name <> :old.column_name i want to compare on the base of loop column
    Edited by: rha2 on Jan 31, 2009 7:04 PM

  • How to Select data using same column name from 3 remote database

    Hi,
    Can anyone help me on how to get data with same column names from 3 remote database and a single alias.
    Ex.
    SELECT *
    a.name, b.status, SUM(b.qty) qantity, MAX(b.date) date_as_of
    FROM
    *((table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)a,*
    *(table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)b)*
    WHERE b.dept = 'finance'
    AND a.position = 'admin'
    AND a.latest = 'Y' AND (b.status <> 'TRM') AND b.qty > 0;
    GROUP BY a.name, b.status ;
    NOTE: the bold statements is just an example of what I want to do but I always gets an error beacause of ambiguous columns.
    Thanks in advnce. :)
    Edited by: user12994685 on Jan 4, 2011 9:42 PM

    user12994685 wrote:
    Can anyone help me on how to get data with same column names from 3 remote database and a single alias.Invalid. This does not make sense and breaks all scope resolution rules. And whether this is in a single database, or uses tables across databases, is irrelevant.
    Each object must be uniquely identified. So you cannot do this:
    select * from (table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) a3 objects cannot share the same alias. Example:
    SQL> select * from (dual, dual) d;
    select * from (dual, dual) d
    ERROR at line 1:
    ORA-00907: missing right parenthesisYou need to combine the objects - using a join or union or similar. So it will need to be done as follows:
    SQL> select * from (select * from dual d1, dual d2) d;
    select * from (select * from dual d1, dual d2) d
    ERROR at line 1:
    ORA-00918: column ambiguously definedHowever, we need to have unique column names in a SQL projection - so the join of the tables need to project a unique set of columns. Thus:
    SQL> select * from (select d1.dummy as dummy1, d2.dummy as dummy2 from dual d1, dual d2) d;
    DUM DUM
    X   X
    SQL> I suggest that you look closely at what scope is and how it applies in the SQL language - and ignore whether the objects referenced are local or remote as it has no impact to fundamentals of scope resolution.

  • How can I add new row/column into existing jTable?

    Hi add!
    Can you help me how can I add new row/column into existing jTable?
    Tnx in adv!

    e.g
    Create two buttons inside the Table ( "Add New Row" ) and ("Add new Column")
    their handlers are:
    add new row:
    //i supose u already have
    DefaultTabelModel tablemodel = new DefaultTableModel(rowdata, columnNames);
    //and   
       JTabel jtable = new JTable(tablemodel);
    // Handler (row)
    jbtAddRow.addActionListener(new ActionListener(){
       public void actionPerformed(ActionEvent e) {
          if(jtable.getSelectedRow() >= 0 )
              tablemodel.insertRow(jtable.getSelectedRow(), new java.util.Vector());  
           else  
                tablemodel.addRow(new java.util.Vector());
        });to add new columns its the same but inside actionPerformed method:
    ask for e.g "Whats the name for the new column"
    then,
       tablemodel.addColumn(nameOfColumn, new java.util.Vector());   Joao
    Message was edited by:
    Java__Estudante

  • How can i dynamically assign values to the tld file

    How can i dynamically assign values to the tld file

    In the tld you write for the tag handler mention the following sub tags in the attribute
    <attribute>
    <name>xyz</name>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    import the packagejavax.servlet.jsp.tagext.DynammicAttributes;
    add the method
    public void setDynamicAttribute(String rui, String localname, Object value) throws JspException
    <Your Required task>
    Its better if you SimpleTagSupport class to be extended.

  • How can I edit the SamAccountName column from the list or be able to edit it?

    Hello,
    In my view for a SharePoint list, I see three columns for SamAccountName.  This list is for listing staff as a directory, so there are phone numbers, names, emails addresses, division, department and such.  The  SamAccountName
    column for some people has incorrect username or is blank.  When I edit a record in the list, the SamAccountName column is not available to edit. 
    How can I edit the SamAccountName column from the list or be able to edit it?
    I do have user profiles working and importing profiles from AD, but the list still shows empty or incorrect SamAccountName for some records.
    Paul

    If the user does not remember the encryption password there is no way to use the backup.
    The password cannot be removed or reset.
    Delete the backup, restore as new.  Sync the desired content to the device.

  • How can find  database field and table name

    how can find the underline database field name,table name from java page. Example. in oracle apps when we go purchaseing super user then supplier base then supplier and find supplier detail .

    Hi,
    depends on your model. If you work with ADF BC then you can use ViewLinks to access parent or detail infromation programmatically. See the developer guides for more information. Note that you wont access the tables directly but the collections that represent the records
    Frank

  • How can I display all the columns on the screen without scrolling from side to side?

    My clinic software has many columns. How can I display all the columns without having to scroll from left to right all the time?

    If the software you are using doesn't offer the ability to increase or decrease document size, as many do, then the only way is to increase your screen resolution. If that's not possible, maybe you can decrease your font size?  If you can't do any of these, I think you're out of luck!

  • HT204053 I have an iCloud account on my Mac which has a different account name to that on my iPhone. How can I change the Mac account name to that on the iPhone?

    Hi,
    I have an iCloud account on my Mac which has a different account name to the iCloud account on my iPhone. How can I change the Mac account name to match the iPhone one? Kuranda.

    You can't change it in one step. Sign out of the one now on the Mac, sign onto the right one.

  • I have a problem with mail autofilling info email addresses. Emails sent to me the from looks like this: Holiday in the United States email address . I have no idea what this Holiday in the United States is...How can I fix/change to my name?

    I have an irritating problem with mail autofilling info in email addresses. Emails sent to me the from looks like this: Holiday in the United States <my email address>. I have no idea what this Holiday in the United States is or how it got to be there...How can I fix/change to my name?
    I fixed the To: autofilling incorrectly by deleting my email address from the Previous Recipients List, but is there a way to stop that from coming up on emails that I receive?

    Have you checked your Mac address book? If your email is saved somewhere in your address book with the name "Holidays in the United States" it might be adding the name automatically in Mac Mail.
    Alternatively, try this:
    Delete an Email Address from Auto-Complete in Mac OS X Mail
    To remove an email address from the auto-complete list in Mac OS X Mail:
    Start typing the recipient's address or name in a new message.
    Select the desired address from the auto-complete list as if you'd compose an email to them.
    Click the small down arrow in the recipient.
    Select Remove from Previous Recipients List from the menu.
    You can also search for the unwanted address directly in the previous recipients list:
    Select Window | Previous Recipients from the menu in Mac OS X Mail.
    Highlight the address you want to remove.You can highlight multiple addresses by holding down the Command key.
    Click Remove from List.
    Source: About.com

Maybe you are looking for

  • Bar code3 in alv

    hi, i need to display barcode in alv report  how to do this, pls provide sample code. regards, jai

  • How to configure mail for multiple domains

    Hi There: I am the only Admin for a Mac Mini Lion Server, I have 3 Domains that I host, the DNS is done separate along with all records. I was able to get the Web Sites up and running. I need help to set up Separate E-Mail Accounts for each Domain, s

  • IWork 09 Family Pack

    What is the difference between iWork 09 and the iWork 09 Family Pack?

  • Startup Disk Full- Suspicious Files

    I am running the latest of OSX Server. The startup disk was getting abnormally full. I audited the drive and found that the downloads folder in >Library>Server>Software Updates> Data is taking up a significant amount of space. (74.xx gb) These files

  • Help and Information with Wine Package Arch64

    Hello, Sorry if i put this in the wrong area or anything like, i'm new on Arch and on this forum and sorry about my poor english, i'm from Brazil,english it's not my native language I'm using Arch for 2 days, i was a Debian user, actually, i'm still