Working with LIKE operator
hi,
i have a small confusion in escape clause.
create table products (product_name varchar2(100));
begin
insert into products (product_name) values('A%_WQ123');
insert into products (product_name) values('A%BWQ123');
insert into products (product_name) values('AB_WQ123');
commit;
end;
select * from products where product_name like '%\%_WQ12%' escape '\';
output:
product_name
A%_WQ123
A%BWQ123
can you please tell how this is working, in the above statment the ESCAPE will escape only % or both %and_
thanks,
Are you after this?
select * from products where product_name like '%\%\_WQ12%' escape '\';
Cheers,
Manik.
Similar Messages
-
My new shuffle won't work with my operating system
I was really pleased to be given a new shuffle for my birthday, but it won't work with my operating system. I feel disgusted and cheated; I have been using macs for years and don't see why I should have to buy a new one in order to use a piece of Apple technology. It's not good enough to say that the operating system requirements are clearly stated, as the person who bought me the shuffle didn't know that. I am so furious that I am thinking of going back to pcs next time I buy. Apple really should get their act together, because various forums I have consulted suggest that a lot of other people feel the same.
Feel better now?
We are all users here just like yourself so we cannot do anything for you besides making some logical suggestions to you. So if the person had bought you some 3rd party software that only worked with Leopard and/or Snow Leopard would by be just as furious? Just curious.
You don't have to buy a "new one" to use your new Shuffle, just upgrade your OS. Are you using a PowerPC or Intel Mac Mini? If the latter just go buy a copy of Snow Leopard, install it on your computer and download the latest iTunes. Problem solved. If it is a PowerPC look around and find and install a copy of Leopard. -
Case Insensitive Search coupled with "LIKE" operator.
Greetings All, I am running Oracle 11gR1 RAC patchet 25 on Windows X64.
This db supports and application that requires case insensitive searches.
Because there are a few entry points into the db I created an "after login" trigger:
CREATE OR REPLACE TRIGGER MyAppAfterLogon_TRGR
AFTER LOGON
ON DATABASE
DECLARE
vDDL VARCHAR2(200) := 'alter session set nls_comp=''linguistic''';
vDDL2 VARCHAR2(200) := 'alter session set nls_sort=''binary_ci''';
BEGIN
IF ((USER = 'MyAppUSER') OR(USER = 'MyAppREPORTINGUSER')) THEN
EXECUTE IMMEDIATE vDDL;
EXECUTE IMMEDIATE vDDL2;
END IF;
END MyAppAfterLogon_TRGR;
This ensures that everyone connecting to the DB via any mechanism will automatically have case insensitive searches.
Now, to optimize the know queries I created the standard index to support normal matching queries:
select * from MyTable where Name = 'STEVE';
The index looks like:
CREATE INDEX "CONTACT_IDX3 ON MYTABLE (NLSSORT("NAME",'nls_sort=''BINARY_CI'''))
This all works fine, no issues.
The problem is when I write a query that uses the "LIKE" operator:
select * from MyTable where Name like 'STEV%';
I get back the record set I expect. However, my index is not used? I can't for the life of me get this query to use an index.
The table has about 600,000 rows and I have run gather schema stats.
Does anyone know of any issues with case insensitive searches and the "LIKE" clause?
Any and all help would be appreciated.
LI think there is issue with your logon trigger :
"IF ((USER = 'MyAppUSER') OR(USER = 'MyAppREPORTINGUSER')) THEN"
it should be :
IF UPPER(USER) = 'MYAPPUSER' OR UPPER(USER) = 'MYAPPREPORTINGUSER' THEN
because user name stored in Upper case. Check and try.
HTH
Girish Sharma -
Is there a driver that I can dowload so my HP Photosmart 385 printer will work with my Windows Vista Ultimate operating system?
Hey Alyssa426,
Welcome to the HP Forums!
Since the installation disk does not support Windows 8.1, I would suggest trying to download, and install the drivers directly from the HP Support website. I have included a link to the 'HP Deskjet F4200/F4224 All-in-One Printer series Full Feature Software and Driver'. Once the software is downloaded, open the software, and follow through the on screen instructions for installation.
Please let me know the outcome of installing the software.
Thank you.
I worked on behalf of HP -
Ora 8i: Working with the operating system
I' m working with NT 4.0 and Oracle 8i and I need to do some calls to the operating systems (such us remove directories adn copy a file into another) from PL-SQL.
Is it possible??? I need an aswer as soon as possible.
Quite a lot of thanks!!
Juli.Hi
You can write external procedure on C and call it from PL/SQL code. Maybe you can use also DBMS_PIPE, but I never used it.
Regards
null -
Working with the operating system
I' m working with NT 4.0 and I need to do some calls to the operating systems (such us remove directories adn copy a file into another) from PL-SQL.
Is it possible??? I need an aswer as soon as possible.
Quite a lot of thanks!!
Juli.Hi
You can write external procedure on C and call it from PL/SQL code. Maybe you can use also DBMS_PIPE, but I never used it.
Regards
null -
Multiple row subquery with like operator
can any1 give me an example where we can use a multiple row subquery with the like operator.I read it can be used but when i tried it gives the following error
select * from gagan_emp where ename like (select ename from gagan_emp where deptno=10)
ERROR at line 1:
ORA-01427: single-row subquery returns more than one rowThe right part of 'LIKE' is permitted only single value expression
(including subquery that returns single value),
is not permitted multiple values.
-- Examples (but.... not so good)
select * from gagan_emp e0
where exists
(select ename from gagan_emp e1 where deptno=10
and e0.ename like e1.ename)
select * from gagan_emp e0
where exists
(select ename from gagan_emp e1 where deptno=10
and e0.ename = e1.ename)
select * from gagan_emp e0
where ename = any
(select ename from gagan_emp e1 where deptno=10)
select * from gagan_emp
where ename like
(select ename from gagan_emp e1 where deptno=10 and rownum=1)
; -
Wi-fi won't work with either Opera Mini 5 or Mobil...
This has been driving me nuts. My phone connects to wi-fi networks just fine, and wi-fi works fine with the Nokia browser. But I cannot get either Opera Mini 5.1 or Opera Mobile 10 to do it. I set my access points to "always ask", and then select the wi-fi network when the browser asks.
Opera does however work fine going through the cell phone network.
I have tried reinstalling, and also searched through all the phone settings. Same problem regardless of what I try.
The error message is:
"Connection Failed
Content blocked by operator"
What does that mean "operator". Just exactly WHO is the Operator??? It can't be the wireless network, because no wireless network works with Opera--period. Could it be the cell phone company? If so, why would they allow me to use Opera on the cell network but not allow it on wi-fi?
So I called my provider (a small company recently bought by AT&T, but still operating separately). They told me they are not blocking wi-fi on third-party browsers, and it's probably a issue with the Opera software.
I hope someone here can shed some light on this.
Symbian S60 5th ed., Nokia 5530XM, firmware up-to-dateWell I can get it to work by doing this sequence:
1. Use the wi-fi tool to connect to the network
2. Open the Nokia browser, select the wi-fi network, and browse to a web page.
3. Close the Nokia browser.
4. Open Opera and select the wi-fi network.
5. Browse ...
This method has worked over the past day. I discovered it by accident.
Isn't there someone who can explain why I have to go through this process to use Opera with wi-fi on my 5530XM ? -
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. -
Display not working with new operating system
I recently installed OS X version 10.8.2 and now my large apple display will not work with the MacAir. Anyone know how to fix this?
Return to place of purchase while in your 14 days from date of purchase window. You may have a defective monitor or GPU.
-
SQL Query With Like Operator - Performance is very poor - Oracle Apps Table
Hi,
I'm querying one of the Oracle Applications Standard Table. The performance is very slow when like operator is used in the query condition. The query uses a indexed column in the where clause.
The query is..
select * from hz_parties
where upper(party_name) like '%TOY%'
In the above case, It is not using the index and doing full table scan. I have checked the explain plan and the cost is 4496.
select * from hz_parties
where upper(party_name) like 'TOY%'
If I remove the '%' at the begining of the string, the performance is good and it is using the index. In this case, the cost is 5.
Any ideas to improve the performance of the above query. I have to retrieve the records whose name contains the string. I have tried hints to force the use of index. But it is of no use.
Thanks,
RamaIf new indexes are disallowed, not a lot of good ones, no.
If you know what keyword(s) are going to be searched for, a materialized view might help, but I assume that you're searching based on user input. In that case, you'd have to essentially build your own Text index using materialized views, which will almost certainly be less efficient and require more maintenance than the built-in functionality.
There may not be much you could do to affect the query plan in a reasonable way. Depending on the size of the table, how much RAM you're willing to throw at the problem, how your system is administered, and what Oracle Apps requires/ prohibits in terms of database configuration, you might be able to force Oracle to cache this table so that your full table scans are at least more efficient.
Justin -
Hi All,
we are using like operator for search functionality (oracle 10G).
could any one help me in handling null, when we use like operator.
Ex:
select empno,ename,d.deptno
from emp e, dept d
where e.deptno = d.deptno
and e.ename like '%JO%';
we have a text box in the front end to key in employee name (ename) or part of ename. when user doesnt use this option, he leaves it blank.
so In the above query, if ename is null then my query fails.
could anybody help me out in handling this scenario.
My query should still give me all the employee ids, if the ename is blank.
using dynamic sql is not advisable.
Thanks
ManjuSomething like this ->
satyaki>select *
2 from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.26
satyaki>
satyaki>
satyaki>select *
2 from emp
3 where upper(ename) like nvl('%'||upper('&str')||'%',upper(ename));
Enter value for str:
old 3: where upper(ename) like nvl('%'||upper('&str')||'%',upper(ename))
new 3: where upper(ename) like nvl('%'||upper('')||'%',upper(ename))
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
9999 SATYAKI SLS 7698 02-NOV-08 55000 3455 10
7777 SOURAV SLS 14-SEP-08 45000 3400 10
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 4450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 7000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
13 rows selected.
Elapsed: 00:00:00.02
satyaki>
satyaki>/
Enter value for str: sa
old 3: where upper(ename) like nvl('%'||upper('&str')||'%',upper(ename))
new 3: where upper(ename) like nvl('%'||upper('sa')||'%',upper(ename))
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
9999 SATYAKI SLS 7698 02-NOV-08 55000 3455 10
Elapsed: 00:00:00.08Regards.
Satyaki De. -
Select query not working with like & and operator
Hi,
The below is the select query which is used to select only the failed rollup jobs from DB table ( background jobs ) the status 'A' which means only the failed roll up jobs.
select jobname status from v_op into table zjob_rollup where jobname like '%ROLLUP%'
or jobname like 'BI_AGGR%'
and status like 'A'.
Right now my internal tables is picking the job name other than status A also.
Can you please help.
Note: Ps consider the performance of select query also.
Thanks,
SivaHi,
select jobname status
from v_op
into table zjob_rollup
where ( jobname like '%ROLLUP%' or jobname like 'BI_AGGR%' )
and status = 'A'. -
Keyboard not working with new operating system
I just updated my iphone 4s to the new operating system and the keyboarding is lagging. Any suggestions?
call the facility that did the repair and let them know. They need to stand by their work.
-
create table mytestc(x varchar2(10));
insert into mytestc values ('18t');
insert into mytestc values ('4t;8t');
commit;
How do I give a select so I can select all the rows where 8t is present
select * from mytestc where x like '%8t%'
gives 18t in result setHi,
user650888 wrote:
create table mytestc(x varchar2(10));
insert into mytestc values ('18t');
insert into mytestc values ('4t;8t');
commit;Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful.
Don't forget to post the results you want from that data, an explanation of how you get those results from that data, and the version of Oracle you're using.
How do I give a select so I can select all the rows where 8t is present
select * from mytestc where x like '%8t%'
gives 18t in result setThat's right; '8t' is present in '18t'. That's what you said you wanted. If you would post your desired results and an explanation, then people could help you more.
Did you mean to say that '8t' has to be a complete item in the ;-delimited list, not a subset of some other string, like '18t' or '8td'?
In other words, do you mean that you only want to count '8t' as a match when the character before it is a ';' (or when it is at the beginning of x) qnd the character immediately after it is also ';' (or it comes at the end of x)?
If so:
WHERE INSTR ( ';' || x || ';'
, ';8t;'
) > 0The exxpression above will be more efficient than the (otherwise) equivalent:
WHERE ';' || x || ';' LIKE '%;8t;%'This is called the "mother is in chemotherapy" problem.
Edited by: Frank Kulash on May 24, 2011 4:39 PM
Maybe you are looking for
-
Cisco Jabber for Mac 9.2.1: slow to register with CUCM
Hi, We have this specific problem on our Jabber for Mac 9.2.1 client only: the client takes 60 to 70 seconds to connect to CUCM (running 8.6.2) when it starts. After Jabber registers with CUCM, there is no issue, it's just very slow to register. Anyb
-
Self-assigned IP, no IP, no authentication server!
As most people in threads related to this problem have stated, this issue presented without provocation. The Internet stopped working during a thunderstorm, turned back on, and my computer is the only one having problems in the house. That being said
-
Does SQL Azure charge cross region traffic cost?
Say, I have a SQL DB on West US, and have two cloud services, one hosted on West US and the other hosted on East US. Assume two cloud service have exactly same read/write throughput on the DB, is the cost same? I am wondering, if East US service cost
-
Post Installation Steps for ERP add-on Inventory Manager 4.0
Hi, I need to confirm what are the post-installation activities we must to perfom for ERP Add-on (Inventory Manager 4.0), besides de BC Activation. I did not find any information regarding the post installation steps for the ERP Add-on of Inventory M
-
Nokia 5530 messaging update issue
not sure if it was mentioned before bu ive experienced a new issue (new to me). i updated my firmware to v20 and then got an update of nokia messaging (to version 10.1). after the update was applied, when i reply to any text message i have to wait ab