SQL & PL/SQL :: Query To Eliminate Multiple Spaces?

Mar 5, 2010

I need to eliminate the blank spaces based on below conditions Consider name column with a value as

Input : "sa c h in Te nd ulka r" where "Sachin" is first name and "Tendulkar" is last name. there is more than 1 space between sachin and tendulkar (here its not displaying properly)

Condition :Second name is seperated from first name with more than 1 spaces and others are with 1 black space. I need to get result as Output:"sachin Tendulkar" ( there should be 1 blank space between first and last name in result.)

View 3 Replies


ADVERTISEMENT

SQL & PL/SQL :: Eliminate Spaces Between Values

Nov 2, 2011

i can't eliminate the spaces between values, i tried to use rtrim but still failed.

Set pagesize 0
set linesize 1000
set heading off
set feedback off
set colsep '|'
SELECT '200', '20002977', T0.TP, T0.Description, T2.FirstName, T2.LastName, 'Geography Code', SUBSTR(T3.aoManager, -6,5)
[code]....

View 6 Replies View Related

SQL & PL/SQL :: Remove Blank Spaces In The Query Output

May 6, 2010

I write a Query to get Deptno wise Employee Names as fallows..

SQL> select max(decode(d.deptno,10,e.ename)) dept10,
2 max(decode(d.deptno,20,e.ename)) dept20,
3 max(decode(d.deptno,30,e.ename)) dept30
4 from emp e,
5 dept d
6 where e.deptno = d.deptno

[code]....

But i don't want to include the blank(null) spaces in the query output.

The Required output should be like this..

DEPT10 DEPT20 DEPT30
------ ------ ------
CLARKADAMSALLEN
KINGFORDBLAKE
MILLERJONESJAMES
SCOTTMARTIN
SMITH TURNER
WARD

View 5 Replies View Related

Way To Eliminate Duplicates

Jun 11, 2013

I have a table like below:

tableA
aid des
1 concrete
2 wood
3 straw
4 plastic
5 fiber glass
6 other

tableB
bid material
01 1
02 2
03 3
01 2
01 2
02 3
01 5

The result I need when updating another table with this info is:TableC
edw_id bid Requirement
021 1 concrete, wood, fiber glass
032
025
123
521

I do not want :
concrete, concrete, concrete, wood, wood, fiber glass

SO far I am using the following but since I am dealing with hundreds of column that has the same material, when using listagg() from oracle 11.2g, they column width is too wide to fit into the required column.

update eris_data_work e set E.flex37 =
(select
LISTAGG(CM.des, ',') WITHIN GROUP (ORDER BY CM.des) AS casing_material
from CODE_CASING_MATERIAL CM, TBLCASING CA
where CM.code=CA.MATERIAL and CA.well_id=E.owner_oid AND CM.DES IS NOT NULL
GROUP BY CA.well_id)
where E.source='WWIS_ON'

I have even used the regexp_count() to try to eliminate duplicates however I have had no success so far

View 4 Replies View Related

Using <> To Eliminate Two Codes?

Mar 17, 2009

I am writing my first procedure and need to exclude two codes from a list of receipts. I can probaby use the following

and rc_receipt_code in (1, 2, 3, 4, 7, 8)

however can I use <> to eliminate 2 codes for instance can I say

select NVL(sum(rc_amt), 0)
into tot_cont
from trefrc
where rc_filer_seq = filer
and rc_receipt_code <> (5, 6);

View 1 Replies View Related

SQL & PL/SQL :: Search Spaces In Column

Mar 15, 2010

in my databse i have column name as email_id

in this column email id of cutomers are stored but in some emaild contains space

i want to find out such email id

View 3 Replies View Related

Eliminate Duplicate Rows

Jan 27, 2009

I have to eliminate duplicate pairs from the following data set.

for ex. Adney Vaughan and Berkly Wassen appears in both AG1 and AG2. how can i get rid of these repititive rows?

AG1 ----------- AG2
Acton Wibert ---- Currier Barhydt
Adney Vaughan --- Luella Edmund
Adney Vaughan --- Berkly Wassen
Alden Anstruther --- Courtney Gavet
Ashley Alvord --- Saunders Buel
Aswin Wilbraham --- Dale Cooper
Barnum Sears --- Grayson Lightfoot
Berkly Wassen --- Luella Edmund
Berkly Wassen --- Adney Vaughan
Bersh Musgrave --- Derward Knight
Berthilda Darrell --- Broderick Reynold
Broderick Reynold --- Berthilda Darrell

View 1 Replies View Related

SQL & PL/SQL :: How To Eliminate And Separate String

Apr 29, 2011

In my table i have a field called swistmsg, which contains value as

:201:0001OTT11000004|:23b1:CRED|:32a1:01-01-2011|:32a2:USD|:
32a3:1000.|:33b1:USD(similarly around 100 rows)

and my requirement is

201 0001OTT11000004 23b1 CRED 32a1 01-01-2011 32a2 USD 32a3 1000 33b1 USD

and i have eliminate '.',':'&'|' (only quoted chars)from the string separate string

View 17 Replies View Related

SQL & PL/SQL :: Eliminate Default Time 12:00 Am

May 10, 2012

I have a table with Date Field . While selecting the records its display like below format.

TO_CHAR(CHAR_DATE,'DD-MM-RRRRHH:MI:SSAM')

10-05-2012 12:00:00 AM
10-05-2012 03:26:16 PM

1 row doesnt have time, but in default it shows 12:00:00 AM, how to eliminate it. Display should be

10-05-2012
10-05-2012 03:26:16 PM

create table time_test (char_date date);

INSERT INTO TIME_TEST ( CHAR_DATE ) VALUES (
TO_Date( '05/10/2012', 'MM/DD/YYYY HH:MI:SS AM'));
INSERT INTO TIME_TEST ( CHAR_DATE ) VALUES (
TO_Date( '05/10/2012 03:26:16 PM', 'MM/DD/YYYY HH:MI:SS AM'));
COMMIT;

select TO_char(CHAR_DATE,'dd-mm-rrrr HH:MI:SS AM') from time_test;

i need in to_char only, im using it in reports

View 4 Replies View Related

How To Handle Spaces In Path Name Of File With PL/SQL

Apr 10, 2009

How do I handle spaces in the path name of a file with PL/SQL? This is what I am trying to do.

start f:folder namefolder name with spacesfoldernamescript.sql

I keep getting an error:

"The file 'f:folder.sql' does not exist."

Is there a special character I need to put in there for the spaces? How can I get this to work?

View 3 Replies View Related

PL/SQL :: Remove Spaces Between Two Number From A Varchar2?

Oct 18, 2012

I have a question respect to remove spaces from a varchar2.

The varchar2 is '7987451 1234567' and i need that string like '7987451 1234567', because the field has a length of 15.

i try with this, but does nothing

Select TRIM('7987451 1234567') from dual

Other possibilities are find several spaces and try to replace with only one, but would a heavy work (may be with sentences Loop).

This problem is now in our loading processes. Exists some function to replace spaces between numbers of varchar2?

View 2 Replies View Related

Forms :: Cuts Off Spaces At The End Of Textfields?

Oct 30, 2012

forms cuts off spaces at the end of textfields.

Is there any way to prevent it?

View 2 Replies View Related

SQL & PL/SQL :: How To Eliminate Duplicate Values From Table

Nov 24, 2011

I need to delete the duplicate values from plsql table OR move the distinct values in plsql table to other plsql table.

how can i do this ?

DECLARE
TYPE alist IS TABLE OF VARCHAR2(10) INDEX BY BINARY_INTEGER;
p_tbl alist;
BEGIN
p_tbl(1) := 'A1';
p_tbl(2) := 'B2J';
p_tbl(3) := 'A1';
[code]......

The p_tb1 table contains all the above values including duplicates. Now I need only distinct values to be copied in another plsql table of same type.

View 14 Replies View Related

PL/SQL :: How To Eliminate Null Rows From The Result Set

Jul 10, 2012

My requirement is as follows .

Oracle version details
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
CORE     11.1.0.7.0     Production
TNS for 32-bit Windows: Version 11.1.0.7.0 - Production

[code]....

View 6 Replies View Related

PL/SQL :: How To Eliminate Duplicates From Record Types

Aug 21, 2013

How to eliminate duplicates from record types?Below code errors out with "Wrong number of arguments in call to MULTISET...."

error. DeclareTYPE ln_x_tab IS RECORD(x1 number ,x2 VARCHAR2(4000) ,x3 VARCHAR2(4000) ,x4 VARCHAR2(4000) ,x5 VARCHAR2(4000));  TYPE  ln_x_type IS TABLE OF ln_x_tab INDEX BY BINARY_INTEGER; ln_x1 ln_x_type; ln_dist_x1  ln_x_type; gc_stmt     varchar2(4000); Begin   gc_stmt := ' SELECT x1, x2, x3, x4, x5 FROM table WHERE dynamic_conditions;    EXECUTE IMMEDIATE gc_stmt BULK COLLECT INTO ln_x1;  ln_dist_x1:=      ln_x1 MULTISET UNION DISTINCT ln_x1; End; 

I need ln_dist_x1 to have distinct records from table.

View 12 Replies View Related

Reports & Discoverer :: Removing Spaces From Top Of Report

Aug 18, 2010

I am using 10g reports.

I created a report (its basically a statement) without a header. When I run the report, blank lines appear at the top of the report before the details start printing. How do I get the report to print from the top of the page without leaving any blank lines.

View 3 Replies View Related

SQL & PL/SQL :: Procedure To Remove Extra Spaces In Strings

Feb 17, 2011

I would like to create a procedure in oracle to remove extra spaces coming as blank spaces(squared ones)in strings.

View 32 Replies View Related

Client Tools :: How To Remove Spaces After Data

Aug 14, 2012

I have a little problem, using SQLPLUS I use "set linesize 300", so in the END of output file file. I got spaces after info ! I mean

select client_id || ';' || date || ';' || amount info
from table

1;FEB-2012;5000........
2;DIC-2011;10000.......
500;MAR-2012;300000.... (. = spaces)

How I remove spaces after Data ?

View 5 Replies View Related

How To Eliminate Windows NT Authentication In Oracle DB Server

Feb 18, 2013

I have oracle database server set with Windows NT authentication. How can I get rid of this kind of authentication as this is holding up additional Windows Domain with its own PDS and so on. Or is it possible to move Oracle Database server to a different Domain and authentication to be coming from new domain?

View 4 Replies View Related

SQL & PL/SQL :: Using Regexp_replace To Eliminate Duplicate String With Delimiter

Sep 11, 2013

I'm trying to eliminate duplicate string for more than 1 occurrences along with its delimiters, but couldn't get it working. Here is what I tried.

SQL> column str format a30
SQL> column replaced format a30
SQL> with x as
2 (select 'a#~#b#~#a#~#d' as str from dual union all
3 select 'a#~#b#~#c#~#a' as str from dual union all
4 select 'b#~#a#~#c#~#a' as str from dual)
select str,
regexp_replace(str, '[^a|#~#a]{2,}','',1,2) replaced
from x; 5 6 7

STR REPLACED
------------------------------ ------------------------------
a#~#b#~#a#~#d a#~#b#~#a#~#d
a#~#b#~#c#~#a a#~#b#~#c#~#a
b#~#a#~#c#~#a b#~#a#~#c#~#a

The output I need is
a#~#b#~#d
a#~#b#~#c
b#~#a#~#c

View 12 Replies View Related

SQL & PL/SQL :: Write A Function To Eliminate SUNDAY AND SATURDAY?

May 9, 2012

i need to write a function to eliminate SUNDAY AND SATURDAY;

My criteria is

if My date as (5/19/2012 ) and i want to add 10 days to it themn my function should return 06/01/2012
if My date as (5/13/2012 ) and i want to add 12 days to it themn my function should return 05/29/2012

View 11 Replies View Related

SQL & PL/SQL :: Eliminate Donor With Multi Topic Code

Apr 27, 2012

Below is an overs implication of what I need to extract from a donor list and am having some difficulty pulling the correct targets. I need to pull a donor who has had only one topic in the past year.

I only want id number 100 and not 120 since 120 has three topics in the past year, I tried using not exists...etc and can't seem to get the donors with the one topic 'HC' that is being requested.

example:

create table Topic(Idnumber number(8),topic varchar2(4));
INSERT INTO Topic(idnumber,topic)
VALUES (100, 'HC')
/
INSERT INTO Topic(idnumber,topic)
VALUES (120, 'HC')
/
[code].......

IDNUMBER TOPI
---------- ----
100 HC
120 IRS
120 PRS
120 HC

SQL> select idnumber from topic where topic in('HC');

IDNUMBER
----------
100
120

SQL> select idnumber from topic where topic in ('HC') and topic not in('IRS','PRS');

IDNUMBER
----------
100
120

View 12 Replies View Related

JDeveloper, Java & XML :: Removing White Spaces From Arraylist

Mar 30, 2012

I'm trying to remove whitespaces from user input of an ArrayList.

.trim() method for String, but what's the method for ArrayList?

View 1 Replies View Related

SQL & PL/SQL :: Remove Spaces By Excluding Double Quotes From A String

Oct 29, 2012

I want to remove more than one space from a string by excluding double quotes.

For example:

I/P: Item .getChildByType(" Agreement").getParent( ) .hasChildByType("Agreement ")

O/P : Item.getChildByType(" Agreement").getParent().hasChildByType("Agreement ")

View 17 Replies View Related

Server Utilities :: Migration From Postgres Into Oracle Columns With Spaces

Jul 21, 2010

I have migrated from postgres to oracle entire databases however some tables have spaces how can they be removed and how can i found out all the tables in a schema with spaces?

View 8 Replies View Related

Client Tools :: How To Eliminate Blank Lines In Between Queries In Output

Apr 28, 2010

I am spooling to a text file some output for a client. The file has 4 queries in it, one creates a header row, another a comment row, another the data rows and finally a trailer.

Code looks something like this:

/*
Custom Extract
Project: Plan Data Extract
Product: EOWin 4.02 - Oracle db
Use: Script to create above extract and spool results to text file
Input Parameters: &1 Path and name of output file
*/

[code]....

and the output looks like this:

HDR,04272010,Plan Data

CMT,Plan Num,Plan ID,Plan Name,Shares Allocated

DAT,1,01,Plan 01,99999999
DAT,2,02,Plan 02,99999999
DAT,3,03,Plan 03,99999999
DAT,4,04,Plan 04,99999999
FTR,4

but the client and I want the output to look like this with no blank lines in between the queries:

HDR,04272010,Plan Data
CMT,Plan Num,Plan ID,Plan Name,Shares Allocated
DAT,1,01,Plan 01,99999999
DAT,2,02,Plan 02,99999999
DAT,3,03,Plan 03,99999999
DAT,4,04,Plan 04,99999999
FTR,4

View 3 Replies View Related

Multiple Condition Query

Jun 3, 2011

I have a result of Query like this:

Col1 Col2 Col3
T1 15 20
T1 18 19
T1 5 20
T2 15 20
T2 18 19

And I just need to display only the T's that would meet the condition Col2 in (15,18) and Col3 in (20,19).

I try with a condition where col2 in (15,18) and col3 in (20,19) and that works, but I don't need to display T1, because T1 has a Col2=5 and Col3=20, I just have to display T2 that just satisfies all my conditions, Col2 in (15,18) and Col3 in (20,19). It's something like a vertical search.

View 2 Replies View Related

SQL & PL/SQL :: Query From Multiple Databases

Apr 14, 2010

I have a query that queries an Oracle 10g database see below

SELECT PLOGDBY, COUNT(PLOGDBY) AS "Calls Logged"
FROM LCC_TPROBLEM WHERE
(PLOGDBY = 'WOODWARD_A' OR

PLOGDBY = 'BASSETT_A' OR
PLOGDBY = 'MISTRY_R' OR
PLOGDBY = 'MEADOWS_K' OR
PLOGDBY = 'SKINNER_R' OR
PLOGDBY = 'DAVIS_Z' OR
PLOGDBY = 'BLOUNT_L' OR

[Code]...

This gives me the result:

PLOGDBY Calls Logged
DAVIS_Z 11
MEADOWS_K 26
MISTRY_R 47
PATEL_RI 53
SKINNER_R 21
THANDI_D 58
WOODWARD_A 30

I also have a query that queries a SQL Server database:

Select Agent, SUM([acd calls which have rung the agent])As CallsRung
FROM Dashboard_stats
Where Date = DATEADD(DAY,DATEDIFF(DAY,'20000101',GETDATE())-1,'20000101')
Group by Agent

This gives me the result:

Davis_Z22
Meadows_K31
Mistry_R54
Patel_R65
Skinner_R35
Thandi_D89
Woodward_A34

What I want to do is write a query that returns the result:

Query 1(Oracle database) as a percentage of Query 2 (SQL Server database)

Results would be:

Davis_Z50%
Meadows_K83%
Mistry_R87%
Patel_R81%
Skinner_R60%
Thandi_D65%
Woodward_A88%

View 4 Replies View Related

SQL & PL/SQL :: Query With Multiple Columns

Dec 17, 2012

Table-Name

ID Status description Tracking ID
1 Strat Frog 1
2 Start Dog 2
3 Process Frog 1
4 Completed Dog 2
5 Start Rabbit 3
6 Error Frog 1
7 Stop Rabbit 3
8 Start Elephant 4
9 process Elephant 4
10 Start Human 5
11 Stop Human 5
12 Start Butterfly 6
13 completed Butterfly 6
14 start lion 7
15 error lion 8
16 complted lion 8
17 start tiger 9
18 error tiger 9

select * from Table-Name where datetime < to_date('2012/12/06:06:00:00', 'yyyy/mm/dd:hh24:mi:ss')
And datetime > to_date('2012/12/04:22:00:00', 'yyyy/mm/dd:hh24:mi:ss')And not description in (Select * from Table-Name where Status like ('%Complete%' or Status like '%stop%') and description in (Select description from Table-Name where Status Like '%start%'));

Result should be " Frog and Elephant and tiger"

Start of every record(descrpition --status is Start)
End of every record ( status is stop or done or completed)
status process is in btwn (their will be mulitple records with name s//y to process...ie. process 1 ...process 2...process 3 )

Note:

tracking IDs may change up on error

View 2 Replies View Related

SQL & PL/SQL :: Multiple Column In Pivot Query?

Dec 17, 2011

I've tried for pivot query feature of Oracle 11g, but I'm trying for pivot result on multiple column.

Herewith I'm displaying my try on single column pivot query.

SQL> select * from
2 (select deptno,job,sal
3 --,comm
4 from emp)
5 pivot (sum(sal) as payment for job in('CLERK','SALESMAN','MANAGER'))
6 order by 1;

[code]....

I've tried this one also, but it didn't seems to be working.

SQL> select * from
2 (select deptno,job,sal,comm
3 from emp)
4 pivot (sum(sal) as payment_sal,sum(comm) as payment_comm for job in('CLERK','SALESMAN','MANAGER'))
5 order by 1;

[code]....

I want result like below.

DEPTNO PAYMENT 'CLERK'_PAYMENT 'SALESMAN'_PAYMENT 'MANAGER'_PAYMENT
---------- ------- --------------- ------------------ -----------------
10 SAL1300 2450
20 SAL1900 2975
30 SAL 950 5600 2850
30 COMM 2200

is it possible to have multiple column pivot query.

View 2 Replies View Related







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