Solved

Display control code, or non-printable character within string

Posted on 2014-01-29
10
1,933 Views
Last Modified: 2014-01-29
I have found several records that look to contain trailing spaces after a number, but I cannot query them based on the string containing a space so I believe the records have some sort of control code or no-printable character in them.  I can select the records based on them containing something other than a number or letter, but I want to be able to see what the record really contains.  

Here is how I found the records:

select '('||month||')'
from birthdates
where nvl(length(translate(month,'a1234567890','a')),-1) > 0
/

The records returned look like this:
(1  )
(2  )
(9  )
etc.

They are not spaces that follow the numbers but I cannot find out what they are.  Basically I need to update the records to just show the month number.  The data is mostly accurate  (containing just the number with nothing following) but there are 100's that appear like the above.
0
Comment
Question by:bretthonn13
  • 6
  • 4
10 Comments
 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 500 total points
ID: 39818987
>>but I want to be able to see what the record really contains

use DUMP to show the hex codes:
select DUMP(month) ...

>>update the records to just show the month number

update birthdates set months=regexp_replace(month,[^0-9]);
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39818995
Had a typo above (missed a +):
update birthdates set months=regexp_replace(month,[^0-9]+)


Can add a where clause if you wish:
update birthdates set months=regexp_replace(month,[^0-9]+) where regexp_like(month,'[^0-9]+);
0
 

Author Comment

by:bretthonn13
ID: 39819031
Thanks!

I took a look and this is what it returned:
month      dump(month)
5               Typ=1 Len=2: 53,13
5               Typ=1 Len=2: 53,13
6               Typ=1 Len=2: 54,13
6               Typ=1 Len=2: 54,13

So what is this telling me?
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39819037
The 13 is a Carriage Return.

www.asciitable.com
0
 

Author Comment

by:bretthonn13
ID: 39819057
So in the future if I knew I had a bunch of "13's" or Carriage Returns in some data, can you simply search or select those records containing only Carriage REturns?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39819066
>> can you simply search or select those records containing only Carriage REturns?

Sure:
select month from birthdates where instr(month,chr(13)) > 0;
0
 

Author Comment

by:bretthonn13
ID: 39819227
I think it's going to work but I keep getting "error at line 2 missing expression"

update birthdates
set month = regexp_replace(month,[^0-9]+)
where regexp_like(month,[^0-9]+)
and city = 182
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39819238
Typo:

update birthdates
set month = regexp_replace(month,'[^0-9]+')
where regexp_like(month,'[^0-9]+')
and city = 182
0
 

Author Closing Comment

by:bretthonn13
ID: 39819258
Super fast and exactly what I was looking for!
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39819432
Glad to help and sorry for the syntax error.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now