PL/SQL :: Regular Expression Matching All Given Words
Nov 8, 2012
I'm trying to match all sentences that contain words starting with given search tokens at least once. For example: if the given search token words are one and two then only sentences like "one plus one is two" should match. And should not match sentences like "one plus three is four". I was able to come up with this but I need a AND condition which I'm unable to get it right.
select count(*) from dual where regexp_like('one plus one is two', '(^|s)one|three', 'i');
Currently this gives a count of 1. But needs to give a count of 0 when the regexp is fixed.
search words : one two
one is less than two -> match
two is greater than one -> match
onetwo is union of two numbers -> match
onetwo is union of 2 numbers -> not a match as 'two' is not at the beginning of a word
one is less than three -> not a match as two is not present.
View 7 Replies
ADVERTISEMENT
Aug 19, 2013
i am in need to find starting two words matching like i have string "my name is person". i want starting two words find "my name". i tried with this
SELECT T.FULL_NAME,SUBSTR(t.full_name,0,INSTR(t.full_name, ' ')-1+INSTR(t.full_name, ' ')-1) AS outpu2
FROM test t
output: it's giving me the out put but not in proper way som where the second word is cut off and some where first word is not coming.
View 6 Replies
View Related
Aug 19, 2013
find two words matching from two different tables.
Example:-
table1 || table2
john Dev || Kab Leva
Zaheer khan || mark dev
Cina maater || jhon dev wood
kab leva Sumo || Tony levis
output:-
john dev || john dev
kab leva || kab leva
View 9 Replies
View Related
Apr 13, 2013
What is the use of Regular Expression?
View 1 Replies
View Related
Jan 21, 2011
I have a following table,
CREATE TABLE checkdata
( col1 VARCHAR2(2000)
);
INSERT
INTO checkdata VALUES
[code]......
I need output as ,
INT8144925446-20110118T123723Z
INT8144925448-20110118T123730Z
How do i use Substr and Regular expression here ?
View 11 Replies
View Related
Jun 6, 2012
Sample Data:
SELECT 'A/BCD/CCE/DFFFF' test from dual
Expected Output:
SELECT 'A' A,
'BCD' B,
'CCE' C,
'DFFFF' D
FROM DUAL;
View 6 Replies
View Related
Oct 1, 2012
I am having issue with Oracle reserved words, one of the application is using table which has NUMBER as column. I am not able to query that table matching database with NUMBER column.
HERE
select a.*
from DOC a , FOLDER B
where a.NUMBER= B.INCIDENT_ID
and b.open = 'Closed'; I tried double quotes (“”) and sigle quotes too, none of them worked.
View 12 Replies
View Related
Apr 9, 2013
Can we use regular expression to eliminate all characters other than -
A to Z
0 to 9
Special characters like - &,%,~,@,#,$,^,*,_,+,=,,/,<,>
Example
String - TEST@#_~````}{!!!12311HELLO
Expected result - TEST@#_~12311HELLO
how we can use regular expression to achieve this result.
View 4 Replies
View Related
Jul 3, 2012
I have a Identifier column with start and stop dates along with description .
Two dates are separated by '-'. But the position of that character(-) is not constant always. Depending on the instr function I am able to divide the start and stop dates. But I am getting the performance problem because of huge data
I think the same logic will be implemented by regular expression also . How to write the equivalent logic by using regular expressions
create table REG_EXP_TEST
(
TRANS_ID NUMBER(10),
TRANS_IDENTIFIER VARCHAR2(250)
) ;
insert into REG_EXP_TEST
(TRANS_ID, TRANS_IDENTIFIER)
values
[code].......
View 3 Replies
View Related
Jul 24, 2012
Regular Expression in oracle??Especially the use of this in real time scenario.
View 4 Replies
View Related
Oct 16, 2012
Is there a way to perform a pattern check on a value ?
For example: 654321HD9
The pattern is 6 numbers, followed by 2 letters, followed by 1 number. The data type for the attribute is a string.
Examples of right or wrong
654321HD9 - correct value
654321HD - wrong value
654321111 - wrong value
HD1111111 - wong value
The pattern has to be as i mentioned above (6 number, 2 letters, 1 number) otherwise its wrong. My pattern does not cover all cases.
select REGEXP_SUBSTR('654321HD9', '[0-9]+[A-Za-z]+[0-9]+') from dual;
View 6 Replies
View Related
Nov 6, 2013
, My HTML string is like below. select '<CityName>RICHMOND</CityName> <StateCd>ABCD CDE <StateCd/><CtryCd>CAN</CtryCd><CtrySubDivCd>BC</CtrySubDivCd>' Str from dual Desired Output is<CityName>RICHMOND</CityName><StateCd>ABCD CDE <StateCd/><CtryCd>CAN</CtryCd><CtrySubDivCd>BC</CtrySubDivCd> i.e.
want to remove those spaces from tag value area having only spaces otherwise leave as it is.implement the same using Regular expression.
View 2 Replies
View Related
Oct 14, 2013
I would like to write a select that would return all places in DB that are commiting transaction.
E.g. package for testing:
CREATE OR REPLACE PACKAGE test.TEST_COMMIT AS
PROCEDURE THE_ONLY_COMMIT_IN_DB ;
END TEST_COMMIT;--not a match
CREATE OR REPLACE PACKAGE BODY test.TEST_COMMIT AS
[code]....
The select should return 4 rows with --ok.
SELECT *
FROM ALL_SOURCE ASO
WHERE
REGEXP_LIKE(ASO.TEXT,'commit(s*);','i' )
AND name = 'TEST_COMMIT'
View 18 Replies
View Related
Nov 18, 2013
I would like to use the REGEX_LIKE to check a number with up to two digits and at least one decimal point: Ex.10.11.1112 This is what I have so far.
if regexp_like(v_expr, '^(d{0,2})+(.[0-9]{1})?$') t
View 3 Replies
View Related
Mar 15, 2012
I need to search a specific pattern from a source code. In word, I need to check whether "getCode" has been called or not, for all the string inside double-quote("). Following are sample code lines -
1.->if(val==23){ month_desc = "a sample data"; }
2.->if(val==23){ month_desc = getCode("a sample data"); }
3.->if(val==23){ month_desc = "a " + getCode("sample data"); }
4.->if(val==23){ month_desc = getCode("sample data"); var2="sample data2";}
Now, expression should be such that it will return true during check for 1, 3 and 4, although, for 3 & 4 getCode has been called for part of the String.
View 2 Replies
View Related
Oct 6, 2011
I want to extract the data from the Clob field. I have the following table,create table test123(col1 char(24), col2 clob); And following data,
Insert into test123 (col1,col2) values ('ABCDE','<?xml version="1.0" encoding="UTF-8"?>
<Attributes>
<Attribute DataType="Text-40" DisplayName="DropDirectory"
IsNotDeletable="Y" Modifiable="Y" Name="DropDirectory" Value="${Dir1}"/>
<Attribute DataType="Text-40" DisplayName="PrinterAlias"
IsNotDeletable="Y" Modifiable="Y" Name="PrinterAlias" Value="\Printer3Printer4"/>
<Attribute DataType="Text-40" DisplayName="PrintServerHostName"
IsNotDeletable="Y" Modifiable="Y" Name="PrintServerHostName" Value=""/>
<Attribute DataType="Count" DisplayName="PrintServerPort"
IsNotDeletable="Y" Modifiable="Y" Name="PrintServerPort" Value="2723"/>
</Attributes>');
[code]....
The data will be available like this only, The same XML tag is used everywhere.
View 1 Replies
View Related
Dec 22, 2010
ved>create table test900 ( a number, b number);
Table created.
ved>insert into test900 values( 9,'');
1 row created.
ved>insert into test900 values( 10,null );
1 row created.
ved>select * from test900;
A B
---------- ----------
9
10
ved>select nvl(length(b),0) from test900;
[code]....
ERROR at line 1:
ORA-01790: expression must have same datatype as corresponding expression..Why the above sql ( case 2 ) gives error?
View 9 Replies
View Related
Aug 4, 2009
I am using below code to spell number in words
create or replace
function spell_number( p_number in number )
return varchar2
-- original by Tom Kyte
-- modified to include decimal places
[Code]....
The number amount is : 9899.25
I am getting the output is:
NINE THOUSAND EIGHT HUNDRED NINETY-NINE POINT TWO FIVE
But i want output should be
NINE THOUSAND EIGHT HUNDRED NINETY-NINE AND Twenty five FILS ONLY
where i need to modify the code.
Files is equal to cent as per DOLLOR currency
View 6 Replies
View Related
Jul 6, 2012
I tried to convert numbers to words, it shows the below error.
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 6 11:00:29 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SELECT TO_CHAR (TO_DATE (2447834, 'j'), 'jsp') FROM DUAL;
TO_CHAR(TO_DATE(2447834,'J'),'JSP')
---------------------------------------------------------------------------
two million four hundred forty-seven thousand eight hundred thirty-four
SQL> SELECT TO_CHAR (TO_DATE (244783400, 'j'), 'jsp') FROM DUAL;
SELECT TO_CHAR (TO_DATE (244783400, 'j'), 'jsp') FROM DUAL
*
ERROR at line 1: ORA-01830: date format picture ends before converting entire input string
SQL>
View 4 Replies
View Related
Mar 14, 2002
I found a message which explain how to spell out numbers to words. I'm french and the purpose of my question is how to convert numbers to word (to print cheque) but in french the function found in the newsgroup was :
select decode( sign( &num ), -1, 'Negative ', 0, 'Zero', NULL ) ||
decode( sign( abs(&num) ), +1, to_char( to_date( abs(&num),'J'),'Jsp') )
from dual
/
I'm afraid but i don't undaunted how pass my number to this function (&num ???)
View 12 Replies
View Related
Mar 7, 2013
I have given below example.I hope that is clear.
M_STR_1 VARCHAR2(1000);
M_STR_2 VARCHAR2(1000);
BEGIN
M_STR_1 :='CHANDAN,RATTAN,PL,SQL';
M_STR_2 :='PL,SQL,RATTAN,CHANDAN,WINDOWS,LINUX';
--Output should like this same as order of M_STR_1
M_STR_2 :='CHANDAN,RATTAN,PL,SQL,WINDOWS,LINUX';
I think approach should be like take 1st word (before ,)and search the position in M_STR_1
and assign the that position in another variable using ltrim or rtrim. Well this what is i think
View 3 Replies
View Related
May 3, 2006
How can i insert any character or symbol automatically after writing 2 words
E.g.
i want to enter date 20-may-06 , in this i mean it that when i enter 20 then automatically - is inserted.
is there any query in Oracle. Or Oracle Hasn't created this type of query.
View 3 Replies
View Related
Mar 1, 2012
I have a table with the following column and data is like this.
SQL>CREATE TABLE test (
column1 varchar2(50));
SQL>INSERT INTO test VALUES('ABC XYZ');
SQL>INSERT INTO test VALUES('MNO PQR');
SQL>INSERT INTO test VALUES('ABCD ABC');
SQL>INSERT INTO test VALUES('PQR MNOP');
[code]....
View 13 Replies
View Related
Mar 18, 2011
When integrating your product with third-party APIs I've repeatedly come into conflict with PLSQL and Oracle's reserved words list. For instance while integrating the clickatell SMS Message Transmission notification API there are two variables they send.
[URL]......
How do you propose PLSQL handles these requests without using Apache to rewrite the variable names, or using the three and four variable pslql variable collection methods.
View 1 Replies
View Related
Oct 19, 2011
wrote a code that display the first 10 words from a string.
View 15 Replies
View Related
Mar 26, 2010
In the table the names are having diffrent spaces for one name only one space between the words,for another name two spaces between words,for other names three spaces between the words.
I want to update with single space how can we that.
I am giving the data as follows.
CREATE TABLE student(sname VARCHAR2(30));
INSERT INTO student VALUES('PRAKASH BABU');
INSERT INTO student VALUES('RAJESH KUMAR');
INSERT INTO student VALUES('POORNA CHANDAR');
INSERT INTO student VALUES('ANIL RAJ');
INSERT INTO student VALUES('ABHI RAM KONA');
INSERT INTO student VALUES('SRI TEJA MEDI');
Like this the table contains millions of rows.
I want to update the names like this.
PRAKASH BABU
RAJESH KUMAR
POORNA CHANDAR
ANIL RAJ
ABHI RAM KONA
SRI TEJA MEDI
View 6 Replies
View Related
Nov 19, 2012
I have the following table and data , So i want to update this table(word column) with words that has same soundex with one word of them, the word must be that has the long length if the two words has same length So, update by any of them.
drop table t1;
create table t1 (id number(10) ,word varchar2(100));
insert into t1 values(1,'Londn');
insert into t1 values(2,'Egypt');
insert into t1 values(3,'London');
insert into t1 values(4,'Gorgey');
insert into t1 values(5,'Michal');
insert into t1 values(6,'Michel');
insert into t1 values(7,'London');
insert into t1 values(8,'Egpt');
insert into t1 values(9,'Londan');
insert into t1 values(10,'Gorgy');
insert into t1 values(11,'Gorge');the results must be as following
id word
1 London
2 Egypt
3 London
4 Gorey
5 Michal
6 Michal
7 London
8 Egypt
9 London
10 Gorey
11 GoreyNote: this is the results of soundex
SQL> select soundex(word) from t1;
SOUN
----
L535
E213
L535
G620
M240
M240
L535
E213
L535
G620
G620
11 rows selected.
View 10 Replies
View Related
Oct 13, 2012
To convert numeric value in words (for Cheque printing), I created two functions in Forms and reports 6i.
1) FUNCTION Spell (val number) RETURN CHAR IS
sp varchar2(100);
BEGIN
[code]...
2) function SPELLED_AMOUNTFormula return Char is
cents number;
c_str varchar2(80);
val number;
[code]...
This convert value up to thousands. How to convert the value more than 1 lac.
View 3 Replies
View Related
Feb 22, 2011
check out following scripts
CREATE TABLE email (
ids VARCHAR2(500))
INSERT INTO email VALUES('1233@gmail.com;3456@gmail.com;0954@gmail.com')
INSERT INTO email VALUES('7658@gmail.com;346@gmail.com;6346@gmail.com')
CREATE OR REPLACE FUNCTION is_same(emailid VARCHAR2) RETURN BOOLEAN
[code]...
how to write --emailid is present in rec.ids THEN this logic in function
View 2 Replies
View Related
May 15, 2012
i have two table menu_user_d and emp_master , the requirement is i need to match names from both these tables like i want want to match menu_user_d.user_desc to emp_master.emp_name to get the emp_id and update the correct emp_id into menu_user_d.user_emp_id , i have prepared a test case and wrote one query but could'nt succeed in getting all the matching names, is there a way i can do this correct matching and then update it automatically.
SQL> create table menu_user_d (user_id varchar2(12),user_desc varchar2(30),user_emp_id varchar2(12));
Table created.
SQL> insert all
2 into menu_user_d(user_id,user_desc,user_emp_id) values ('ARIF','Mohammed Arif',null)
3 into menu_user_d(user_id,user_desc,user_emp_id) values ('wajahat','Wajahat',null)
4 into menu_user_d(user_id,user_desc,user_emp_id) values ('Imad','Imd',null)
5 select * from dual;
3 rows created.
SQL> commit;
Commit complete.
SQL> create table emp_master (emp_id varchar2(12),emp_name varchar2(30));
Table created.
SQL> insert all
2 into emp_master(emp_id,emp_name) values ('7014','Md.Arif')
3 into emp_master(emp_id,emp_name) values ('6777','Wajahat')
4 into emp_master(emp_id,emp_name) values ('1008','Imad El Kane')
5 select * from dual;
3 rows created.
SQL> commit;
Commit complete.
SQL> SELECT USER_ID,USER_DESC,USER_emp_id,EMP_id,EMP_NAME
2 FROM MENU_USER_d,EMP_master
3 WHERE UPPER(USER_DESC) LIKE UPPER(EMP_NAME) ;
USER_ID USER_DESC USER_EMP_ID EMP_ID EMP_NAME
------------ ------------------------------ ------------ ------------ ------------------------------
wajahat Wajahat 6777 Wajahat
View 28 Replies
View Related