Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Adding hard coded column values to a result set.

MaxMar 2 2009 — edited Mar 2 2009
DB version:10gR2

Example from sample schema SCOTT
select e.ename, e.empno, d.loc
from
emp e inner join dept d on (e.deptno=d.deptno)
and e.ename like 'M%';


 ENAME           EMPNO LOC
 ---------- ---------- -------------
 MARTIN           7654 CHICAGO
 MILLER           7934 DALLAS
 
For every ename like 'MARTIN' the following two rows (hardcoded column values 001-985 and 003-745 ) should get created.
 
PAY_TYPES   PAY_CODES			
--------    ---------			
   001	      985			
   003	      745     
   
Everything else must remain same.

The result set should look like the following. Here two rows got created for MARTIN and MILLER.Everything else remains the same
  ENAME           EMPNO  PAY_TYPES   PAY_CODES			LOC
  ---------- ----------  --------    ---------			-------------
  MARTIN           7654  001	      985			CHICAGO
  MARTIN	   7654  003	      745                       CHICAGO
  MILLER           7934  001	      985		        DALLAS
  MILLER           7934  003	      745		        DALLAS
  
How is this possible?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 30 2009
Added on Mar 2 2009
5 comments
6,364 views