Solved

Display control code, or non-printable character within string

Posted on 2014-01-29
10
2,148 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 77

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 77

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

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
 
LVL 77

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 77

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 77

Expert Comment

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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle differnce between two timestamps 5 49
Checking for column width 8 48
oracle sqlplus query delimiter 8 52
Oracle Errors 11 81
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

738 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