PL/SQL :: Counting Particular Word In String?

Jul 17, 2012

Have a query to find the occurence of a particular word in a string using a query.

ex: str := 'a,b,a,c,d'

search_str := 'a'

=> need to get the number of times 'a' is getting repeated in the string str.

output: 2

View 9 Replies


ADVERTISEMENT

SQL & PL/SQL :: How To Get First Word From String

Aug 22, 2013

how to get first word from string.example i have string like:-

Jack Bore American
Mark D'suz Australian
Raj
Deniel indian
Some

i am expecting first word as out put like :-

jack
mark
Raj
Deniel
Some

in the same maner if i want should get two words also.

View 36 Replies View Related

SQL & PL/SQL :: How To Retrieve First Letter Of Every Word From String

Oct 4, 2013

I want to retrieve first letter of every word from the string.

For ex. if string is "Computer Science Engineering (New)" then I want "CSE" or if string is "Mechanical Engineering" then "ME".

how to do this..

View 18 Replies View Related

SQL & PL/SQL :: How To Extract First 3 Characters From Each Word In A String / Sentence And Separate With Underscore

Oct 22, 2013

I have some strings like

'Net Amount Payable by an Individual',
'Net Amount Payable by an Individual+Tax',
'Total Amount Payable towards Service',
'Total Amount Payable towards Service.+Tax'

I need to extract the first three letters from each word and separate them using an underscore. The output should be as follows for the above strings -

Net_Amo_Pay_by_an_Ind
Net_Amo_Pay_by_an_Ind_Tax
Tot_Amo_Pay_tow_Ser
Tot_Amo_Pay_tow_Ser_Tax

I request to let me know the way to get the ouput as mentioned.

View 4 Replies View Related

SQL & PL/SQL :: Counting Occurrences Of Max Value?

Feb 19, 2011

I have a table "exam results"

create table eresults
(student_name varchar2(20),
section_name varchar2(4),
exam_id NUMBER (4))
marks NUMBER (3))

[code]....

My requirement is that I need another column named "top scored" which will show how many times each student took highest marks for his Section in each exam_id"

For example in above data the following students "Top scored" for thier respective section in each exam_id:

STUDENT_NAME SECTION EXAM_ID
DOLLY A 1
RIZWAN B 1
PAUL C 2
ZAKIR D 2

[code]....

So, based on above my requirement is as below

STUDENT_N SECTION_NAME COUNT(EXAM_ID) SUM(MARKS) MAX(MARKS) top_scored
ALEENA C 2 147 91 0
ASIM D 2 68 45 1
ASLAM B 2 70 56 0
ATIF D 2 2 2 0
AYSHA B 2 114 78 0

[code]....

View 1 Replies View Related

SQL & PL/SQL :: Counting Followed Last Occurrences

Jul 4, 2013

the following conundrum.

Having the Following information:

Col A Col B
---------------
134 | 1049
0 | 1050
12 | 1051
0 | 1052
0 | 1053
0 | 1054
0 | 1055
0 | 1056
0 | 1057

What I want is to count the number of the similar occurrences on Col A starting from the bottom and stopping at the first that is different.

Taking the example above I would get 6, that is the number of repeated "0" from the last value "1057" until "1052".

View 15 Replies View Related

Counting People With Same Birthdays

Jun 30, 2008

I have a q, If i have:

table1(p_id, birth_date,lid)
table2(lid)
table3(s_id, birth_date, lid)

Now i would like to count from table 1 all p_id with birthday is the same as a s_id.Currently i am doing this:

select s_id, count(tbl1.pid)
inner join table 3
using (lid)
inner join table 1
using (lid)
Where to_char(tbl1.birth_date,'DD') = to_char(tbl2.birth_date,'DD') AND
to_char(tbl1.birth_date,'MM') = to_char(tbl2.birth_date,'MM')

when i check it using data, i get a target_id whose birth_day is same as TWO people in tbl1 yet according to that query i am only getting ONE person! rest of the results from that query look fine!

View 6 Replies View Related

SQL & PL/SQL :: Counting Partners Who Appeared Together With Each Other?

Nov 27, 2011

I have a table t

create table T
(player varchar2(40),
for_team varchar2(10),
Vs_team varchar2(10),
matchid number,

[code]...

Note: Each player can appear for more than one team in different matches. For exmaple, John appeared for Team A in matchid = 1 and then in matchid = 2 he appeared for team B. So same could be for other players

Requirment: I want for each player, the sum of total number of matches and points (which is easy using SUM) but along with total number of different teammates he played with in all the matches he appeared [for his team(s)] and also the total number opposition players and lastly the total number of different players he played with in all the matches he appeared in.

Just to clarify some terms, incase any doubt:

Here teammates = all players who appeared (for_team) in a match from the same team for whom the respective player also appeared in the same match.

opposition players = all players who appeared for VS_team played by each player.

total different players = all unique players who appeared for for_team or vs_team in the matches in which each player appeared.

Here is my desired outout:
Player total Matches Sum(points) Different teammates Different opposition players total different players
player played with player played with player played with
John 3 4 5 5 10
Fulton 2 11 3 4 6
Sarah 1 9 2 3 5

[code]..

I want one simple query and shortest query to achieve about output since in my actual table data is huge.

View 4 Replies View Related

SQL & PL/SQL :: Counting Rows Of All The Tables In Database?

May 18, 2010

i work on oracle 8i with around 950 tables in my database. when i export or import it gives me the no of rows exported / imported from each table. is it possible to take a print out of the no of rows in each table through a single query .

select count(*) from each table takes a long time , since there are 950 tables.

View 4 Replies View Related

SQL & PL/SQL :: Counting Records Within A Date Range?

Nov 1, 2011

I am trying to write part of an SQL where it gives me a count of bookings in any 6 month period made from the first booking.Example of records

enquirynumberenquiryaddresssubjectcodebookingdate
613651 Burberry AvenueBCHR20/10/2008 07:00:00
613801 Burberry AvenueBCHR20/11/2008 07:00:00693021 Barberry AvenueBCHR07/09/2009 07:00:00

I am so far getting 3 as a count result based on SQL below. I want the count to return 2 (because its inside the 6 month range):

SELECT
ce1.enquirynumber,
ce1.enquiryaddress,
es1.subjectcode,
b1.bookingdate,
(SELECT count(b2.bookingdate)
[code]....

View 2 Replies View Related

Counting Rows - Difference In Values That Are Returned?

Sep 26, 2010

difference in the values that are returned?

select count(*) from aaa;
COUNT(*)
----------
1000001

select num_rows from dba_tables where table_name = 'AAA';
NUM_ROWS
----------
994202

View 5 Replies View Related

SQL & PL/SQL :: De-normalizing A Log Table And Counting Distinct Rows?

Oct 6, 2011

I have a table in which I can see via which communication channel we have previously communicated with our customers on different dates.

customer_interaction_log (I removed the date column)

customer_id channel
------------------------
1 SMS
1SMS
1SMS
1Email
1Email
2SMS

My goal is to have a de-normalized summary table in which total communication volume for each distinct channel is displayed per customer.Briefly, I would like to reach the following output

customer_interaction_summary

customer_id sms_countemail_count
-----------------------------------
132
210 (or null)

When I run the sql below I am not able to de-normalize by customer id; counts are accurate.

SELECT distinct cil.customer_id,
(CASE channel WHEN 'SMS'
THEN (SELECT COUNT (channel) FROM customer_interaction_log cil1
where cil1.channel='SMS' and cil1.customer_id=cil.customer_id) END) SMS_COUNT,
(CASE channel WHEN 'Email'
THEN (SELECT COUNT (channel) FROM customer_interaction_log cil2
where cil2.channel='Email' and cil2.customer_id=cil.customer_id) END) EMAIL_COUNT
FROM customer_interaction_log cil;

Output:

customer_id sms_countemail_count
-----------------------------------
1 3
21
1 2

I am trying to have one row per customer, however as you can see above it is not the case.

CREATE TABLE CUSTOMER_INTERACTION_LOG (
CUSTOMER_ID NUMBER(2),
CHANNEL VARCHAR2(10 BYTE)
);
Insert into customer_interaction_log (CUSTOMER_ID, CHANNEL) Values (1, 'SMS');
Insert into customer_interaction_log (CUSTOMER_ID, CHANNEL) Values (1, 'SMS');

[code].....

View 7 Replies View Related

PL/SQL :: Counting The Number Of Lines For Each Procedure In A Package

Jul 31, 2012

I would like to write a query on USER_SOURCE that can display the number of code lines for each procedure/function in a package. Is it possible to write such a query? Maybe by using analytical functions?

for example in the following example i would like to count the lines between

"PROCEDURE proc1 IS" and "END proc1;" and between "PROCEDURE proc2 IS" and "END proc2;"
SQL> select text  from user_source where name='PKG_TEST' and type='PACKAGE BODY';

TEXT
--------------------------------------------------
PACKAGE BODY PKG_TEST IS
/*************************************************
****/
PROCEDURE proc1 IS
BEGIN
update t1 set EDITION_NAME = 'AAAAAAA';
commit;
END proc1;
[code]....

View 14 Replies View Related

SQL & PL/SQL :: Counting Distinct Occurrences Of Data From Multiple Columns

Feb 4, 2013

CREATE TABLE FEB05
(NAME VARCHAR2(20),
CITY VARCHAR2(20))
INSERT INTO FEB05 VALUES ('AKON','CIT22')
INSERT INTO FEB05 VALUES ('MARIA','WOT101');
[code]......

I WANT A QUERY THAT WILL GIVE O/P AS TO GET DISTINCT COUNT OF NAME AND CITY COLUMN separately.

I.E. THE O/P SHOULD BE

Quote:Count(dist name) Count(dist city)
6 5

View 5 Replies View Related

Server Utilities :: Counting Position Of Data In Fixed Format?

Sep 5, 2010

How the people in production counts the exact position of the data in fixed format of Sql*loader? Isn't it critical especially in a critical and having many column to be inserted.

View 6 Replies View Related

SQL & PL/SQL :: Function To Duplicate The Word

Apr 13, 2012

function to duplicate the word

example member

result will be meber

View 11 Replies View Related

SQL & PL/SQL :: Possible To Do Specific Word Count

Jan 24, 2011

Can we do a specfic word count in sql. Requirement is there is a string "I am very very poor in sql" the word "very" occurs two times, so the result should be 2.

View 16 Replies View Related

SQL & PL/SQL :: Oracle - Word Bookmark?

Jun 12, 2013

.I am actually collecting data from Oracle and create bookmarks on a word document which correspond to these data and auto-complete it.

I had not any important problem until that I had a case where I do not know the number of data I am going to get in the end. Do not know how much bookmarks I should create as I don't know the number of rows I am going to get after executing my query.

View 33 Replies View Related

SQL & PL/SQL :: Letter Generation In Word?

Jul 2, 2012

i need to write to word doc from pl/sql . these are letters which needs to printed . Can i use the same UTL_FILE and will i be able to control the font etc from pl/sql

View 6 Replies View Related

SQL & PL/SQL :: Upload Word File

Aug 9, 2010

i want to upload a word file to database.I wrote the following code

create or replace directory MY_FILES as 'C:Uploadfolder';

Create table emp1(
EMPNO number(30),
EMPNAMe varchar2(10),
RESUME BLOB);

[Code]....

ERROR at line 1: ORA-22288: file or LOB operation FILEOPEN failed No such file or directory ORA-06512: at "SYS.DBMS_LOB", line 523 ORA-06512: at line 10

View 32 Replies View Related

ORA-02085 - Database Link String Connects To String

Jun 19, 2012

I have this error (and solution):

ORA-02085: database link string connects to string

Cause: a database link connected to a database with a different name. The connection is rejected.

Action: create a database link with the same name as the database it connects to, or set global_names=false.
Where should I set global_names=false ?

View 7 Replies View Related

Data Migration From WORD To ORACLE?

Sep 20, 2011

I have a long file in WORD as I try to load it in ORACLE quotes become periods, ex:

insert into mytab values ('myname, 26);

when i copy this and paste it in oRACLE (UNIX environment), it translates as insert into mytab values (.myname.,26)..does not recognize the quotes.

I tried copying from word to notepad to ORACLE same problem..

View 5 Replies View Related

How To Convert PDF To Office Word File

May 26, 2012

I download a pdf file,but I want to use it in the office word,who knows how to convert it?

View 11 Replies View Related

Forms :: Printing A Word Document

Feb 9, 2011

I have This Code working on the local form builder after starting the oc4j and run the form. but using OLE2.

but when using the Cleint_ole2 on the application to invoke an object on the client machine.

but nothing happend, while i have tested the webutil configaration and its working fine.

i use this code to print any word document without openning it. and here is the code in when_button_pressed

DECLARE
application CLIENT_OLE2.OBJ_TYPE;-- Declare a object OLE
args CLIENT_OLE2.LIST_TYPE; -- Declare List of Parameters to obj. OLE
begin
application := CLIENT_OLE2.CREATE_OBJ('WORD.Basic'); -- Start a process WordBasic
args:= CLIENT_OLE2.CREATE_ARGLIST;-- Create a list of Parameters
-- Add param. file_name with path(x. c: empmy.doc) :blk01 is my block

[Code]...

View 1 Replies View Related

SQL & PL/SQL :: Escape Special Character Word

Jan 7, 2011

E1 Table Data

Job_id
Sa_Clerk
Sa_Manager
Sahil

select job_id from E1 where instr(job_id,'_')>0;

returns output

Sa_Clerk
Sa_Manager

same as

select job_id from E1 where job_id like 'Sa_\%' escape '';

resturns

Sa_Clerk
Sa_Manager

Same Result , Then What is exact need of Escape

View 4 Replies View Related

SQL & PL/SQL :: Counting NULL Vs NON-NULL In A GROUP BY Clause

Jun 21, 2010

I am running a GROUP BY query on a few columns of enumerated data like:

select count(*), Condition, Size
group by Condition, Size;

COUNT(*) CONDITION SIZE
-------- ---------- --------
3 MINT L
2 FAIR L
4 FAIR M
1 MINT S

Well, let's say I also have a timestamp field in the database. I cannot run a group by with that involved because the time is recorded to the milisec and is unique for every record. Instead, I want to include this in my group by function based on whether or not it is NULL.

For example:

COUNT(*) CONDITION SIZE SOLDDATE
-------- ---------- -------- ----------
3 MINT L ISNULL
2 FAIR L NOTNULL
2 FAIR M NOTNULL
2 FAIR M ISNULL
1 MINT S ISNULL

View 9 Replies View Related

SQL & PL/SQL :: How To Find Whether Exact String Is Present / Not In Given String

Mar 14, 2013

I'm facing some problem even after using INSTR function in Oracle.The problem is I have written the logic in the PL/SQL block which appends all the values fetched in a loop on the basis of whether the string is present or not.

For ex:

The first value fetched from the select query first is ABCDEFG which gets appended to a variable
The next value fetched is AB even this has to be appended to the variable since this exactly doesn't match with ABCDEFG.
The next value fetched is BCDEF even this has to be appended to the variable since this exactly doesn't match with ABCDEFG.
The third Value fetched is ABCDEFG this will not get appended presently according to the logic which is correct.

writing that piece of code to append the value fetched which doesn't exactly match with the existing string

View 3 Replies View Related

Forms :: Open New Word Document And Delete It?

Mar 26, 2013

i have one word doc file name is sample.doc

i have 3 buttons in my canvas. 1st button is to open a word document.

codings:

declare
AppID PLS_INTEGER;
begin
AppID := DDE.App_Begin('D:Program FilesMicrosoft OfficeOffice12winword.exe F:DevSuiteHome_1formssamples.doc',DDE.APP_MODE_NORMAL);
end;

2nd button:

i want to delete the existing sample.doc file via forms

i dont know the codings.

View 2 Replies View Related

Reports & Discoverer :: Masking Number To Word

May 21, 2013

I just want to know whether we can mask salary column of number datatype into text ,like we used to_char(to_date(<column_name>,'j'),'jsp') in sql? for example

Name Salary
SMITH 800

to
Name Salary
SMITH EIGHT HUNDRED

View 5 Replies View Related

Windows :: Data From Oracle To Microsoft Word

Jun 30, 2011

I need to create a doc file using Microsoft Word where I can get data from an Oracle DB.

I search on MS Word, for something like ODBC (like in Excel and Access) but in vain.

I need to do this so I can format the data on the doc file in any way I want. Not like in Oracle Reports, where formatting is a little bit restrictive.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved