Re: why wont this work ? PL\sql question

From: MarkyG <markg_at_mymail.tm>
Date: 17 Dec 2001 02:32:47 -0800
Message-ID: <ab87195e.0112170232.5348faa_at_posting.google.com>


The problem is somewhere in your SELECT...INTO statement, what would happen if a NO_DATA_FOUND exception was raised? Your function at the moment would return 0.

Best thing to do is to remove the exception handler for the moment and see the error message Oracle is trying to raise (could be a NO_DATA_FOUND, it could be a rights issue for the table cookie.app_data). Once you know the real problem, you can fix accordingly.

Also, should your fields be data_value (not data value)? I assume its just a typo, if it isn't, you are aliasing a database field called 'data' with 'value'! (hope that makes sense)

HTH, Mark

"cookie" <newsreply_at_cookiesoftware.nl> wrote in message news:<9vip7a$jgv$1_at_reader05.wxs.nl>...
> hi everbody
>
> I'm quit new to oracle and i am trying to write some pl/sql code.
> I have writeen this code and what i try to do is this
> i have a table called "APP DATA" wich holds a number. I return this
> number and put the number + 1
> back into the table.
>
> FoundNr INTEGER;
> BEGIN
> FoundNr := 0;
> SELECT Data Value INTO foundnr
> FROM Cookie.App Data
> WHERE Data Type = 1;
>
> IF FoundNr > 0 THEN
> UPDATE cookie.app data
> SET data value = 33
> WHERE data type = 1;
> RETURN FoundNr;
> ELSE
> RETURN 0;
> END IF;
> EXCEPTION
> WHERE OTHERS THEN
> RETURN 0;
>
> Every thing goes ok accept the update statement.
> I causes a jump to the exceptions and a return of 0.
> Running the same update (update app data set data value = 33 where
> data type = 1;) in sql plus work just fine !!!
> What am i doing wrong here ?
>
> Cheers,
>
> Robert
>
> --
Received on Mon Dec 17 2001 - 11:32:47 CET

Original text of this message