Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2012-04-10
5
Medium Priority
?
300 Views
Last Modified: 2012-04-15
Hi!

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
0
Comment
Question by:marcgu
[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
  • 2
  • 2
5 Comments
 
LVL 74

Accepted Solution

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

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)

http://www.toadworld.com/KNOWLEDGE/KnowledgeXpertforOracle/tabid/648/TopicID/DPUMP4/Default.aspx

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

Author Comment

by:marcgu
ID: 37829759
Hi!

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.
/Marcus
0
 
LVL 77

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?
0
 

Author Closing Comment

by:marcgu
ID: 37848223
Thanks for perfect solution.
/Marcus
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

715 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