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: PL/SQL query not giving desired results...

Re: PL/SQL query not giving desired results...

From: Henning Follmann <henning_at_odin.follmann-net>
Date: Tue, 11 Sep 2001 07:41:29 -0400
Message-ID: <slrn9prtsh.t3.henning@odin.follmann-net>

I think your procedure has some flaws:
1 The number might change between the two statements so I would prefer:

CURSOR a_profile IS
SELECT profile from account
WHERE profile IS NOT NULL;

And this is the second bug. For testing for NULL you have to use IS NULL IS NOT NULL ! do _NOT_ use = NULL or != NULL.

the LOOP:

FOR mycursor IN a_profile
LOOP END LOOP; The weired counting statement is not so good!

On Tue, 11 Sep 2001 10:31:52 +0530, Anil Kanwar <akanwar_at_dh.cit.alcatel.fr> wrote:
>I am using following code to update the fields :
>................
>................
>CURSOR a_profile is
> select profile from account;
>.....................
>.....................
> select count(*) into rows_no from account;
> for counter in 1..rows_no loop
> fetch a_profile into profile_val;
> if (profile_val != NULL) then
> select d_inact into d_inact_val from accountp
>where profile_val = ri;
> update account set
> d_tr = to_char(to_date(d_tac,'DD/MM/YYYY') +
>d_inact_val)
> where profile = profile_val;
> end if;
> end loop;
>
>This pocedure is getting executed successfully but when I see the table
>account for d_tr it shows no change.Although there are values in
>d_inact/accountp. I f I replace d_inact_val with a constant say 10, it
>executes fine.
>
>Please help out.
>
>thanks
>Anil
>

-- 
Henning Follmann
8 Jane Road
New Providence, NJ 07974
Tel.: +1 908 656 7061
H.Follmann_at_gmx.de


-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----
Received on Tue Sep 11 2001 - 06:41:29 CDT

Original text of this message

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