Home » SQL & PL/SQL » SQL & PL/SQL » variable column names
variable column names [message #210933] Sat, 23 December 2006 13:02 Go to next message
wardy
Messages: 2
Registered: December 2006
Junior Member
I'm working on a data collection application. Actual device names to be logged can change. Two tables are used: a log "header" table that contains an entry with input descriptions (one record per "run") and another table that
contains logged data every 10 seconds.

Log header table:

DT | run_num | input1_desc | input2_desc |
xxxx | 1234 | inlet_temp | zone_1_temp

Data table:

DT | run_num | input1 | input2 |
xxxx | 1234 | 12.234 | 45.675

How can I create a view to show data with actual column names (ex: inlet_temp)? Or should db be re-designed?
Re: variable column names [message #210939 is a reply to message #210933] Sat, 23 December 2006 22:37 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
CREATE VIEW hurumph AS
SELECT dummy AS new_dummy
FROM DUAL

Is this what you're trying to do?

Ross Leishman
Re: variable column names [message #210988 is a reply to message #210939] Sun, 24 December 2006 12:01 Go to previous messageGo to next message
wardy
Messages: 2
Registered: December 2006
Junior Member
Here is what I have:

LogHeader table:

DT | RUN_NUM | INPUT1_DESC | INPUT2_DESC |
XXXXX| 12345 | INLET_TEMP | OUTLET_TEMP |

Data table:

DT | RUN_NUM | INPUT1 | INPUT2 |
XXXXX| 12345 | 23.345 | 45.355 |
XXXXX| 12345 | 13.345 | 65.355 |
XXXXX| 12345 | 43.345 | 25.355 |
XXXXX| 12345 | 23.485 | 35.355 |

What I want: VIEW OR REPORT TO LOOK LKE THIS

DT | RUN_NUM | INLET_TEMP | OUTLET_TEMP |
XXXXX| 12345 | 23.345 | 45.355 |
XXXXX| 12345 | 13.345 | 65.355 |
XXXXX| 12345 | 43.345 | 25.355 |
XXXXX| 12345 | 23.485 | 35.355 |
Re: variable column names [message #210990 is a reply to message #210933] Sun, 24 December 2006 13:17 Go to previous message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
The homework tutor is down the hall & 2nd door on the right.
Show us what you've tried & demonstrate what is wrong with your SQL
Previous Topic: backup tables(plz help)
Next Topic: covert case into decode
Goto Forum:
  


Current Time: Fri Dec 02 20:25:05 CST 2016

Total time taken to generate the page: 0.10395 seconds