Any Oracle people?

Discussion in 'OT Technology' started by mobbarley, Apr 6, 2009.

  1. mobbarley

    mobbarley Active Member

    Joined:
    Mar 4, 2005
    Messages:
    9,256
    Likes Received:
    2
    Location:
    Sydney
    Have the schema below and need to average TYPEB's data per hour across two different trans_dates.

    I can do this with:
    Code:
    SELECT X.name, Y.hour, avg(Y.data)
    	FROM X, TABLE(data_values) Y
    	WHERE
    		(X.transdate = 1/1/1 OR X.transdate = 2/2/2)
    	GROUP BY X.name, Y.hour;
    Q: I would like to return the result as a TYPEA column (object?) so that the result
    could be easily reinserted into the table X..... ???


    Schema:
    Code:
    	TYPE TYPEB AS OBJECT( 
    		hour as integer,
    		data as integer
    	)
    
    	TYPE TYPEA AS VARRAY(24) of TYPEB;
    
    	TABLE X(
    		name VARCHAR2,
    		trans_date DATE,
    		data_values TYPEA
    	);
     

Share This Page