SQL & PL/SQL :: Remove Special Chars Using Regular Expression

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


ADVERTISEMENT

PL/SQL :: Regular Expression To Remove Space In HTML Tag?

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

SQL & PL/SQL :: Regular Expression In Oracle 10g

Apr 13, 2013

What is the use of Regular Expression?

View 1 Replies View Related

SQL & PL/SQL :: How To Use Substr Or Regular Expression

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

PL/SQL :: Regular Expression Select

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

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 View Related

SQL & PL/SQL :: Finding Date Value In Given String By Using Regular Expression

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

SQL & PL/SQL :: Use Of Regular Expression In Real Time Scenario

Jul 24, 2012

Regular Expression in oracle??Especially the use of this in real time scenario.

View 4 Replies View Related

PL/SQL :: How To Perform A Pattern Check - Regular Expression

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

SQL & PL/SQL :: Regular Expression To Find Commits In All Oracle Source?

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

PL/SQL :: Regular Expression To Check Number With At Least One Decimal Point?

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

JDeveloper, Java & XML :: Regular Expression For Exact Word And Occurrence

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

JDeveloper, Java & XML :: Extract Data From Clob Field Using Regular Expression

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

SQL & PL/SQL :: How To Remove Special Characters

Mar 22, 2013

I need to removed special characters (!, ", #, $, %, &, /, () from a string, i have a table with sll this special characters and words that i have to remove from the string.

How can i do that ?

i have a string with |R!$#&2-_D%2 and i want to get R2-D2

SELECT '|R!$#&2-_D%2' as Original, 'R2-D2' as Correct
FROM DUAL

View 5 Replies View Related

SQL & PL/SQL :: Remove Special Characters From Input String?

Aug 5, 2010

I have a following table,

create table test1(col1 varchar2(20));

insert into test1 values('4711-3/01');

I believe we need to use Translate function to get rid of special characters, But I would not be knowing what sort of special charecters which appear in the string, In that case how do I use Translate?

View 29 Replies View Related

Get Left Chars Of A Field?

Oct 15, 2008

I have many different file names within my table and I want to remove the .TXT extension from each one. I want to try this SQL but being a newbie in Oracle, I don't know how to say "Left" characters. "Left" is an invalid identifier.

Update TableName
Set File_Name = Left(File_Name, Len(File_Name)-4)
Where File_Name LIKE '%.TXT'

View 2 Replies View Related

SQL & PL/SQL :: Utf-8 - Japanese Chars Are Coming?

Aug 25, 2013

We have to get some data from U98 (saixdbU98) in UTF-8 format in Excel sheet.We are having queries ready for this. These queries bring data which have Japanese characters.But when we run the Select queries then in the result Japanese chars are garbled. It comes in ????.

let us know what process we have to follow to get the result in UTF-8 format in Excel sheet.here is the code

set sqlblanklines on;
SET DEFINE OFF;
set linesize 1000
set long 1000000

[code]....

View 4 Replies View Related

SQL & PL/SQL :: Encoding Emoji Chars

Jan 3, 2012

I'm sending Emoji's in by Email body, but its not being rendering properly.

Is there any way to encode Emoji chars like --> 😪

[URL]........

View 4 Replies View Related

SQL & PL/SQL :: Utl-encode.mimeheader - Encoding Only First 75 Chars?

Dec 5, 2011

I'm using utl_encode.mimeheader_encode to encode the subject line for non ascii chars, but its encoding only first 75 chars, is there any other way to encode subject.

View 3 Replies View Related

SQL & PL/SQL :: Expression Must Have Same Datatype As Corresponding Expression

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

SQL & PL/SQL :: Rpad Function That Works For Multiple Chars?

Mar 6, 2011

How can I do this ?

is there an rpad that works for multiple chars?

select RPAD('test',10, 'X') from dual;

I want to be able to do something like

select RPAD('test',6, '%20') from dual;

which should return test%20%20

View 7 Replies View Related

UTF-8 - Junk Characters Are Coming For Japanese Chars?

Aug 25, 2013

We have to get some data from U98 (saixdbU98) in UTF-8 format in Excel sheet.We are having queries ready for this. These queries bring data which have Japanese characters.

But when we run the Select queries through pbrun (Power Broker) then in result Japanese chars are garbled. It comes in what process we have to follow to get the result in UTF-8 format in Excel sheet.

here is the code
--
set sqlblanklines on;
SET DEFINE OFF;
set linesize 1000
set long 1000000
set pages 50000

[code]...

View 1 Replies View Related

Server Utilities :: SQL Loader Discard Non-numeric Chars

Sep 30, 2011

Creating a table

CREATE TABLE NEW_DATA
(INK_DATE DATE,
INV_ID NUMBER,
CUST_ID NUMBER,
AMOUNT NUMBER)

Loading data into the table with

LOAD DATA
CHARACTERSET WE8MSWIN1252
INFILE 'input/NEW_DATA.dat' "str '
'"
BADFILE 'log/NEW_DATA.bad'
DISCARDFILE 'log/NEW_DATA.dsc'

TRUNCATE INTO TABLE NEW_DATA
FIELDS TERMINATED BY '|'
(INK_DATE date "YYYY-MM-DD",
INV_ID,
CUST_ID,
AMOUNT)

My problem is that there are some rows (about 1%) where the columns INV_ID, CUST_ID, AMOUNT are containing non numeric characters and they end up in the BAD-file as errors.

Is there a way to make them end up in the discard file instead so I don't end up with errors but discards?Or even better load then into another table looking like this

(INK_DATE DATE,
INV_ID varchar2,
CUST_ID varchar2,
AMOUNT varchar2)

Do I need to have a WHEN-clause?

View 8 Replies View Related

Server Utilities :: Token Longer Than Max Allowable Length Of 258 Chars

Jun 23, 2011

i tried to apply a sql case statement in sql loader control file in " " the load succeed with 258 chars case or decode statement but when i add more cases it return sql loader 350 token longer than max

LOAD DATA
INFILE 'F:Vouvou20110613_102_951454.unl'
BADFILE 'F:Vouvou.pad'
DISCARDFILE 'F:Vouvou.dic'
replace
INTO TABLE vou_test_2
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
[code].......

the above one succeed when i edit the case statement as follow

ACCOUNT_2001 "CASE WHEN:ACCOUNTTYPE1='2001'THEN :REWARDAMOUNT1 WHEN :ACCOUNTTYPE2='2001' THEN :REWARDAMOUNT2
WHEN :ACCOUNTTYPE3='2001' THEN :REWARDAMOUNT3
WHEN :ACCOUNTTYPE4='2001' THEN :REWARDAMOUNT4
WHEN :ACCOUNTTYPE5='2001' THEN :REWARDAMOUNT5
WHEN :ACCOUNTTYPE6='2001' THEN :REWARDAMOUNT6
WHEN :ACCOUNTTYPE7='2001' THEN :REWARDAMOUNT7
WHEN :ACCOUNTTYPE8='2001' THEN :REWARDAMOUNT8
WHEN :ACCOUNTTYPE9='2001' THEN :REWARDAMOUNT9
WHEN :ACCOUNTTYPE10='2001' THEN :REWARDAMOUNT10 END"

i got the Error sql loader 350 token longer than max allowable length of 258 chars .

note : i cant modify the table structure to shorten the column names .

View 2 Replies View Related

Using PL/SQL Table With Regular Query

Apr 22, 2009

How to use a table type variable with a regular query? For example, in my PL/SQL proc I have a table of employee names.

v_emp_tbl; --contains 'John','Sally','Ted'

Then I want to get names in a table called tbl_employees which are not in the pl/sql table. So if the table contains 'John','Sally','Ted',and 'Don' then I want to see 'Don'.

Not sure how to do this. Essentially I want something like:

Select emp_name into v_single_emp
from tbl_employees where emp_name NOT IN v_emp_tbl;

I know I can loop through the pl/sql table but I wanted to see if there is some other way.

View 2 Replies View Related

PL/SQL :: The Regular Expressions And GUID

Jul 16, 2012

I am needing to select GUIDS from a table and for this, I need the Regular Expression. My Perl is not good and not good Regular Expression. My database is Oracle 11.2.0.2.0 and the Operating System of the Machine is Linux (Oracle Version 6).

View 4 Replies View Related

SQL & PL/SQL :: Copy Data At Regular Interval

Mar 2, 2011

I have this remote database A and database B. DB A has 10 views and DB B has 10 tables. I have to pull out data from views of DB A and load into tables of DB B at regular intervals. How do I do this job?

View 3 Replies View Related

Perform Regular Updates On Several Oracle Tables

Sep 26, 2012

I am attempting to perform regular updates on several Oracle tables. The scripts performing the updates are scheduled to run every two minutes, get a value and update the table with that value.

The value doesn't always change but the scripts will still attempt to perform an update.

The same script is part of 7 objects, all of them are scheduled to run at the same time. They update the same table but never the same row.Even though the script is mostly the same on the 7 objects, they run completely independently of each other. The first object will usually perform the update without any problems but when it comes to the second object the script will time out.

View 9 Replies View Related

Logical Backup Of All Application Tables At Regular Intervals

May 18, 2010

I want to maintain the logical backup of all the application tables At regular intervals. Which option would i use?

View 1 Replies View Related

SQL & PL/SQL :: Extract Email ID From A String / Text Using Oracle Regular Expressions

Oct 14, 2013

code to extract email id (full email id) from a string/text using Oracle Regular Expressions.

Example -

"This is my String with email abc.efg@hij.com to test" O/p - abc.efg@hij.com

View 9 Replies View Related







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