NamedQuery problem- single argument compared to multiple columns

Hello,
I'm not sure if this issue is a bug or if I'm misinterpreting the API. I'm trying to execute a text search query against multiple columns in the same table via EJB 3.0, e.g.
select object(o) from Location o where o.city LIKE :searchString OR o.county LIKE :searchString"So, a single text argument is compared to multiple fields- but I keep getting an exception that the number of supplied arguments (one) does not match the number of required arguments (one- even though it's ID is referenced twice). Is there a separate syntax for repeating arguments in EQL (EJB 3.0, JDeveloper 10.1.3)? Is it not supported?
I get around the issue by just specifying a Query at runtime, but I'd prefer --if possible-- to create a NamedQuery instead.
Any help would be appreciated. Take care.

Should the EJBQL statement be
select object(o) from Location o where o.city LIKE :?1 OR o.county LIKE :?2

Similar Messages

  • Displaying single value (Record) into multiple columns

    Hi All,
    I want to display the single record into multiple columns. Please let me know How to achieve this..
    Record:
    Lvl Activity Acre
    6 Week 4 (Same value to be displayed into 3 columns.)
    REquired output:
    lvl Activity PH1 PH2 PH3
    6 Week 4 4 4
    Thanks
    Kavi

    user533671 wrote:
    Hi,
    Thanks for immediate reply.
    PH1, PH2, PH3, ... will go more columns based on parameter , what we are passing.An single SQL statement cannot have a dynamic number of columns based on the data itself. The projection (columns returned) have to be known before any data is fetched... and that includes some 'parameter' value.
    {thread:id=2309172}
    You can build a query dynamically, based on a parameter or even on the data, but 99 times out 100 people use dynamic queries where they are not needed.
    Perhaps explain to us what you are really trying to achieve and why, and we could suggest some better way.

  • Problem - Sort output in table (multiple columns)

    Dear all,
    First of all - Best wishes for 2008.
    I probably have an easy matter, but i can't figure it out, and on this forum very little is mentioned about the sort operator, so therefore this new post.
    I have a dashboard with some input fields (dropdown boxes).
    I have a table (as result of query) and this works fine. The table consists of several columns. (so far no rocket science).
    Generally the structure of the table is like:
    IM SBU | App. Request key | App. Request | etc....
    I want the IM SBU colum to be sorted (assending or decending doenst matter).
    But somehow the second column is the one where the data is sorted (standard).
    My guess this happends because its a key value? or its because it starts with an A (and the other with and I).
    So i insert the sort opperator, add an object (IM SBU) and select up. Then from that opperator i create a table.
    This results in a table with just 1 column (IM SBU).
    So i tried several things.
    I tried to sort on the IM SBU key (this gives the same result).
    I added all colums as an object of the sort opperator...but this still gives the same result of just 1 column.
    Any ideas?
    Regards.
    Bart

    Dear all.
    I'm wondering if  anybody else experienced errors with the sort and the amount of columns shown in a table????
    In general i have a query and want a table as output with 8 columns (sorted by 1 object). I figured out the following and will demonstrate it with 4 situations.
    Situation1 (auto fit table without sort)
    In the properties of the table i select 'frame style'= 'Primary frame' and "fit content" = 'auto'. I run the dashboard and the content of the query is good. All columns are shown and the chart width is auto determined.
    Situation 2 (auto fit table with sort)
    I want to sort on 1 object, so from query i insert a sort (select object), and from sort i create table. Then i select 'frame style'= 'Primary frame' and "fit content" = 'auto'. I run the dashboard and the content of the query is NOT good. I just get to see 1 column. But i selected 8 columns.
    Situation 3 (actual fit table with sort)
    I want to sort on 1 object, so from query i insert a sort, and from sort i create table. Then i select 'frame style'= 'Primary frame' and select "fit content" = 'actual size'. I run the dashboard and the content of the query is good (but not what i want). I get to see all 8 columns. But the table is smaller than i want. I doenst auto fit.
    Situation 4 (fit width table with sort)
    I want to sort on 1 object, so from query i insert a sort (select object), and from sort i create table. Then i select 'frame style'= 'Primary frame' and "fit content" = 'fit width'. I run the dashboard and the content of the query is NOT good. I just get to see 1 column (again). But i selected 8 columns.
    Any suggestions?
    Any known work arounds?
    Or is this an error in VC and should i request a note?
    Regards.
    Bart

  • How to fetch single row data into multiple columns

    Hi Have a cursor
    which will have SELECT Sun_hrs,Mon_hrs,Tue_hrs,Wed_hrs,Thu_hrs,Fri_hrs,Sat_hrs from OTMaster;
    now my cursor has one row of the above columns with this row data I want to insert into other tale as column wise
    ex:
    my row is like this: Sun_hrs,Mon_hrs,Tue_hrs,Wed_hrs,Thu_hrs,Fri_hrs,Sat_hrs
    01:00 01:00 01:00 01:00 01:00 01:00 01:00
    now I want to insert the above data into table with loop along with weekday
    weekday, OTHrs
    1 01:00
    2 01:00
    3 01:00
    4 01:00
    5 01:00
    6 01:00
    7 01:00
    which type of variable I need to fetch the records, rowtype or tabletype,
    plz help me

    thank you for information, and now I am using UNPIVOT below is my query
    SELECT * FROM OTCEILINGMASTER
    UNPIVOT(OTHOURS FOR WEEK_DAY IN (SUN_CEILING_HRS AS '1',MON_CEILING_HRS AS '2',TUE_CEILING_HRS AS '3',
    WED_CEILING_HRS AS '4',THU_CEILING_HRS AS '5',FRI_CEILING_HRS AS '6',SAT_CEILING_HRS AS '7'));
    when I am selecting all the columns (select * from OTCEILINGMASTER) then only the above query is executing I want only two columns from the table however my table has 10 columns.
    please looking into this

  • Comparator for multiple column sorting

    Hi,
    Wr have written a below query
    select p.name, o.id, ol.name, pr.name from Person p , Order o , OrderLine ol, Product pr where...
    order by p.key asc, o.key asc, ol.key desc, pr.key desc
    This query is taking lot of time as it seems the ORDER BY is taking more time. Hence we thought of moving sorting in the java side.
    Here whether I need to create 4 comparators
    1) PersonComparator with p.key asc
    2) OrderComparator with o.key asc
    3) OrderLineComparator with ol.key desc
    4) ProductComparator with pr.key desc
    This query returns a list , hence we need to do some thing like this
    Collections.sort(list, new PersonComparator())
    Collections.sort(list, new OrderComparator())
    Collections.sort(list, new OrderLineComparator())
    Collections.sort(list, new ProductComparator())
    Is there any other better way of handling this sorting as 2 fields needs asc and other 2 fields needs desc. Whether we need to create 4 comparators for each object?
    Please clarify. If there is any alternative please specify that as well.
    Thanks.

    >
    This query is taking lot of time as it seems the ORDER BY is taking more time
    >
    Not sure how you drew that conclusion. There is nothing in your post to support it. Oracle is very efficient at sorting.
    More likely the joins and filters (which you didn't show) in your query are either not using existing indexes or the proper indexes don't exist.
    Post the question in the SQL and PL/SQL forum and provide the following information
    1, Read the FAQ at the top of the main forum page for how to post tuning requests - it will include the below info
    2. The 4 digit Oracle version (post results of SELECT * FROM V$VERSION)
    3. The full query
    4. The DDL for the Person, Order and OrderLine tables
    5. The DDL for the existing indexes on the table
    6. The approximate number of records in each table
    7. The expected number of records you expect in the result set
    8. The execution plan for the query
    A. Open a sql*plus session
    B. set serveroutput on
    C. set autotrace traceonly
    D. SELECT P.NAME ... -- that is, execute the query
    E. Copy and Paste the entire output of the result, including the execution plan
    You (or your DBA) need to determine how much work is being done and where the time is being taken before deciding what solutions to consider. The phrase 'taking more time' doesn't mean anything unless you have something to compare it to. Ten seconds to return one record could be slow while ten minutes to return 1 million records could be fast.

  • Master-detail list - how to spread over multiple columns

    I am using the master-detail functionality to create a image viewer.
    I have a long list of master thumbnails, and rather than having them go down the page in one column, I would like to make them spread over 2 or 3 columns before the detail column. 
    (example of format I am trying to achieve - http://www.franbainbridgephotography.com.au/gallery.html (I dont mind whether master thumbnails are on right or left of detail photo))
    You can see my problem on http://www.wcwra.com/webpages/images.php
    Is this possible with the master-detail functionality?
    Thank you!

    The brilliant David Powers has fixed this for me on the main forum (vw2ureg was v close).  David's answer is :
    There is no way of making a single dataset repeat in multiple columns, because it's simply one element being repeated over and over.
    However, with a little out of the box thinking, you can do it quite easily with thumbnails. Instead of putting the master column repeat region in a block level element, use an inline element, <span>. Images are treated by browsers as inline elements, so this should work just fine. Change the following code from this:
    <div spry:region="dsPhotos" class="MasterContainer">
        <div class="MasterColumn" spry:repeat="dsPhotos" spry:setrow="dsPhotos"
        spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{Caption}</div>
    </div>
    to this:
    <div spry:region="dsPhotos" class="MasterContainer">
        <span class="MasterColumn" spry:repeat="dsPhotos" spry:setrow="dsPhotos"
        spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{Caption}</span>
    </div>
    In your CSS, set the width of the MasterColumn class to the width of your thumbnails, and the width of MasterContainer so that it's wide enough to accommodate two or more thumbnails. The thumbnails will flow into the column two or three abreast.

  • Stored procedure in  package return multiple columns from multiple tables

    Hi ,
    Can a single stored procedure return multiple column values from different tables.
    example:
    tabA: col2, tabB:col3,tabC:col4 etc.
    one more question:
    if a stored procedure like to return 10 columns for a particular record from a single table do i need to define a TYPE statement for each colum like
    TYPE col1 is TABLE of varchar
    TYPE col2 is TABLE of varchar
    here i want to return only one row, not many rows.
    thanks

    You can try one procedure with OUT or IN/OUT parameters that collect the values from one or more sql statements.
    CREATE OR REPLACE PROCEDURE P1
    (P_COD IN TABLE.COD%TYPE,
    P_DESC1 OUT TABLE1.DESC1%TYPE,
    P_DESC2 OUT TABLE2.DESC2%TYPE)
    IS
    BEGIN
    SELECT table1.DESC1, table2.DESC2
    INTO P_DESC1, P_DESC2
    FROM TABLE1, table2 WHERE
    table1.COD = P_COD and
    table1.cod = table2.cod ;
    END P1;
    JP

  • Sorting a Collection with dynamic columns using a custom compare function for multiple columns

    I need help and ideas on how to sort a ListCollectionView.  My problem is complicated by 3 requirements-
         1. The column values contain HTML tags that needs to be removed before sorting (use custom compareFunction to strip HTML)
         2. The columns are dynamic, so dataField names are not known at compile time (need a single compareFunction for all columns)
         3. The data is used in an AdvancedDataGrid so multi-column sorting is required
    I have figured out how to solve any 2 of the 3 requirements.  However, I am having difficulties supporting all 3 requirements.
    Any help or ideas would be greatly appreciated.  Thanks.

    After playing with this some more I think I've figured out a solution.  This seems to work in initial testing.  Also, there is not a need to capture the current sort column in the headerRelease event which many offered solutions suggested.  Another benefit to this solution is that keyboard initiated sorting is handled also.  Whereas the headerRelease event is only triggered by a mouse click on the column header and special handling is required if the user uses the keyboard to access the column header.
    One point that I don't understand is how ascending/decending order is determined.  Behavior seems to be different between a single SortField versus multiple SortFields.  Notice how the compareResults are handled for the different situations.  Anyone out there know why???
     private function colSortCompareFunction(obj1:Object, obj2:Object, fields:Array = null):int{
         var compareResults:int = 0; 
         var newObj1:Object = new Object(); 
         var newObj2:Object = new Object();
          // should not be a condition that is met   
         if (_dataProviderDetails.sort.fields == null)     {
              var s:Sort = new Sort(); 
              var f:Function = s.compareFunction; 
              return f.call(null, obj1, obj2, fields);     }
         // when a single column is selected for sorting   
         else if (_dataProviderDetails.sort.fields.length == 1)     {
              var firstFld:SortField = _dataProviderDetails.sort.fields[0];
              newObj1[firstFld.name] = stripHTML(obj1[firstFld.name]as String);          newObj2[firstFld.name] = stripHTML(obj2[firstFld.name]
    as String);
              compareResults = ObjectUtil.compare(newObj1[firstFld.name], newObj2[firstFld.name]);
               return compareResults;     }
         // when multiple columns are selected for sorting   
         else       {
              for each (var fld:SortField in _dataProviderDetails.sort.fields)          {
                   newObj1[fld.name] = stripHTML(obj1[fld.name]
    as String);               newObj2[fld.name] = stripHTML(obj2[fld.name]
    as String);
                   compareResults = ObjectUtil.compare(newObj1[fld.name], newObj2[fld.name]);
                    if (compareResults != 0)               {
                        if (fld.descending)                    {
                             return compareResults * -1;                    }
                        else                      {
                             return compareResults;                    }
               return compareResults;     }
    Does anyone see any problems with this solution?
    NOTE:  stripHTML(String) is a simple function using regular expression to remove HTML tags.
    Thx

  • How to calculate the individual sums of multiple columns in a single query

    Hello,
    Using Oracle 11gR2 on windows 7 client. I have a question on calculating sum() on multiple columns on different columns and store the results in a view. Unfortunately I could not post the problem here as it keeps on giving error "Sorry, this content is not allowed", without telling where or what it is! So I had to post it in the stack-overflow forum, here is the link: http://stackoverflow.com/questions/16529721/how-to-calculate-the-individual-sums-of-multiple-columns-in-a-single-query-ora
    Will appreciate any help or suggestion.
    Thanks

    user13667036 wrote:
    Hello,
    Using Oracle 11gR2 on windows 7 client. I have a question on calculating sum() on multiple columns on different columns and store the results in a view. Unfortunately I could not post the problem here as it keeps on giving error "Sorry, this content is not allowed", without telling where or what it is! So I had to post it in the stack-overflow forum, here is the link: http://stackoverflow.com/questions/16529721/how-to-calculate-the-individual-sums-of-multiple-columns-in-a-single-query-ora
    Will appreciate any help or suggestion.
    ThanksLooks like you want a simple group by.
    select
              yr
         ,      mnth
         ,      region
         ,     sum(handled_package)
         ,     sum(expected_missing_package)
         ,     sum(actual_missing_package)
    from test
    group by
         yr, mnth, region
    order by      
         yr, mnth, region;I wouldn't recommend storing your data for year / month in 2 columns like that unless you have a really good reason. I would store it as a date column and add a check constraint to ensure that the date is always the first of the month, then format it out as you wish to the client.
    CREATE TABLE test
         year_month                              date,
        Region                     VARCHAR2(50),
        CITY                       VARCHAR2(50),             
        Handled_Package            NUMBER,       
        Expected_Missing_Package   NUMBER,   
        Actual_Missing_Package     NUMBER
    alter table test add constraint firs_of_month check (year_month = trunc(year_month, 'mm'));
    ME_XE?Insert into TEST (year_month, REGION, CITY, HANDLED_PACKAGE, EXPECTED_MISSING_PACKAGE, ACTUAL_MISSING_PACKAGE)
      2  Values (to_date('2012-nov-12', 'yyyy-mon-dd'), 'Western', 'San Fransisco', 200, 10, 5);
    Insert into TEST (year_month, REGION, CITY, HANDLED_PACKAGE, EXPECTED_MISSING_PACKAGE, ACTUAL_MISSING_PACKAGE)
    ERROR at line 1:
    ORA-02290: check constraint (TUBBY.FIRS_OF_MONTH) violated
    Elapsed: 00:00:00.03
    ME_XE?Insert into TEST (year_month, REGION, CITY, HANDLED_PACKAGE, EXPECTED_MISSING_PACKAGE, ACTUAL_MISSING_PACKAGE)
      2  Values (to_date('2012-nov-01', 'yyyy-mon-dd'), 'Western', 'San Fransisco', 200, 10, 5);
    1 row created.
    Elapsed: 00:00:00.01
    ME_XE?select
      2        to_char(year_month, 'fmYYYY')    as year
      3     ,  to_char(year_month, 'fmMonth')   as month
      4     ,  Region
      5     ,  CITY
      6     ,  Handled_Package
      7     ,  Expected_Missing_Package
      8     ,  Actual_Missing_Package
      9  from test;
    YEAR         MONTH                REGION                         CITY                    HANDLED_PACKAGE EXPECTED_MISSING_PACKAGE ACTUAL_MISSING_PACKAGE
    2012         November             Western                        San Fransisco                       200                       10                      5
    1 row selected.
    Elapsed: 00:00:00.01
    ME_XE?Then you have nice a nice and easy validation that ensures you data integrity.
    Cheers,

  • Merge statement - update multiple columns from a single sub-select

    Is it possible to write in 10gR2, a MERGE statement, with UPDATE for multiple columns from a single sub_select?
    like this:
    MERGE INTO tableA
    using ( select * from temp) tmp
    on( tableA. col1 = tmp.col1)
    when matched then
    update set  ( tableA.col5,
                       tableA.col6,
                       tableA.col7) = ( select sum(col2), sum(col3), sum(col5)
                                                                                 from tableX
                                                                                where tableX.col1 = tableA.col1...)

    Hi,
    The USING clause is not a sub-query, so it can't reference columns from tables that are not in it.
    Include tableA in the USING clause if you really need to refer to it there. (It's not obvious that you do.)
    As always, it helps if you post:
    (1) The version of Oracle (and any other relevant software) you're using
    (2) A little sample data (just enough to show what the problem is) from all the relevant tables
    (3) The results you want from that data (In the case of a DML statement, such as MERGE, this will be the state of the tables when everything is finished.)
    (4) Your best attempt so far (formatted)
    (5) The full error message (if any), including line number
    Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
    If you can present your problem using commonly available tables (for example, tables in scott schema, or views in the data dictionary), then you can omit (2).
    Formatted tabular output is okay for (3).

  • Converting multiple column in single column

    Hi All,
    I need to create a table with single column by using select statement with multiple columns
    For Ex- i have 1 row with 10 columns (may be more than 10) like
    'A','B','C','D','E','F','G','H',I','J'
    i written sql like
    select 'A','B','C','D','E','F','G','H','I','J' from dual
    result is - 'A','B','C','D','E','F','G','H','I','J' with 10 columns
    Now i need output lik this using SQL
    Text
    'A'
    'B'
    'C'
    'D'
    'E'
    'F'
    'G'
    'H'
    'I'
    'J'
    Please help me to sort out this problem. Your help would highly appropriated.
    Regards
    Raju
    Edited by: 888667 on Apr 8, 2013 10:54 PM
    Edited by: 888667 on Apr 8, 2013 10:56 PM

    Welcome to the forum!!! You can convert column to row like this
    SQL>with my_table
      2  as
      3  (
      4  select 'A' col1,'B' col2,'C' col3,'D' col4,'E' col5,'F' col6,'G' col7,'H' col8,'I' col9,'J' col10
      5    from dual
      6  )
      7  select decode(no , 1, col1, 2, col2, 3, col3, 4, col4, 5, col5, 6, col6, 7, col7, 8, col8, 9, col9, 10, col10) col
      8    from my_table
      9    cross join (select level no from dual connect by level <= 10)
    10  /
    C
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    10 rows selected.
    SQL> To ask question in a better way please read {message:id=9360002} from FAQ

  • Multiple columns within a single text frame

    Is it at all possible to make a single text frame containing first a single column followed by two columns?
    Why: I need to have my heading expanding across my two column body text. What's important is that I need the two column body text to automatically drop whenever I type (or paste) in more text in my heading. Like it would if the heading and body text was in a single column.
    My text frame options (I work in CS3) do not give me this option, I can only work in one "frame set". I have tried fixing this problem with combinations of tables, multiple text frames and text wrap, but nothing really works.

    Thank you Peter.
    Yes I did try it.
    InDesign CS3 just gives me this alert:
    I also tryed copying the files (HeadStraddler.jsx and HeadStraddler.indl) into a folder like you suggested.
    C:\Program Files\Adobe\Adobe InDesign CS3\Scripts\Scripts Panel\Version 4.0 Scripts\HeadStraddlerForCS2.
    But I just get the same alert.

  • Comparison of multiple column values with a single column value

    I have two separate tables say Tab1 and Tab2
    I want to select some datas , which is common to both the tables.
    In tab1 , there is a column 'STATE' and it's value is 'A'
    In tab2, there are multiple columns for the state, say STATE_A,STATE_B, STATE_C ETC and a row is present with the following details
    STATE_A = 1, STATE_B =1 ,STATE_C =0,STATE_D=1
    I need to select STATE when STATE_A ='1',
    if my STATE='B', this STATE has to be selected since STATE_B =' 1', similraly
    if my STATE='D', this STATE has to be selected since STATE_D =' 1',
    If my STATE='C', STATE_C should not get selected since it's '0'.
    Is it possible to do this in a single SELECT statement, where I have some other checks also or else how can I achieve it?

    Maybe this will help
    Select * from STATE_MAS ;
    STATE
    A
    B
    D
    F
    H
    Select * from STATE_CHILD
      STATE_A   STATE_B   STATE_C   STATE_D   STATE_E   STATE_F   STATE_G   STATE_H   STATE_I   STATE_J
            1         0         0         1         1         0         0         0         0         0
    CREATE OR REPLACE FUNCTION GET_STATE (P_VAL VARCHAR) RETURN NUMBER IS
    V_SQL VARCHAR2(200);
    V_COL VARCHAR2(35);
    P_RETURN NUMBER ;
    BEGIN
    V_COL := 'STATE_'||P_VAL;
    V_SQL := 'SELECT 1 FROM STATE_CHILD WHERE '||V_COL||' = 1 ';
    EXECUTE IMMEDIATE  V_SQL INTO P_RETURN ;
    RETURN P_RETURN ;
    END;
    SELECT STATE FROM STATE_MAS
    WHERE GET_STATE(STATE) = 1 ;
    STATE
    A
    D

  • Displaying data from multiple columns into a single line graph

    Post Author: hollowmatrix
    CA Forum: WebIntelligence Reporting
    Hey,I have an issue with the WEBI reporting.I have a data source that has multiple columns say ( month1, month2, month3, month4,.....month 12, month 13, ....month24) with the sales data for each month.Now say I call the month 1 to month 12 as "current year", and call month 13 - month 24 as "previous year".I want to put a prompt in the report which allows  me to select between "current year" and "previous year".Based on the prompt value we get a graph of the sales vs month ....as in if we select  "current year", then we get a graph of the sales Vs time( remember that the sales data for each month is in a different column.)and if we select  "previous year" then we get a graph of the sales Vs time for previous year..( sales vs time for Month 13, month 14, month 15....month 24).I am not able to pull data from multiple columns into a single object that I can use to populate the graphs.Any help on the same will be appreciated .   

    Hi,
    <p>
    please click
    here (asktom) and look for the words "how about the other way round"
    </p>

  • How to insert from one table to another (multiple columns to single column)

    I want to insert data from table1 into table2 and the data looks in 3 columns as below
    Table1     
    RepNm ObjNm DbNm
    123     abc def
    456     def xyz
    789     123 456
    and the data in table2 should be display as
    Table 2
    ObjNm
    123
    456
    789
    abc
    def
    xyz
    the dupes should get eliminated and only the distinct values should be inserted into a single column in table2 from multiple columns in table1

    How do you want to handle nulls? If there is a null in any value of a column, do you want to insert it?
    Then,
    WITH T
         AS (SELECT LEVEL colnum
               FROM DUAL
             CONNECT BY LEVEL <= 3)
    SELECT DECODE (colnum,  1, RepNm,  2, ObjNm,  3, DbNm) as ObjNm
      FROM table1, T;if you dont want to insert nulls then,
    WITH T
         AS (SELECT LEVEL colnum
               FROM DUAL
             CONNECT BY LEVEL <= 3)
    SELECT DECODE (colnum,  1, RepNm,  2, ObjNm,  3, DbNm) AS ObjNm
      FROM table1, T
    WHERE DECODE (colnum,  1, RepNm,  2, ObjNm,  3, DbNm) = DECODE (colnum,  1, RepNm,  2, ObjNm,  3, DbNm)G.

Maybe you are looking for