Home » SQL & PL/SQL » SQL & PL/SQL » Help with View
Help with View [message #20607] Thu, 06 June 2002 11:47 Go to next message
Arpit
Messages: 99
Registered: March 2001
Member
Hello,

I using MS Query to retreive data from Oracle database.From the retreived data, I need to map the data for one coulmn to some another value based on a condition. I'm not sure how I could specify this in MS Query doing an replace based on a criteria.

OR Can I do this using a view. If I create a View joining two tables, how can i change the data.

Any help on this would be highly appreciated.

There are two tables that I'm using to retreive data from. Project & Subproject.

In the project table, the project_type column has 'm','n','c' values. In the subproject table, the subproject_no column has 99,80 values.

I need to map subproject_no "99" values to project_type 'c' if it pulls out 'm'.

Thanks!
Re: Help with View [message #20609 is a reply to message #20607] Thu, 06 June 2002 13:37 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Use decode

<SQL> select deptno, decode(deptno,10,'department10'
2 ,20,'department20'
3 ,30,'department30'
4 ,40,'department40') from emp;

DEPTNO DECODE(DEPTN
---------- ------------
20 department20
30 department30
30 department30
20 department20
30 department30
30 department30
10 department10
20 department20
10 department10
30 department30
20 department20
30 department30
20 department20
10 department10

14 rows selected.
</pre>
Previous Topic: What is wrong with my logic?
Next Topic: partitioning tables
Goto Forum:
  


Current Time: Fri Apr 26 01:51:46 CDT 2024