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: 25042
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: 64129
Registered: March 2007
Location: Nanterre, France, http://...
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: 7880
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: Wed Dec 07 06:48:55 CST 2016

Total time taken to generate the page: 0.11301 seconds