Question: I'm trying to write a simple code that detect IP source address for ICMP packet in `scapy`, the problem is `haslayer` function looks not returning anything.

```
from scapy.all import *

while 1:

    pkt = sniff ( iface="eth0" , count = 1 )
    pkt.summary()

    try:
        if pkt.haslayer(IP):
            ipsrc =pkt.getlayer(IP).src
            print ipsrc

    except:
        pass

```

the result is 

```
Ether / IP / ICMP 10.0.2.15 > 10.0.2.11 echo-request 0 / Raw
Ether / IP / ICMP 10.0.2.15 > 10.0.2.11 echo-request 0 / Raw
Ether / IP / ICMP 10.0.2.15 > 10.0.2.11 echo-request 0 / Raw

```

So I'm not able to catch the IP source address for the ICMP request
Any idea ?

Answer: 
```
select col1, col2, col3, col4 from (
  select * from (
    select 
      n, str, row_number() over (partition by n order by 
      decode(substr(str,1,3),'Fac',1,'NPI',2,'TIN',3,'Add',4)) cn 
    from (
      select * from (select t.*, rownum n from t)
      unpivot (str for cn in (col1 as 0, col2 as 0, col3 as 0, col4 as 0))
    )
  )
  pivot (min(str) for cn in (1 as col1, 2 as col2, 3 as col3, 4 as col4))
)
order by n

```

[fiddle](http://www.sqlfiddle.com/#!4/1b742/1)
The fact that you want to move data between columns strongly implies that the underlying data model is broken and needs to be normalized. Fixing the data model would be much more appropriate than adding another layer of complexity to the system. 

That being said, you should be able to do something like

```
SELECT (CASE WHEN column1 LIKE 'FacilityName%' THEN column1
             WHEN column2 LIKE 'FacilityName%' THEN column2
             WHEN column3 LIKE 'FacilityName%' THEN column3
             WHEN column4 LIKE 'FacilityName%' THEN column4
             ELSE null
         END) column1,
       (CASE WHEN column1 LIKE 'NPI%' THEN column1
             WHEN column2 LIKE 'NPI%' THEN column2
             WHEN column3 LIKE 'NPI%' THEN column3
             WHEN column4 LIKE 'NPI%' THEN column4
             ELSE null
         END) column2,
       (CASE WHEN column1 LIKE 'TIN%' THEN column1
             WHEN column2 LIKE 'TIN%' THEN column2
             WHEN column3 LIKE 'TIN%' THEN column3
             WHEN column4 LIKE 'TIN%' THEN column4
             ELSE null
         END) column3,
       (CASE WHEN column1 LIKE 'Address%' THEN column1
             WHEN column2 LIKE 'Address%' THEN column2
             WHEN column3 LIKE 'Address%' THEN column3
             WHEN column4 LIKE 'Address%' THEN column4
             ELSE null
         END) column4
  FROM( <<your query>> )

```