Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query problems

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
This query is about to drive me bananas.
When I run this query using a cursor and calling it with a post-change trigger, I get no data back.
But when I copy this code to sqlplus, it gives me all the data that I need. What is wrong?
Can you help, please?
select d.deptno from dt, caf, dept
where dt.deptcode = d.deptno
and dt.dcode = callf.ccode.
d is the lookup table.
the hierarchy says get the deptno from d table based on a join between d and dt on deptno
and a join between dt and caf on dcode.
if I search with a specific ccode, it comes back with a no-data found error message.
If I search sqlplus with the same ccode, i get data back.
any help would be greatly appreciated.
tankem
/
 
Please verify your query, it can not be run because table(alias) d is undefined:

select d.deptno from dt, caf, dept
where dt.deptcode = d.deptno
and dt.dcode = callf.ccode.

The problem may be in wrong datatype conversion that may depend on session environment. Check whether both sides of the equation are of the same type. If one of them is NUMBER and the other is VARCHAR2 the number part may be converted with fractional part so '10.00'<>'10'. You may either alter table or make explicit conversion.
 
thanks sem!
what I did was change from post_change trigger to post_query trigger and it started working which leads me to another question, what is the difference?
when do you choose one over the other?
tankem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top