Home » SQL & PL/SQL » SQL & PL/SQL » handling collection type (merged 3)
handling collection type (merged 3) [message #399749] Thu, 23 April 2009 21:49 Go to next message
tzaz
Messages: 1
Registered: September 2008
Junior Member
Hi,

Anybody can suggest/correct how to display for each customer its loan movies?
the code bellow display for the same customer id its loan movies:
It about object and collection type (nested table).

SELECT distinct R.cust_obj.id,R.cust_obj.name,l.loan_date,id,title,movie_type "Type",duration,main_actor
FROM TABLE(SELECT movies from loans_movies
where customer_id=20),customer R,loans_movies l
where R.cust_obj.id=20
and l.customer_id=R.cust_obj.id;

Thank,
Tzachi
Re: handling collection type [message #399758 is a reply to message #399749] Thu, 23 April 2009 22:12 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
SELECT DISTINCT r.cust_obj.id, 
                r.cust_obj.NAME, 
                l.loan_date, 
                id, 
                title, 
                movie_type "Type", 
                duration, 
                main_actor 
FROM   TABLE(SELECT movies 
             FROM   loans_movies 
             WHERE  customer_id = 20), 
       customer r, 
       loans_movies l 
WHERE  r.cust_obj.id = 20 
       AND l.customer_id = r.cust_obj.id;


You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Please, please, please Read & Follow Posting Guidelines above.
Go to the section labeled "Practice" & do as directed.
Re: handling collection type (merged 3) [message #399772 is a reply to message #399749] Thu, 23 April 2009 23:31 Go to previous message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Without the description of your model no one can help you.
Post a working Test case: create table and insert statements along with the result you want with these data. Remember to format it as BlackSwan did it for your query (read OraFAQ Forum Guide).
Also always post your Oracle version (4 decimals).

Regards
Michel

Previous Topic: joins and rollup
Next Topic: extract and display data in a pattern
Goto Forum:
  


Current Time: Thu Dec 08 16:03:13 CST 2016

Total time taken to generate the page: 0.10371 seconds