Executing Oracle query in QTP
I m trying to execute oracle query using QTP.Could able to establish the connection .When I execute the following code I could nt able to fetch
oRs.open "Select count(a.sub_class_cd) from governance_ref a, nonfood_hierarchy b"&_
" where a.sub_class_cd = b.sub_class_cd and b.section_cd = 'T00DUA'and a.channel='STORE'"&_
" and a.head_tail_ind='HEAD' and to_date(a.created_dt)=(select max(to_date(a.created_dt)) from governance_Ref a)",oCon.
When I try to execute till a.head_tail_ind I could able to get the count of records. When I include the created_dt stmt in the query it is not fetching any records.
Thank you for your replies regarding this.
I'd try doing (select to_date(max(a.created_dt)) from governance_Ref a). I think that the problem might be that you're trying to get the max of a date conversion. I'm not a SQL expert, by any means, so someone else might be able to tell you better... that's just the first thing that jumped out at me.
Edit: I was wrong. I tested this and it's fine with doing a max(to_date(a.created_dt)). In fact, that gets the result you'd want while to_date(max(a.created_date)) does not.
Last edited by belewda; 12-10-2013 at 05:00 AM.