Home » SQL & PL/SQL » SQL & PL/SQL » Flattening the file
Flattening the file [message #335565] Tue, 22 July 2008 13:04 Go to next message
pradkuamr
Messages: 29
Registered: November 2006
Junior Member
Hi All
I am having a source input file as
Input
Name Region
Ravi All
Ram Europe


I am having a table which is having structure and data as below:
C1 C2 C3
A Asia 10
B Asia 20
C Europe 30


Now I want to map the input file to this table and get all the codes for the corresponding region and expecting output to be as
Output

Name Region Code
Ravi All 10
Ravi All 20
Ravi All 30
Ram Europe 30

As Ravi is assigned All in the osurce file, he should get all the codes.
Please share any ideas on this

Thanks
Sunil
Re: Flattening the file [message #335566 is a reply to message #335565] Tue, 22 July 2008 13:06 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above
Re: Flattening the file [message #335568 is a reply to message #335565] Tue, 22 July 2008 13:26 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
condition is (for instance) "decode(input.region,'All',1,table.region,1,0) = 1"

Regards
Michel
Re: Flattening the file [message #335603 is a reply to message #335568] Tue, 22 July 2008 23:12 Go to previous message
Frank
Messages: 7901
Registered: March 2000
Senior Member
or, what I find easier to read, something like this:
where (  table_a.col1 = table_b.col1
      or table_a.col1 = 'All'
      )
Previous Topic: How to transfer data from Oracle to Excel
Next Topic: How to know a package is being called
Goto Forum:
  


Current Time: Thu Dec 12 07:17:50 CST 2024