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

Home -> Community -> Usenet -> c.d.o.misc -> Re: What's wrong in my code, Any idea

Re: What's wrong in my code, Any idea

From: Karsten Farrell <kfarrell_at_belgariad.com>
Date: Wed, 16 Jul 2003 19:39:57 GMT
Message-ID: <MPG.197f49e5594832439897f0@news.la.sbcglobal.net>


Hi Areon Ku, thanks for writing this:
> Can any one give suggesstion here :
>
>
>
> CREATE OR REPLACE procedure TestCount_sum(
> Organ_tx varchar2,
> temp_name varchar2,
> category_TX varchar2)IS
> v_category_tx varchar2(32);
> v_ORGAN_TX VARCHAR2(32);
> v_value_tx varchar2(32);
> v_datestamp date;
> sqlstatement varchar2(300);
> I VARCHAR2(1000);
> begin
> V_organ_tx :=XXXXX;
> for n in (select COLUMN_NAME from category where column_name in (x,y,z,r,t)
> loop
> declare cursor i is
> select distinct n.column_name from v_sum_demo_surg_block where
> v_category_tx=v_category_tx;
> begin
> open i;
> loop
> fetch i into v_value_tx;
> exit when i%notfound;
> --Want to do some additional calculation( count, percentages etc etc) on
> these distinct values in insert into the table--
> insert into sum_DISC_TX (organ_tx, sum_id, datestamp, value_tx)
> values (v_Organ_tx,seq_sum_id.nextval, to_char(sysdate,
> 'MM/DD/YYYY'),v_value_tx);
> end loop;
> end loop;
> end loop;
> end;
> /
>

What error are you getting? Is this the actual code? Well, I see 3 'begin' statements and one 'end' statement. I see 3 'end loop' statements and only 2 'loop' statements. You 'open' your cursor, but never 'close' it. Why do you have an inner begin-(no)end pair?

-- 
[:%s/Karsten Farrell/Oracle DBA/g]
Received on Wed Jul 16 2003 - 14:39:57 CDT

Original text of this message

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