How to replace id-value with new fictive id in oracle

Posted on 2012-04-10
Last Modified: 2012-04-15

I have a table with, let´s say, 4 columns, person, colA, col B and colC.

The first column contains personal number (ssn) so when I export data to outside persons I dont want to send also the actual value in column.  Instead I want to replace, in this case "760320" with "1" and 760914 with "2".  Please note that 760320 and other personal numbers can occure 1, 2 or several times.

person      col A          col B            col C
760320      x          y                       z
760320      x          y                       z
760914      x          y                       u

The result should be

person  col A colB       col C
1             x      y           z
1             x      y           z
2             x      y            u

Thanks in advance
Question by:marcgu
  • 2
  • 2
LVL 74

Accepted Solution

sdstuber earned 300 total points
ID: 37829712
select dense_rank() over(order by person) person, cola,colb,colc from yourtable
order by person
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37829717
>>when I export data to outside

Do you mean Oracle Export?

If you are running 11g and plan on using datapump, check out:  
Data Pump Data Remapping (Obfuscation)

If you mean some other type of expert, please clarify.

Author Comment

ID: 37829759

Thanks for really fast possible solutions.

sdstuber: I will try your solution at work tomorrow.

slightwv: I wrote export, but the only import thing is really to get the result from the select-query in SQL developer . From there I can choose to copy the rows from the select or right click  to export. Sorry if this caused false focus.
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37829770
Are you only wanting a single table or will you be exporting additional related tables and need to keep the obfuscated values equal across the exports?

Author Closing Comment

ID: 37848223
Thanks for perfect solution.

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

Title # Comments Views Activity
sort a spool into file output in oracle 1 44
help on oracle query 5 53
PL/SQL Display based on value 4 39
Retreiving column names in Windows but not in Unix 11 58
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

839 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