Problem - Creating a Dynamic LOV using duplicate value in select statement

I am trying to create a Dynamic LOV by attempting to follow a pattern similar to the following:
select shop_name d, shop_id r
from shops
order by 1
However, I want to use the shop_name twice as in the following because I do not have any other unique identifier available such as a shop_id to associate with the shop name:
select shop_name d, shop_name r
from shops
order by 1
But I get an error where I am not allowed to duplicate the shop_name in the select statement. I read somewhere on this forum where it can be done but I can't find exactly how.
Can someone tell or show me how to accomplish this?
Thanks in anticipation for your answer.
Thanks,
Ric

Ric,
I just tried to do this on APEX 3.0, and it worked just fine with this SQL:
select ename d, ename r from emp order by 1Perhaps you could put an example on apex.oracle.com or specify the error message that you're getting.
So as long as you have uniquely aliased both columns, this should not present a problem.
Thanks,
- Scott -

Similar Messages

  • DYNAMIC LOV (list of value)

    Hi all,
    I have created a dynamic LOV using the sql statement:
    Select product_name A, product_code B from product.
    Can I make this LOV more dynamic by putting where conditions?
    For example:
    Select product_name A, product_code B from product where status = &STATUS
    &STATUS is a value from a given field as entered in a current form page.
    Is this possible? or are there other ways to to this?
    Thanks

    wow thats great sunil : )
    Can I also reference the value of P7_ITEM_NAME in anotheR item name like P7_COMMISSION?
    For example: I have two (2) item names: P7_SALARY and P7_COMMISSION
    P7_COMMISSION is computed as :P7_SALARY * 0.10
    So I do not have to enter value in the item name P7_COMMISSION as it is derived from P7_SALARY.
    Is this possible? if not why does LOV able to access it ; )
    Thanks a lot

  • Creating a dynamic lov based on a column

    Hi,
    I want to create a dynamic lov based on a column in a database-table.
    Eg. the query
    'select code, description from code_table'
    is the contents of the column 'lov_query' in the table 'parameters'.
    For every parameter there can be a different lov-query, but the result is always
    two columns (code and description, number and name, etc.), exactly what you need to use in a lov.
    I've written a (dbms_sql) function that takes the parameter-id and returns the lov_query.
    create or replace function "GET_PMR_LOV"
    (pmr_id in NUMBER)
    return VARCHAR2
    is
    cur INTEGER := DBMS_SQL.OPEN_CURSOR;
    fdbk INTEGER;
    l_pmr_id NUMBER(9) := pmr_id;
    l_stmnt VARCHAR2(2000);
    begin
    DBMS_SQL.PARSE
    (cur, 'select pmr.lov_query from parameters pmr where pmr.ID ' || ' = 'L_PMR_ID', DBMS_SQL.NATIVE);
    DBMS_SQL.BIND_VARIABLE (cur, 'L_PMR_ID', l_pmr_id);
    DBMS_SQL.DEFINE_COLUMN (cur, 1, l_stmnt, 2000);
    fdbk := DBMS_SQL.EXECUTE (cur);
    fdbk := DBMS_SQL.FETCH_ROWS (cur);
    IF fdbk > 0
    THEN
    DBMS_SQL.COLUMN_VALUE (cur, 1, l_stmnt);
    return (l_stmnt);
    ELSE     
    return null;
    END IF;
    DBMS_SQL.CLOSE_CURSOR (cur);
    END;
    But now I'm stuck on how to pass on this statement in HTMLDB
    as an dynamic lov, I don't seem to be able to execute this statement
    into the two display and return columns. Any ideas?

    Hello again,
    This lov is on an updatable report-column where the user has to make a choice from an non-named, popup and query-based lov. In the lov-query box I have just put:
    "return get_pmr_lov(:p41_param_id)" (without the quotes ;-)
    Here's my latest version plus an alternative, which both seem to work fine:
    create or replace function "GET_PMR_LOV"
    (pmr_id in NUMBER)
    return VARCHAR2
    is
    cur INTEGER := DBMS_SQL.OPEN_CURSOR;
    fdbk INTEGER;
    l_pmr_id NUMBER(9) := pmr_id;
    l_stmnt VARCHAR2(1000);
    begin
    DBMS_SQL.PARSE (cur, 'select pmr.lov_query from paramaters pmr where pmr.ID ' || '= :L_PMR_ID', DBMS_SQL.NATIVE);
    DBMS_SQL.BIND_VARIABLE (cur, 'L_PMR_ID', l_pmr_id);
    DBMS_SQL.DEFINE_COLUMN (cur, 1, l_stmnt, 1000);
    fdbk := DBMS_SQL.EXECUTE (cur);
    fdbk := DBMS_SQL.FETCH_ROWS (cur);
    IF fdbk > 0 THEN
    DBMS_SQL.COLUMN_VALUE (cur, 1, l_stmnt);
    return (l_stmnt);
    ELSE
    return null;
    END IF;
    DBMS_SQL.CLOSE_CURSOR (cur);
    END;
    create or replace function "GET_PMR_LOV2"
    (pmr_id in NUMBER)
    return VARCHAR2
    is
    l_pmr_id NUMBER(9) := pmr_id;
    l_stmnt VARCHAR2(1000);
    BEGIN
    EXECUTE IMMEDIATE 'select pmr.lov_query from parameters pmr where pmr.ID = :1'
    INTO l_stmnt USING l_pmr_id;
    return l_stmnt;
    END;
    The error-message remains the same, unable to bind :p41_param_id !

  • How to make dynamic actions using Set Value work in all browsers?

    I’m having a cross-browser incompatibility issue with dynamic actions using Set Value.  The dynamic action works like a charm on Chrome but has no effect on either IE or Firefox.  The code in oracle.apex.com and here are the credentials:
    Workspace: DDBA
    Username: [email protected]
    Password: redtruck12
    These code is on page 3 and here are the details:
    There are two report lists (Standard and Special) and some of the reports require additional information supplied in either select lists or text boxes.
    If the user selects a Standard report requiring a select list/text box, then the dynamic action sets the value of Special Reports to NULL (and vice-versa).
    The dynamic action is to prevent a simultaneous selection of both the Standard and Special reports.  To see how it works on Chrome, do this:
    Run Page 3
    Select the ‘Report for Search Criteria’ option from the Standard Report list.  A ‘Search Criteria’ text box appears
    Select the ‘Report by Release’ option from the Special Reports list.  A select list appears and the ‘Search Criteria’ text box disappears.
    If you do the same things on IE or Firefox, the text box does not disappear. 

    Hi,
    Things are going wrong with setting the item values to NULL. If you check your session state, you'll see that in chrome your items values indeed will be set to null, but in firefox they won't.
    Also I've noticed that you don't reset the other input fields, so their values persist in the session state. Since you submit your page every time you change one of the report select lists, this might lead to unexpected behaviour. Lastly, I've noticed you use a sql exists expression to manage the display/hide of your page items. A condition of type "Value of  expression 1 = expression 2" causes less overhead as you don't need to switch to the db sql engine for every item to validate.
    I'd suggest you rethink your specs and try to create:
    - One dynamic action (since a value of standard select excludes the value of special select, and vice versa)
    - Set the values for hidden items to null, also in session state
    - Use a refresh of region as extra event in your dynamic action, instead of submitting your page for every change.
    Regards,
    Vincent
    http://vincentdeelen.blogspot.com

  • Creating a dynamic jtree using datas retrieved by dom in xml parsing

    help me with code to create a dynamic jtree using data retrieved as nodes by xml parsing using dom

    Ok, so you want to make a tree. To determine the data that appears in a tree, you have to make a custom tree model. The API for this is at :
    http://java.sun.com/j2se/1.4.2/docs/api/
    A tutorial for using trees is at :
    http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
    I assume you are going to be using Nodes, since you are using XML. For this I might start with something like
    class NodeTreeModel implements TreeModelI would then implement the 'getChildCount()' as the number of subnodes a node has, and the value of a tree node to the nodes value.
    Hope that starts you off.

  • How to create a dynamic newsflash using dreamweaver and PHP

    Hi there,
       I would like to create a dynamic newsflash using dreamweaver and PHP in that the newsflash will be pulling information from a MySQL database. The newsflash should also have a link to view more information about the piece of news a user wants to know more about. Which tools do I need to use in dreamweaver and how's the procedure to go about that. Any advice is highly appreciated. Thanx in advance!

    I think you´ll need at least a MySQL table with the following columns:
    - id (primary key, int, auto_increment etc)
    - news_headline (varchar)
    - news_teaser (text)
    - news_content (text)
    What I´d personally add are columns such as:
    - news_date (date or datetime)
    - news_external_link (varchar), if a "read more..." link is supposed to navigate to an external URL rather than displaying the contens of the "news_contents" column.
    Based on such a MySQL table it should be easy to use Dreamweavers standard Server Behaviors to create the usual datalist.php, insert.php, update.php and delete.php documents, and there are numerous tutorials out there which will teach you how to do that.
    Am I right when assuming that you´ll also need to know how to automatically pull, say, the 5 most recent news records from the database ?

  • How to create standby database by using duplicate

    Dear all,
    How to create standby database by using duplicate,is there some doc to read?

    Hi;
    You can use
    Step-By-Step Guide To Create Physical Standby On Normal File System For ASM Primary using RMAN [ID 838828.1]
    Creating Physical Standby using RMAN Duplicate Without Shutting down The Primary [ID 789370.1]
    Also use goole, there are many blog-site-dogs mention that topic. From googling:
    Creating a Standby Database with Recovery Manager
    http://docs.oracle.com/cd/B19306_01/backup.102/b14191/rcmdupdb.htm
    http://www.pythian.com/news/248/recipes-for-creating-a-managed-standby-with-rman/
    http://docs.oracle.com/cd/B19306_01/server.102/b14239/rcmbackp.htm
    Regard
    Helios

  • I need to know how I will create a dynamic website using php and mysql

    I need to know how will I create a dynamic website using php and mysql that people could have the abilities of registering in the website, and modify their profile where they can add their pictures and everything. apart from that, they should have the ability to search about other member. hope to here more from you.

    If you are a right-brained creative, and have no previous experience or propensity to be able to understand coding and database "stuff", and/or if your time can be better spent on other skills, I recommend you save your sanity and hire a developer... or at least the first time around. I have been attempting to grasp this for years... and have a library of marked up books to prove my efforts, all while trying to keep up with an ongoing client base that is always cramped. It's a wonder I still have my sanity... then again, I might not be the best person to determine that. Others might question it.
    That said, I still plan to master php... one of these days.

  • How to use SET ID in select statement of SQ02

    Hi,
    I have a infoset, where for one of my Zfield, i have writen a select statement in order to get my ouput.
    if aufk-aufnr = 'XYZ'.
      select sum( FKBTR ) from fmifiit into zfmifiit
      where fikrs = aufk-kokrs
      and fipex IN capex
      and wrttp NE '51'.
    endif.
    For the above statement, i have created (with 10 single values, table name FMCI, field name FIPEX)  a SET id named CAPEX and used with IN operator.
    But when i generating the infoset i am getting error like below
    The IN operator with "CAPEX" is followed neither by an internal table nor by a value list
    I was using IN opeartor for set ids during validation / substitutions, where if i have to validate multiple single values.
    What to do here?
    Regards,
    Srinu

    [OPEN-SQL|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_GENERAL.htm] set of statement, [SELECT|http://help.sap.com/abapdocu_70/en/ABAPWHERE.htm] statement, [WHERE|http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP.htm] addition requires a selection table (type range, [WHERE - IN seltab |http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_SELTAB.htm]) of parameter and not a set. We are in Abap here, not in a Customizing screen
    You have to convert the set to a selection table in an ABAP coding before using it in a SELECT statement.
    (Check FM like G_SET_TREE_IMPORT to import definition of set (values and intervals) and map them to a select-table, or ask a developper to perform it, look at G_SET_TREE_IMPORT -> select statement)
    Regards,
    Raymond

  • Error by using database procedure in select statement

    hi ,
    I have built a database procedure having one parameter with in out varchar type. that return value with some addition.
    i am using it with some column in select statement only for display purpuses but i am facing error by doing that in select statement. that procedure is working well with bind variable but not with select statement.
    plz help me how i can use a procedure in select statement. or can i do it or not.

    plz help me how i can use a procedure in select statement. or can i do it or not.A workaround could be to create a wrapper function for your procedure. One that only passes the input parameters and returns the output parameter.
    The simply call this function in your select which internally calls the procedure.

  • Using plsql tables in select statement of report query

    Hi
    Anyone have experience to use plsql table to select statement to create a report. In otherwords, How to run report using flat file (xx.txt) information like 10 records in flat files and use this 10 records to the report and run pdf files.
    thanks in advance
    suresh

    hi,
    u can use the utl_file package to do that using a ref cursor query in the data model and u can have this code to read data from a flat file
    declare
    ur_file utl_file.file_type;
    my_result varchar2(250);
    begin
    ur_file := UTL_FILE.FOPEN ('&directory', '&filename', 'r') ;
    utl_file.get_line(ur_file, my_result);
    dbms_output.put_line(my_result);
    utl_file.fclose(ur_file);
    end;
    make sure u have an entry in ur init.ora saying that your
    utl_file_dir = '\your directory where ur files reside'
    cheers!
    [email protected]

  • Using java function in select statement

    Hi,
    I am trying to use java function in select statement.
    public class ClassA{
         private static String MyConst = "foo";
         public static String functionA(){
              return MyConst;
    in my query I have:
    select
         ClassA.functionA() AS id,
         groupId AS newID,
    from
         myChannel[now]
    ClassA is part of the application (no need to import).
    I get and error of Invalid Expression on ClassA.functionA().
    I also tried to declare the function in the processor element:
    <wlevs:processor id="proc">
         <wlevs:function function-name="A" exec-methode="functionA">
              <bean class="mtPackage.ClassA"/>
         </wlevs:function>
    <wlevs:processor>
    but then I get a different error in the processor XML file:  "An InvocationTargetException was encoutered while attemting to register the user defind function A. The message was null"
    What am I missing here?

    Hi,
    From the above description, you have tried two manners to call method functionA() in the user defined  class ClassA. One uses java cartridge manner directly and the other try to use user defined function manner.
    For the java cartridge manner, the following CQL query should work if the ClassA is really included in the OEP app. I have done similar test before, it works.
    select
         ClassA.functionA() AS id,
         groupId AS newID,
    from
         myChannel[now]
    For user defined function manner, I think two things you need to change:
    1. Need to declare the function in the EPN assembly file(under META-INF/spring/), not component configuration file(under META-INF/wlevs/). The following is an example:
    <wlevs:processor id="proc">
         <wlevs:function function-name="A" exec-methode="functionA">
              <bean class="mtPackage.ClassA"/>
         </wlevs:function>
    </wlevs:processor>
    2. Call the user defined function in the CQL query in the component configuration file under processor. For example:
    select A() from myChannel
    Regards,
    XiYing

  • Problem in getting dynamic LOV

    hi i am trying to acheive dynamic LOV.
    i followed the steps
    1.created a static record group
    2.created a LOV and assigned with the above created static record group.
    3.in w-n-b-i trying to create the DRG
    DECLARE
       rg_id    RECORDGROUP;
       grp_col  GROUPCOLUMN;
       rg_name  VARCHAR2(25) := 'RG_NAME';
       col_name VARCHAR2(25) := 'TYPE';
       lov_id   LOV;
    BEGIN
       /* Check if the RG already exists */
       rg_id := Find_Group(rg_name);
       IF ( NOT Id_Null(rg_id) ) THEN
          Delete_Group(rg_id);
       END IF;
       /* Create instance of DRG */
       rg_id := Create_Group(rg_name);
       grp_col := Add_Group_Column(rg_id, col_name, CHAR_COLUMN, 8);
       /* Assign the DRG to the LOV */
    lov_id := Find_Lov('TYPE_LOV');
       Set_Lov_Property(lov_id, GROUP_NAME, rg_name);
    END;4.in w-v-i of type
    DECLARE
       rg_id   RECORDGROUP;
       grp_col   GROUPCOLUMN;
       tmp_gc  GROUPCOLUMN;
       rg_name   VARCHAR2(25) := 'RG_TYPE';
       col_name   VARCHAR2(25) := rg_name||'.'||'TYPE';
       n_dummy1  NUMBER;
       n_dummy2  NUMBER;
       curr_rec   INTEGER;
       err_code  NUMBER;
    BEGIN
       curr_rec := Get_Block_Property(Name_In('SYSTEM.TRIGGER_BLOCK'), CURRENT_RECORD);
       rg_id := Find_Group(rg_name);
       grp_col := Find_Column(col_name);
       /* Add the value to the DRG */
       -- Add row first./*
       Add_Group_Row(rg_id, END_OF_GROUP);
       -- Now add the value.
       Set_Group_Number_Cell(grp_col, curr_rec, To_Number(:BMM_DESC));
       /* Verify the value was added */
       n_dummy1 := Get_Group_Row_Count(rg_name);
       tmp_gc := Find_Column(col_name);
       FOR j IN 1..n_dummy1 LOOP
          n_dummy2 := Get_Group_Number_Cell(tmp_gc, j);
          IF ( nvl(n_dummy2, 9999999999) = 9999999999 ) THEN
             Clear_Message;
             Message('Add Failed');
             Message('Add Failed');
          ELSE
             err_code := Populate_Group(rg_id);
             Clear_Message;
             Message('Add Successful');
          END IF;
       END LOOP;
          MESSAGE('FIRING');MESSAGE('FIRING');
    END;the problem is the lov is not appearing at all(previously the lov was appearing along with the static value assigned)
    when i tried to add value to the item(type), i am getting the following error:
    FRM-40735 WHEN-VALIDATE-ITEM trigger raised unhandled exception ora-06502
    i am getting pop up message-error in adding group row
    i have not done this before. in the help of some contents which is present in the fourm, i have tried it.
    where i am missing?
    Please help

    there seems to be problem with the item type, varchar2 or numeric whatever. check that.

  • JPQL: problem creating it dynamically

    I am building a JPQL String dynamically such that the entity requested and the criteria for the search will determine what the JPQL String will be. Example is like this
            BaseQueryBuilder builder = new AnnuityPolicyQueryBuilder();
            builder.setSexCd("M");
            builder.setLastName("a", WCString.LIKE);
            builder.setStatus("I");this piece of code should create a Query object with the JPQL string
    SELECT o FROM AnnuityPolicy o WHERE o.status = :status AND o.lastName LIKE :lastName AND o.sexCd = :sexCdwhen I begin to dynamically set the parameter, an IllegalArgumentException is thrown like this:
    Exception in thread "main" java.lang.IllegalArgumentException: You have attempted to set a parameter value using a name of :sexCd that does not exist in the query string SELECT o FROM AnnuityPolicy o WHERE o.status = :status AND o.lastName LIKE :lastName AND o.sexCd = :sexCd.
            at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.setParameterInternal(EJBQueryImpl.java:614)
            at oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.setParameter(EJBQueryImpl.java:161)
            at com.leadway.util.eao.QueryBuilderUtil.buildQuery(QueryBuilderUtil.java:77)
            at com.mck.practical.eao.test.AnnuityPolicyEAO.findPolicies(AnnuityPolicyEAO.java:61)what could be wrong with this design. If I copy the same JPQ into the createQuery() method, it works fine and smooth.
    Regards,
    Michael

    There should be no need for you to access the internals of the EnityManager to have a query parsed correctly. It should just work as is. Can you please provide the snipit of code that sets the parameter. Based on the exception you are getting it appears that James' suggestion is the problem. Please verify that you are calling setParameter("_*sexCd*_", Object) and not setParameter("_*:sexCd*_", Object);
    If you are sure that you are not including the colon ( _:_ ) when setting the parameter verify, if you are using named queries, that the query you are getting is the query you expect.
    If these prove to not be the problem and you are sure it is an activeSession issue can you provide information on your application and the state of the EM. Are you using containerManaged Entity Managers or Application Managed. Is your application in a container or Java SE? Is the EM in a transaction?
    --Gordon ( www.eclipselink.org )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to populate LOV using Runtime values

    Hi!!
    I am using jdeveloper 11.1.1.5
    I had created GlJrnlHd VO as a af:form and GlJrnlLnVO as a af:table I had also created a viewlink between TwoTable
    I have an LOV in GlJrnlLnVO [GjlAcct] When my user clicks the Lov the values in the LOV must be shown using the below queryy
    select * from gllvlacct where glalplant = :plant [This plant must be get from the Runtime i.e., Plant of GlJrnlHd]
    How can i acheive this.,

    Hari,
    There is something not clear in your use case.
    >
    I have an LOV in GlJrnlLnVO [GjlAcct] When my user clicks the Lov the values in the LOV must be shown using the below queryy
    select * from gllvlacct where glalplant = :plant [This plant must be get from the Runtime i.e., Plant of GlJrnlHd]
    >
    Do you mean that once the user try to select from LOV, it should be filtered based on :plant value?
    Does :plant value comes from an attribute in the current row?
    Do you want to change the values in LOV once the :plant value have changed?
    Are you asking about cascade LOV?
    Edited by: M.Jabr on Jan 12, 2012 8:44 AM

Maybe you are looking for

  • CS3 Won't Run, Uninstall or Deactivate, Can't Reinstall; Junked.

    Windows XP Pro SP2 2GB Ram Adobe CS3 Production Premium Thanks to Adobe's new licensing system I have a $1700 production suite that is completely useless. After a few weeks of working fine, it suddenly decided, for reasons unknown, to cease working.

  • Work item [item number] cannot be executed

    Hi all, I am having a problem with a workflow. I am emailing a url to a supervisor to approve or reject a training request. When I access the url in internet explorer I get a pop up message with the error, "Work item [item number] cannot be executed.

  • How Export option in Apps menu work?

    Hi All We have standard export option (File -> Export) in 11i oracle applications to download records from tabular block to spread sheet. Now in one worksheet we can store around 60000 rows. In case our query fetches more than 70000 records, and we e

  • DataGrid scrolling issue

    Hi again, Using Beta 3. I've got a datagrid control with a series of data elements on it. When the user selects an item in the grid, I have a canvas that I show over the bottom third of the grid that gives details about the selected item. The problem

  • Options missing from Properties window for smart shape

    I feel really stupid. I recently updated my Captivate 8 to 8.0.1.242 and now I can't figure out how to change the color of my smart shapes. I don't see the fill or stroke settings. Is there somewhere new I should be looking? Shouldn't they be under t