oracle how to transfer SQL into member function -


one of assignment question is: method avgreviewscore() returns average review score album excluding scores anonymous reviewers, i.e. reviews null reviewer_name.

so firstly wrote sql: (this oriented database assignment)

select deref(b.album).title  ,round(avg(b2.reviewscore),2) album_artist_table b,table(deref(b.album).review) b2 deref(b.artist).aname '%joe%' , b2.reviewername not null group deref(b.album).title; 

can ask how translate sql member function?

i try create type called:avgreviewscore_type

and create type body member function following:

create or replace type body album_type                                                                                                             member function avgreviewscore return avgreviewscore_type avgtable avgreviewscore_type := avgreviewscore_type(null,null); begin  select deref(b.album).title,round(avg(b2.reviewscore),2) avgtable album_artist_table b,table(deref(b.album).review) b2 b2.reviewername not null group deref(b.album).title; return avgtable; end avgreviewscore; end; 

but doesn't work, there know reason?

i guess question has incomplete information , depending on whatever given see below example. hope you.

create type exmpl_type object (    num number,        member function  func(p in number) return number ); /  create type body exmpl_type                 member function func(p in number)    return number    begin     return num/p;   end func; end; / 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -