Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Reporting with dynamic sql
Allright, I reached another wall. In the report I'm trying to fix, 3 temp tables are created. I'm trying to find a way to convert the script by using ref cursor instead, like Sybrand stated above. My problem is that one of the temp table is created using data from another temp table. This is from the script I'm working on:
CREATE TABLE quart_avg_da1_&&4 (quart,
emp_name, pick_line, tmp_moy, nb_pick, tmp_moy_caisse, nb_caisse, poids)
SELECT p.quart, e.emp_name, p.pick_line,
avg(decode(sign(p.cmpl_time-p.begin_time),-1,p.cmpl_time+86399-p.begin_time,p.cmpl_time-p.begin_time)) * 60 * 60 * 24,
count(*),
(sum(decode(sign(p.cmpl_time-p.begin_time),-1,p.cmpl_time+86399-p.begin_time,p.cmpl_time-p.begin_time))/sum(qty)) * 60 * 60 * 24,
sum(qty), sum(wght)/1000 FROM quart_total_tmp_da1_&&4 p, emp e
GROUP BY p.quart, e.emp_name, p.pick_line;
The other temp table is quart_total_tmp_da1_&&4 as you can see in the FROM section(&&4 would be the employee code for example). Now, select <fields> from <table_name> I know. But I'm not so sure that SELECT <fields> FROM <ref cursor> is gonna work. In fact, I just tried it, and it doesn't. What would be the best way to proceed then? By the way, sorry for the formatting of the query. Got kinda mangled by google. Received on Wed Aug 16 2006 - 14:20:24 CDT
![]() |
![]() |