Like operator within select to find EJB

Hi,
I would like to find the entity bean using a bind variable and using a the LIKE sql operator.
i tried this in my orion-ejb-jar.xml
<finder-method partial="false" query="Select * from organisme where code = nvl($1,code) and upper(libelle) like nvl(upper('$2%'), libelle)">
<method>
<ejb-name>Organisme</ejb-name>
<method-intf>Home</method-intf>
<method-name>findByCodeNom</method-name>
</method>
</finder-method>
but it is not working, i receive an error message like
com.evermind.server.rmi.OrionRemoteException: Database error: ORA-01006: bind variable does not exist
; nested exception is:
     java.sql.SQLException: ORA-01006: bind variable does not exist
Thnaks for your help

Hi El Bachir,
This is just a suggestion: Remove the percent sign ("%") from the "orion-ejb-jar.xml" file, so that your query becomes:
Select * from organisme where code = nvl($1,code) and upper(libelle) like nvl(upper('$2'), libelle)and add the percent sign to the string parameter (i.e. the "$2") that you are passing to the "findByCodeNom()" method.
Hope this helps.
Good Luck,
Avi.

Similar Messages

  • Problem with LIKE operator in select query

    Hi,
    I want to compare one field using LIKE operator. But i m not able to do that.
    DATA: l_doctext type c value ''''.
    CONCATENATE l_doctext s_lbktxt-low '%' l_doctext INTO s_lbktxt-low.
    SELECT bukrs belnr gjahr blart bldat budat xblnr bktxt waers awtyp
                FROM bkpf INTO TABLE g_t_bkpf_labor
                FOR ALL ENTRIES IN g_t_bseg_unique
                WHERE bukrs = g_t_bseg_unique-bukrs
                AND belnr = g_t_bseg_unique-belnr
                AND gjahr = g_t_bseg_unique-gjahr
                AND blart = p_ldtype
                AND bktxt LIKE s_lbktxt-low.
    plz help. Am i dng something wrong.
    Value in s_lbktxt can be like 'TEA.....'

    hi ,
    check this program..
    tables:mara.
    data: begin of it_mara occurs 0,
          matnr like mara-matnr,
          meins like mara-meins ,
          mtart like mara-mtart,
          end of it_mara.
    select-options: s_matnr for mara-matnr.
          select matnr
                 meins
                 mtart
                 from mara
                 into table it_mara
                 where matnr like '%7'.
    sort it_mara by matnr.
    loop at it_mara.
    write:/ it_mara-matnr,
    it_mara-meins,
    it_mara-mtart.
    endloop.
    regards,
    venkat.

  • Using -like operator to select recipients for Dynamic Distribution Group

    Dear Scriptor,
    I got few thousand of data and would like to select recipient according to the CustomAttribute1.
    Below is the sample data in my database.
    Name: User1, CustomAttribute1: aa, bb, cc
    Name: User2, CustomAttribute1: aa, bb
    Name: User3, CustomAttribute1: bb, cc, dd
    If I run the script as below,
    New-DynamicDistributionGroup -name "myDyna.bb" -RecipientFilter {(CustomAttribute1 -like 'aa*')}
    The return result is User1 and User2
    When I run the script as below,
    New-DynamicDistributionGroup -name "myDyna.bb" -RecipientFilter {(CustomAttribute1 -like 'bb*')}
    No result returned
    How can I overcome this issue?
    Thanks.

    Below are my sample data in O365.
    Type
    Identity
    UserPrincipalName
    DisplayName
    FirstName
    LastName
    CustomAttribute1
    Mailbox
    77771111
    [email protected]
    7777 #1
    7777
    #1
    a1, a2, a3
    Mailbox
    77772222
    [email protected]
    7777 #2
    7777
    #2
    a1, a2
    Mailbox
    77773333
    [email protected]
    7777 #3
    7777
    #3
    d4, a1
    Mailbox
    77774444
    [email protected]
    7777 #4
    7777
    #4
    a2, e5, f6
    Mailbox
    77775555
    [email protected]
    7777 #5
    7777
    #5
    g7, h8, i9
    Mailbox
    77776666
    [email protected]
    7777 #6
    7777
    #6
    g8, i9, a3
    I would like to create a DynamicDistributionList where CustomAttibute1 contain "a2".
    The expecting result are 77771111, 77772222 and 77774444.
    How can I write the script?
    I am using Windows Azure Active Directory Module for Windows Powershell. I run the $PSVersionTable.PSVersion and it returned me Major=4, Minor=0, Build=-1, and Revision=-1.
    This works for you case:
    New-DynamicDistributionGroup -name "myDyna.bb" -RecipientFilter {CustomAttribute1 -like '*a2*'}
    Do not use parens "()".
    ¯\_(ツ)_/¯

  • LIKE operator with 2 words

    I have a search box, the contents of the search field are then used in a LIKE operator statement:
    SELECT * from Products WHERE product_name LIKE '% + productName + %';
    this works perfectly fine for one word i.e. Fruit
    but when i try Fruit Cake i get no matches i have to add Fruit%Cake in the textfield. I'm not sure how to add the percentage sign in between when there's two words. Any ideas?

    but when i try Fruit Cake i get no matches i have to
    add Fruit%Cake in the textfield. I'm not sure how to
    add the percentage sign in between when there's two
    words. Any ideas?Use a simple String.replace() to replace whitespaces with the % sign.

  • Reg:LIKE operator

    Hi All,
    Can i use the LIKE operator in Select query to compare the Same field that starts with different values i.e.
    CONCATENATE  c_5051 c_%  INTO l_val1.
    CONCATENATE  c_5101 c_%  INTO l_val2.
    SELECT prctr
                        INTO l_prctr
                        FROM bseg UP TO 1 ROWS
                        WHERE matnr = l_matnr
                        AND  belnr  =  l_belnr
                        AND ( hkont LIKE  l_val1
                        OR    hkont LIKE l_val2 ).
        ENDSELECT.
    but it is failing even though ther is an entry in BSEG table satisfying hte given condition.
    Regards,
    Padmasri.

    HI,
    u can use like operator in select statement where condition.
    may be it is failing because of some other selections. please make sure whether the record with the corresponding selections is available in database or not.
    rgds,
    bharat.

  • EJB QL "LIKE" OPERATOR NIGHTMARE

    i want to pass input parameter to my ejb ql.
    it will look like this :
    "SELECT OBJECT(p) FROM EntityBeanTable p WHERE p.Title LIKE ?1"
    But it seem its imposible with ejb 2.0. am i right ?
    how to overcome this then,
    "LIKE" operator is so damn important, without this we can't continue our development.
    shall we use bmp ? or ????

    You can use the like operator with parameters, you just have to put your wildcards into the parameter. Here's an excerpt:
    A query that uses a LIKE operator would look something like this:
    SELECT DISTINCT OBJECT(user)
    FROM User user
    WHERE user.userInfo.lastName LIKE ?1
    If you check out the code in the code listing on the left-hand side of this panel, you will
    note that a method exposes this functionality from the UserManagement session bean
    so that you can access it from the client with the getUserByLastNameLike()
    method. Thus, to use getUserByLastNameLike(), you can specify the pattern
    string as a parameter.
    For example, to find users with last names like "High", you would pass the following
    parameter value:
    users = userMgmt.getUserByLastNameLike("High%");

  • EJB QL LIKE Operator

    Hello,
    I want to perform search by keyword on all fields of a table. Say I have a product table with following fields:
    Field Name Data Type
    ProductNo Integer
    ProductName String
    Brand String
    UnitPrice Double
    SupCode Integer
    I cannot use LIKE operator as follows:
    "SELECT OBJECT(p) FROM Product AS p WHERE p.productName LIKE ?1 or p.supCode LIKE ?1 or p.partNo LIKE ?1 p.brand LIKE ?1 or p.unitPrice LIKE ?1 ORDER BY p.productName ASC"
    This throws error as LIKE operator expects String fields only. Is there any way I can use LIKE operator or any other way to search by keywords on all field of any data type using EJB QL.

    Hi Muerrtu,
    I'm assuming you're using an implementation of J2EE 1.3, and thus EJB 2.0. EJB 2.1 (J2EE 1.4) added support for an input parameter with the LIKE clause.
    --ken
    Kenneth Saks
    J2EE SDK Team
    SUN Microsystems

  • Select Performance problems using the 'like' operator

    I have a PL/SQL procedure that uses a cursor which contains a 'like' operator in the where clause. I have two database instances that are theoretically the same, however this code processes about 100,000 rows in 5 minutes on one database and 100,000 rows in several weeks on the other database. I know it is the 'like' operator that is causing the problem, but I don't know where to look in the database setup parameters as to what could be different between the two. Can someone point me in the right direction?

    I tried to think of another way to write the query, but I really need to use the wildcard option on the data I'm searching for. The system I'm working with attaches a suffix to the end of every ID (ie. '214-222-1234-0') The suffix ('-0') increments but the rest of the ID stays the same ('-1','-2',etc...), but I want to find all of the rows where the first 12 characters are the same, so I strip off the suffix and use a wildcard '%' in its place. I tried adding the SUBSTR() function to the left hand column of the where clause, but it was even slower than using the 'like' operator. I know its a sound query, I just can't figure out why it works fine on one database and not the other.

  • Problem in JDBC , when using LIKE operator. - VERY URGENT

    Problem in JDBC , when using LIKE operator.
    LINE 1 : String temp = "AA";
    LINE 2 : String query = "select * from emp where EMPNAME like '*temp*' ";
    LINE 3 : Staement st = con.createStaement();
    LINE 4 : ResultSet rs = st.executeQuery(query);
    '*' character is not getting evaluated. In MS ACCESS2000 only * is accepted instead of '%'. Moreover in MS ACCESS the like operator has to be used within double quotes as a String. whereas in other databases, it accepts single quotes as a String.
    Ex:
    In MS ACCESS
         select * from emp where ename like "*aa*";
    Other Databases
         select * from emp where ename like '%aa%';
    In my situation iam passing a Variable inside a like operator and '*' is used.
    For the above Scenario, Please help me out.
    If possible Kindly let me know the exact Syntax.
    Please give me the answer as LINE1,LINE2,LINE3,LINE4,
    I have verified in JDBC Spec also, it has been specified to use escape sequence.that too did not work.
    Due to this, My project is in hold for about 4 days. I could not find a suitable solution.
    Please help me out.

    I made a LIKE clause work with M$ Access, using PreparedStatement and the % wildcard:
                escapeStr                   = "%";
                String sql                  = "SELECT USERNAME, PASSWORD FROM USERS WHERE USERNAME LIKE ?";
                PreparedStatement statement = connection.prepareStatement(sql);
                statement.setString(1, ("user" + escapeStr));
                ResultSet resultSet         = statement.executeQuery();
                while (resultSet.next())
                    System.out.println("username: " + resultSet.getObject("USERNAME") + " password: " + resultSet.getObject("PASSWORD"));

  • Why the 'LIKE' operator takes so much time to run?

    I have a table T with 3 columns and 3 indexes:
    CREATE TABLE T
    id VARCHAR2(38) NOT NULL,
    fid VARCHAR2(38) NOT NULL,
    val NVARCHAR2(2000) NOT NULL
    ALTER TABLE T ADD (CONSTRAINT pk_t PRIMARY KEY (id,fid));
    CREATE INDEX t_fid ON T(fid);
    CREATE INDEX t_val ON T(val);
    Then I have the following two queries which differ in only one place - the 1st one uses the '=' operator whereas the 2nd uses 'LIKE'. Both queries have the identical execution plan and return one identical row. However, the 1st query takes almost 0 second to execute, and the 2nd one takes more than 12 seconds, on a pretty beefy machine. I had played with the target text, like placing '%' here and/or there, and observed the similar timing every time.
    So I am wondering what I should change to make the 'LIKE' operator run as fast as the '=' operator. I know CONTEXT/CATALOG index is a viable approach, but I am just trying to find out if there is a simpler alternative, such as a better use of the index t_val.
    1) Query with '=' operator
    SELECT id
    FROM T
    WHERE fid = '{999AE6E4-1ED9-459B-9BB0-45C913668C8C}'
    AND val = '3504038055275883124';
    2) Query with 'LIKE' operator
    SELECT id
    FROM T
    WHERE fid = '{999AE6E4-1ED9-459B-9BB0-45C913668C8C}'
    AND val LIKE '3504038055275883124';
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=99)
    1 0 TABLE ACCESS (BY INDEX ROWID) OF 'T' (Cost=1 Card=1 Bytes=99)
    2 1 INDEX (RANGE SCAN) OF 'T_VAL' (NON-UNIQUE) (Cost=4 Card=12)

    I will for sure try to change the order of the PK and see whether there will be any impact to the performance.
    In our application, val is much closer to a unique value than fid. In the example query, the execution plan showed that the index on val was indeed used in the execution of the query. That's why the 1st query took almost no time to return (our table T has more than 6 million rows).
    I was hoping the 'LIKE' operator would utilize the t_val index effectively and provide similar performance to the '=' operator. But apparently that's not the case, or needs some tricks.

  • Using Like Operator in a decode function

    Hi,
    I am trying to find out if I can use the like operator in a decode function
    like:
    select decode(1234,like '%123%','123 is a match') from dual;
    this reults in error ORA-00936: missing expression
    is there any way to make this work?
    thank you

    SQL> ed
    Wrote file afiedt.buf
      1  WITH tbl AS (SELECT '201aaa' dt FROM DUAL UNION ALL
      2               SELECT '123bbb' dt FROM DUAL UNION ALL
      3               SELECT '567ccc' dt FROM DUAL UNION ALL
      4               SELECT 'ab123ddd' dt FROM DUAL
      5               )
      6  SELECT dt,CASE WHEN dt like '%123%' THEN 'Match'
      7         ELSE 'Not Matched'
      8         END With_case
      9        ,DECODE(REGEXP_SUBSTR(dt,'123'),NULL,'Not Match','Match')   With_Regexp
    10        ,DECODE(INSTR(dt,'123'),0,'Not Match','Match') With_Instr
    11        ,DECODE(REPLACE(dt,'123'),dt,'Not Match','Match') With_Replace
    12* FROM tbl
    SQL> /
    DT       WITH_CASE   WITH_REGE WITH_INST WITH_REPL
    201aaa   Not Matched Not Match Not Match Not Match
    123bbb   Match       Match     Match     Match
    567ccc   Not Matched Not Match Not Match Not Match
    ab123ddd Match       Match     Match     MatchEdited by: Saubhik on Jul 26, 2010 5:24 AM
    Edited by: Saubhik on Jul 26, 2010 5:40 AM
    Edited by: Saubhik on Jul 26, 2010 5:40 AM

  • How does this LIKE operator work ?

    Values JOHN and KEITH have spaces in the string.
    create table string_test ( test_str varchar2(15));
    insert into string_test values ('JO HN');
    insert into string_test values ('JOHN');
    insert into string_test values ('RAM');
    insert into string_test values ('KEITH ');
    SQL> select * from string_test;
    TEST_STR
    JO HN
    JOHN
    RAM
    KEITHFrom OTN , i found the query to find all string values which has a white space in it.
    select * from string_test where test_str like '%' || chr(32) || '%';But, i don't understand how this works. Won't the percent sign in single quotes ('%') be considered a literal ?

    GarryB wrote:
    Values JOHN and KEITH have spaces in the string.
    create table string_test ( test_str varchar2(15));
    insert into string_test values ('JO HN');
    insert into string_test values ('JOHN');
    insert into string_test values ('RAM');
    insert into string_test values ('KEITH ');
    SQL> select * from string_test;
    TEST_STR
    JO HN
    JOHN
    RAM
    KEITHFrom OTN , i found the query to find all string values which has a white space in it.
    select * from string_test where test_str like '%' || chr(32) || '%';But, i don't understand how this works. Won't the percent sign in single quotes ('%') be considered a literal ?No, because the "%" sign has special meaning to the LIKE operator. It's a wildcard meaning any characters.

  • How to use LIKE operator in plsql

    Hi
    I wanted to select certain rows using like operator in plsql(Input should be given by the user). I have given my experiment here .I couldn't get any result.
    As per sql syntax while using LIKE operator we should give search criteria within single quote.where as in plsql if we give within single quote its takes as string so no output is comming.what is solution ? How to use like operator in plsql?
    sql syntax
    SQL>SELECT customer_name FROM customer_header
    WHERE customer_name LIKE 'B%' ; customer_name
    Bala murali
    Babu
    Basker
    plsql syntax
    PROCEDURE pro_custheader_like ( v_cname IN varchar2
         ,answer OUT type_refcur_customer) IS
         BEGIN
         OPEN answer FOR
         SELECT customer_name FROM customer_header
              WHERE customer_name LIKE ( ' v_cname ' );
    END pro_custheader_like;
    execution command
    sql>variable answer refcursor;
    sql>set serveroutput on
    sql>exec package_name.pro_custheader_like( 'R',:answer);
    plsql successfully completed
    sql>print :answer
    no row selected
    by
    balamuralikrishnan.s

    plsql syntax
    PROCEDURE pro_custheader_like ( v_cname IN
    varchar2
    ,answer OUT
    type_refcur_customer) IS
    N
         OPEN answer FOR
         SELECT customer_name FROM customer_header
    WHERE customer_name LIKE ( v_cname );
    END pro_custheader_like;
    Try it without any quotes. And, let us know your feedback.
    Regards.
    Satyaki De.
    Message was edited by:
    Satyaki_De

  • Problem in using like Operator

    Hi, can any one help me in finding out if we can use a column name in the like operator...
    for example i want to compare a column with another column in the same table...
    column1 has a value as omer123
    and cloumn2 has a value as omer
    i just want to find out those records in which column2 contains in column1
    column1 column2 column3
    omer12 omer This is the one
    12jack sda asds
    1233 asd asd
    12Aug212 dasd adsasd
    i want to write a query which will return ' This is the one ' as its col2 is in col1
    This is what i wrote but the problem is in the like operator
    select t1.cloumn3
    from table_name t1,table_name t2
    where t1.id = t2.id
    and t1.column1 like %t2.column2%
    plz help..
    thankz

    Your wildcard characters need to be quoted, thus:
    SELECT t1.column3
      FROM table_name t1,
           table_name t2
    WHERE t1.id = t2.id
       AND t1.column1 LIKE '%'||t2.column2||'%' ;

  • Unable to find ejb-jar with uri X.jar in ear at c:/Y/split_src

    Stack trace is below, but the ejb does exist at the location that the FileNotFoundException states. I've checked that application.xml, org.eclipse.wst.common.component both have the correct name for this dependency.
    java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
      at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:190)
      at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.deploy(WlsJ2EEDeploymentHelper.java:506)
      at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1466)
      at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:898)
      at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:686)
      at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:539)
      at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
      at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3153)
      at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
      at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
    Caused by: weblogic.application.ModuleException:
      at weblogic.ejb.container.deployer.EJBModule.init(EJBModule.java:334)
      at weblogic.application.internal.flow.ModuleListenerInvoker.init(ModuleListenerInvoker.java:167)
      at weblogic.application.internal.flow.InitModulesFlow.initModule(InitModulesFlow.java:312)
      at weblogic.application.internal.flow.InitModulesFlow.initModules(InitModulesFlow.java:325)
      at weblogic.application.internal.flow.InitModulesFlow.prepare(InitModulesFlow.java:378)
      at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:648)
      at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
      at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
      at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:59)
      at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
      at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
      at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:208)
      at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
      at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
      at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
      at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
      at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
      at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
      at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
      at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
      at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
      at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    Caused by: java.io.FileNotFoundException: Unable to find ejb-jar with uri ***.jar in ear at C:\***\split_src
      at weblogic.ejb.spi.EJBJar.<init>(EJBJar.java:81)
      at weblogic.ejb.container.deployer.EJBModule.buildClassFinder(EJBModule.java:201)
      at weblogic.ejb.container.deployer.EJBModule.init(EJBModule.java:313)

    Hi Ten,
    FYI, just by placing the ejb jar inside EAR project it will not be picked up for deployment. The EJB module has to be defined on EAR Module Assembly, and the steps are:
    > EAR Project | Properties, Deployment Assembly - Add EJB module
    NOTE: To verify the dependency you could try to export the EAR project to an .ear file. If the exported .ear file bundles ejb jar then deployment should work fine.
    As far as the deployment mode, OEPE supports WebLogic Split-source (default) and Exploded archive. In the default split-source mode, the .beabuild.txt contains the mapping to the actual files whereas in exploded archive the files are copied over to deployment staging location.
    Steps to modify deployment mode:
    > In the server view, right click on server configuration | Properties, select WebLogic | Publishing
    Please make sure the ejb module is defined appropriately and let me know if this resolves the issue.
    Thanks,
    Ram

Maybe you are looking for