tags:

views:

106

answers:

1

In a SELECT call we are returning two different timestamps, but because each column is each called 'timetag' we cannot differentiate between them in the results. The obvious solution of renaming one of the columns will result in a large amount of refactoring which we want to avoid. Our query looks something like this:

DECLARE
     p_cursor refcursor;

BEGIN

    OPEN p_cursor FOR


  SELECT table1.name,
         table1.timetag,
         table1.status,
        table2.timetag,
        table2.description

    FROM myFirstTable table1 LEFT OUTER JOIN mySecondTable table2 ON (<data's ids>),   
    ( 
<query details>
         );
    WHERE
<more query details>

  RETURN p_cursor;

END;

PS. excuse me if I have messed up the terms, I'm very new to databases.

+5  A: 

Use the AS clause to "rename" some column just from the point of view of the results you receive (won't alter the DB) -- e.g.

 SELECT table1.name,
         table1.timetag,
         table1.status,
        table2.timetag AS theothertimetag,
        table2.description

    FROM
Alex Martelli
Thanks, that did the trick!
Adam