Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: What's wrong with this code!!!

Re: What's wrong with this code!!!

From: Robert Christenson <robertoc_at_fyiowa.infi.net>
Date: 1997/10/21
Message-ID: <344CBF2B.3314@fyiowa.infi.net>#1/1

Corncrowe wrote:
>
> Hello, I wanted to know if anyone saw something wrong with the following code.
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> create or replace procedure sp_temp_aging as
> ordnum number (10) := 0;
> ordvol number;
> v_from_date date;
> v_to_date date;
>
> cursor c_orders is select ord_id from temp_aging
> order by ord_id;
>
> BEGIN
> v_to_date := TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD')||' 05:00','YYYYMMDD
> HH24:MI');
> v_from_date := v_to_date - 1;
>
> dbms_output.put_line('From Date: '||TO_CHAR(v_from_date,'mm/dd/yy
> hh24:mi'));
> dbms_output.put_line('To Date: '||TO_CHAR(v_to_date,'mm/dd/yy
> hh24:mi'));
>
> delete from temp_aging where ord_id is not null;
> commit;
>
> insert into temp_aging (name,lifted_term_id,diff,vol,ord_id)
> select /*+RULE*/ t.name,
> o.lifted_term_id,to_date(ov.creation_date,'dd-mon-yy')
> -
> decode(o.lifted_end_time,null,to_date(o.lifted_start_time,'dd-mon-yy'),
> to_date(o.lifted_end_time,'dd-mon-yy')) diff,
> 0 vol,o.ord_id
> from order_versions ov, orders o,terminals t, order_status_versions osv
> where ov.ver_nbr = osv.ov_ver_nbr
> and osv.ov_ord_ord_id = ov.ord_ord_id
> and osv.os_stat_cd = 6
> and ov.ord_ord_id = o.ord_id
> and t.term_id = o.lifted_term_id
> and ov.creation_date between v_from_date AND v_to_date;
>
> commit;
> open c_orders;
> loop
> fetch c_orders into ordnum;
> exit when c_orders%notfound;
> select /*+RULE*/ sum(pov.lifted_gross_vol) into ordvol
> from product_order_versions pov, order_status_versions osv
> where pov.ov_ord_ord_id = ordnum
> and pov.ov_ord_ord_id = osv.ov_ord_ord_id
> and pov.ov_ver_nbr = osv.ov_ver_nbr
> and osv.os_stat_cd = 6;
> update temp_aging set vol = ordvol
> where ord_id = ordnum;
> end loop;
> commit;
> close c_orders;
> END;
> /
> SHOW ERRORS
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Thanks,
>
> Jon

We can't really help you if we don't have an error message to decipher.

Wrong results? Won't compile?

-- 
"Came for the party, left on the run"

Robert Christenson
Gazette Technologies
robertoc#spam~be~gone#@fyiowa.infi.net
Received on Tue Oct 21 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US