-
oracle object selections
I am new to OO within oracle and am having trouble doing what i'm sure, many of you will view as a trivial piece of programming.
I have a 'Customer' table, which contains a 'Loyalty_card' object within one of its columns.
Code:
select name, id from customer_objtab
where Loyalty_card = Loyalty_card_objtyp('loyaltyid', 'id123',0);
The above code, returns the name and id as expected.
What I would like to do however, is return a row from my customer table, when its loyalty card object has a specific id. How would I do this?
In pseudo code, what I want is:
"select * from customer_objtab
where the loyalty card it contains
has an ID value of 'loyaltyid'".
Cheers.
(DB OO n00b).
EDIT:
I have solved the problem as follows but being a new post, am unable to delete it:
select name, id from customer_objtab
where TREAT(Loyalty_card AS Loyalty_card_objtyp).ID = 'loyaltyid';
Thanks anyway.
Last edited by sillychuckie; 02-03-2006 at 09:34 AM.
-
You could also use:
select name, id from customer_objtab o
where o.loyalty_card.id = 'loyaltyid';
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|