SQL & PL/SQL :: How To Match Two Words Matching From Two Table
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
ADVERTISEMENT
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
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
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
View Related
Jul 3, 2012
i have three tables ot_cut_head,ot_cut_det and om_mc_master based on which fourth table ot_cut_opr and fifth table ot_cut_mc must get populated , Conditions are as follows
first one is based on job_no in ot_cut_head the selection criteria will be filtered,if the job number is like '%M' then type MISC will be chosen ,if job number is '%G' then GRAT TYPE will be picked from om_mc_master (Machine Master) and operations and machines based on this will be filtered.
Second all the cd_ps_desc will be taken from ot_cut_det and will be compared with om_mc_master to get their corresponding operation codes and machine codes , there can be 2 operations or 1 operation.
Finally if the match is found record will be inserted into ot_cut_opr and ot_cut_mc ,based on the criterias and what i want is the search criteria to be more flexible and if there are 2 operations 2 rows will be inserted and if one opeation is defined in om_mc_master ,then only one record will be inserted.
We have to make sure that if based on operation number stage will be populated ,if its first operation then stage will be 1 and if its second operation the stage will be 2.like previous operation also depends on them , the second operation will have the previous operation as first operation and so on.
CREATE TABLE om_mc_master ( mc_type VARCHAR2(12),mc_prof VARCHAR2(30),mc_prep_cd1 VARCHAR2(30),mc_mach_cd1 VARCHAR2
(30),mc_prep_cd2 VARCHAR2(30),mc_mach_cd2 VARCHAR2(30));
INSERT INTO OM_MC_MASTER VALUES ('MISC','TEE SCH','IR','HO','RE','HO');
insert into om_mc_master values('MISC','Vertical Brace','R','HM','I','HO');
insert into om_mc_master values('MISC','Pipe','IR','HO',NULL,NULL);
INSERT INTO OM_MC_MASTER VALUES ('GRAT','PL','RE','HO',NULL,NULL);
SQL> SELECT * FROM OM_MC_MASTER;
[code]....
View 6 Replies
View Related
Aug 17, 2012
Oracle 10g, Windows XP
There is an interface table and there is an normal transcational table..interface table is being compared with normal table and if match found the result is dumped into another normal table.
I am using two cursors one is to query the interface table and in a for loop pass the results to the second cursor..The interface table is having 5000 + rows and the transcation table is having more than 3.7 millions ..and the program is taking lots of time to execute..took almost 35-45 minutes..
create table x_interface /* INterface table */ -- 5000 + rows
( name varchar2(80), addr_line1 varchar2(35), addr_line2 varchar2(35), addr_line3 varchar2(35),
addr_line4 varchar2(35), addr_line5 varchar2(35), addr_line6 varchar2(35), suffix varchar2(35),
city varchar2(15), state varchar2(10), zcode varchar2(10))
[code]....
View 7 Replies
View Related
Aug 10, 2011
I have a personname table which contains records of millions Person-names. My application has a requirment to return "any" 200 names that match the given Firstname and lastname entered by user.note the NOT actually "top-n", but "Any-N" , i.e. user wants "any" 200 names and NOT in any "specific order".
which is the best option to make most efficient search --
1) rownum < 201
2) row_num()
3) rank/denserank etc
View 3 Replies
View Related
Mar 15, 2010
I have two table and trying to update tableA with data from tableB but gives an error. My TableA has columns - colA,colB,colC,colX and table B has columns - colA,colB,colX. Sample data looks like this:
tableA:
XXYY, local,3/19,48
XXYY,ixc,3/19,24
XXYYlocal,3/20,48
XXYY,local,3/21,48
Table B:
XXYY,local,48
XXYY,ixc,24
PPQQ,local,72
this is the query I wrote
update tableA a
set (a.colX)=(select (b.colX) from tableB b where a.colA=b.colA and a.colB=b.colB);
When i run it gives this error:single row subquery returns more than one row.
tableB has only 1 value for colX for each colA,colB record but tableA has mutiple colA and colB repeated but for all of thsoe in table A i want to update the tableB.colX value for matching colA and colB.
View 4 Replies
View Related
May 23, 2012
TABLE 1 : COSTS
I have a table of Costs. We have Jobs that run and there will be a cost associated with a particular machine.So JobNo 1 may run on Machine A and have a cost of 50 dollars. Although its now shown below JobNO 1 could run on MachineB and so on.
JOBNO MACHINE COST
1 MachineA 50
2 MachineA 70
3 MachineA 100
TABLE 2: OPERATIONS
We have operators (PERSONCODE) run the jobs on the machines. So Job 1 may be run by PERSONCODE 8 (e.g. Tony) and it may run on MachineA or MachineB.Multipe people may run a particular job. The PERSONCODE will be unique to the Job and it is actually unique to the list. A person never works on more than one job.
JOBNO MACHINE PERSONCODE
1 MachineA8
1 MachineA7
1 MachineB6
2 MachineA3
2 MachineA2
2 MachineA1
3 MachineA4
DESIRED RESULT:
I need to assign the COSTs to the OPERATIONS table but only want it to show next to one person (next to the appropriate machine).
DESIRED RESULT:
JOBNO MACHINE PERSONCODE COST
1 MachineA8 50
1 MachineA7
1 MachineB6
2 MachineA3 70
2 MachineA2
2 MachineA1
3 MachineA4 100
[code]....
View 5 Replies
View Related
Sep 30, 2010
I'm trying to insert records of one table into another using the insert into table with select logic.
I'm trying to convert a two character value using CASE statement:
CASE REC_TYPE
WHEN '00' THEN to_number('0')
ELSE to_number('1')
END "REC_TYPE"
The target field is defined as number(1,0) and the source field is varchar2(2).
I keep getting an ORA-01861 literal does not match format string error.
View 10 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
Apr 5, 2011
I am trying to delete duplicate or repeating words in a string using regular expressions (regex) and an Oracle database.I have Googled quite a bit on this topic and was unable to track down something that fit the bill or remotely came close to paying the tip.
A pattern would be: word word start with newThe final string should look like this: word start with new Basically all the strings begin with the two words repeating.
View 7 Replies
View Related
Jan 28, 2013
from those who have created complex reports/forms using PL/PDF. done strike through sentences and words in bold within paragraphs?
View 0 Replies
View Related
Feb 14, 2013
'm using the "Highlight Words" column formating for a report. There, I'm using the item syntax: &P1_RENVOI. Problem is, when the report appear, only the first occurence of the value of item "P1_RENVOI" is in red for every field in that column.
Is this a normal feature or should all occurences be put in red?
View 0 Replies
View Related
Mar 27, 2013
My requirment is to find the top 20 most occurred words in the perticular text column accross the full table. i WILL have desc column which is plain text where user wites the essay. i have below 2 data example where i have 2 find which word occur most of the time. i have more than 1 million data where i have to perfor this calculation
E.g
INCIDENT_NOINITIAL_SD_FAULT_DESC 70000030 late entering service on the outer rail causing a 4 minute delay. After speaking to the Hainault DDM and the Hainault DMT it has been established that 70000031E105 on entering into platform by one cars lenght applied emergency brakes to stop the train due to a person under his train. Train stopped with two cars still outside the platform. I received a call from Line Controllor at 0823 hrs that a person has jumped in front of train 105 at Greenford. I informed Ian Williamson Train Operations Manager. We traveled on a special taxi with a spare Train Operator at 0839hrs and reached Greenford Station at 0859hrs. Emergency Services ( Police, London Ambulance, London Fire Brigade and ERU)
CREATE TABLE tbl_incd(
INCIDENT_NO NUMBER ,
SD_DESC VARCHAR2(4000 BYTE)
)
data for the above table
Insert into tbl_incd ( INCIDENT_NO, SD_DESC)
Values
(70000031,
'E105 on entering into platform by one cars lenght applied emergency brakes to stop the train due to a person under his train. Train stopped with two cars still outside the platform. I received a call from Line Controllor at 0823 hrs that a person has jumped in front of train 105 at Greenford. I informed Ian Williamson Train Operations Manager. We traveled on a special taxi with a spare Train Operator at 0839hrs and reached Greenford Station at 0859hrs. Emergency Services ( Police, London Ambulance, London Fire Brigade and ERU) were already on site. When spoken to Line Controlllor stated he received a normal radio call from E105 to inform him that he has got a person under his train. At 0826 Line Controllor had traction current switched off between Northolt and Greenford. Train service was suspended from North Acton to West Ruislip in both directions (east and west).
I could not speak to the Train Operator as Police was in the process of interviewing him and he was too traumatised to speak. Trauma Support was arranged from Loughton as we had no one available at West Ruislip and White City. Trauma Support spoke to T/OP over the telephone and Train Operator decided to travel in a special taxi which was booked for him on his own, although a Station Staff was was arranged to travel with him. During the process a spare T/OP stayed with this T/OP. When spoken to Mr. Clack Operations Security Manager stated he was traveling on this train from West Ruislip and made a telephone call to Network Operations Centre at 0826hrs to inform them of the situation. Mr. Clack travelled to the leading cab and confirmed that although the T/OP was badly shaken but he carried out his duties in a professinal manner by placing Short Circuiting Devise in front of the train and second SCD was placed on the rear of the track by Station Supervisor after traction current was discharged. Passengers were detrained by operation butterfly cock. Les Blaxwall Operations Standards Manager was also travelling on this train and offered his to T/OP. Mr. Blaxwall assisted in the wrong direction move and stayed till the end of the operation to assist. Wrong Direction move was carried out by T/OP Martin to assist emergency services for the track search. The deceased was an elderly of Asian origin approximately of 65yrs of age wearing white shirt, beige trauser and white trainers. When CCTV was viewed he was seen pacing up and down on the east bound platform near the waiting room. On approach of T105 he jumped in front of the train at 0824hrs and train stopped with two cars outside the station. The body was removed from platform at 0940hrs by ERU and taken in a body bag to the secure room at Greenford Station. Track was accessed by BTP to carry out track search for any trace of identification at 0932hrs and gave all clear at 0942hrs.
TOM Williamson assisted in closing the train doors by operating the butterfly cock to close position. Traction Current was switched on at 0948hrs and T105 was worked empty to North Acton and reversed to Ruislip Depot. All clear was given at 0951hrs and after station search, Greenford Station was re opened at 0955hrs. E142 was the first train to run in service on the east bound. Body was removed at 1013hrs from Greenford Station and taken to Uxbridge by the police. Trauma Support was offered to Station supervisor by his DSM, but he declined the offer. Service Manager and Line Controllor were kept informed by myself.');
Insert into tbl_incd ( INCIDENT_NO,SD_DESC)
Values
( 70000032'PART OF TRAIN WITHDRAWAL Train 17 had a 6 min delayed departure from White City due to the train having a defective speedometer. Train was changed over and dud train was sent to Ruislip Depot for the attention of the DDMs staff. Ruislip DDM confirmed that the speedometer was defective. This was traced to a defective ATP controller.');
Insert into tbl_incd ( INCIDENT_NO, SD_DESC)
Values
( 70000033,' had a 1 min delayed arrival at Ealing Broadway due to the train having problems at signal EAB2058. The T/op stated that the train was in ATO and was stopped at the red signal (2058). The signal cleared and the train moved forward, the signal went straight back to red and the train stopped. This happened once again. The train did not pass the signal. T/op contacted the Line controller via radio and the signal was cleared, with the train proceeding into the platform at Ealing Broadway. The train was taken to Hainault for the attention of the DDM and a download. Train download and Tracker net confirm the T/op`s account of events. Due to the serious implications of events, an investigation is being undertaken by the Duty Engineer at Wood Lane. The T/op carried out his duties in a professional and correct manner and informed the passengers of the situation as and when required.');
COMMIT;
View 8 Replies
View Related
Dec 19, 2012
I have one table employee where there are 4 fields ,emp_code,emp_locn,emp_job_code,emp_job_desc the problem is i am trying to prepare a group reports based on location and emp_job_code there is a duplication of data in the emp_job_desc ,
For example there is a job_code E2 Which has two different job_descriptions for two different employees like E2-PAINTER-SPRAY, E2- PAINTER -SPRAY, another example is E1-rigger , E2-RIGGER and so on.Is there a method to match them together as one description.
View 7 Replies
View Related
Dec 11, 2012
When I pass the input as 'micky', then i should get the count of records as 4. I tried to use REGEXP_LIKE, but could not get the result.
Test Case:
DROP TABLE test1;
CREATE TABLE test1( pattern_series VARCHAR2(30));
INSERT INTO test1 VALUES ('qa_micky1');
INSERT INTO test1 VALUES ('qa_micky2');
[code].....
-- I should get the output as 4 not 8
View 5 Replies
View Related
Jul 2, 2013
I am using 11.2.0.3.0 version of oracle. I have not worked on regular expressions. During working on sql injection, I got set of below patterns which is feeded to some JAVA regx classes or utilityto restrict selective Request, based on patterns.below patterns and the characters which will be restricted by this pattern matching utility.
Given below are 3- patterns:
(.*?[sd)'])(?:AND|OR)(?=[s-+(']|.?d)(s*[-+(]?s*(?:[^s!<>=]+?|'.*?')[s)]*(?:s*(?:(?:[-+/*(.]||s*|)s*)+(?:[^s!<>=]+?|'.*?')[s)]*)*s*)(?: <s*>|>s*=|<s*=|!s*=|=|>|<)(.*)
(.*?[sd)'])(?:AND|OR)(?=[s-+(']|.?d)(s*[-+(]?s*(?:[^s]+?|'.*?')[s)]*(?:s*(?:(?:[-+/*(.]||s*|)s*)+(?:[^s]+?|'.*?')[ s)]*)*s*)(? <=[s)']|d.?)(?:LIKE|IN|BETWEEN)([s-+('].*)
.*[sd)'](?:AND|OR)[(+-s]*(?:'.*?'|.?d[ds-+/*().]*)[)s]*(?:<s*>|>s*=|<s*=|!s*=|=|>|<|LIKE|IN|BETWEEN)[(+-s]*(?:(+s*SELECT)?[(+-s]*(?:'.*?'|.?d[ds-+/*().]*).*
View 1 Replies
View Related