Re: Forms 6.0 : Problem inserting record
Date: 2000/06/30
Message-ID: <slpc2jqsjev51_at_corp.supernews.com>#1/1
"Guillaume Serre" <guillaumeserre_at_hotmail.com> wrote in message
news:8jhjlb$p8m$1_at_nnrp1.deja.com...
> Hi,
>
> I have a forms 6.0 form based on an Oracle 7.3.4 table.
> Insert sometimes fails with the error FRM-40508 : Unable to insert
> record.
> Shift F1 displays unreadable characters in "SQL Statement in error",
> and the Error box displays "ORA-01403 : No data found". It doesn't
> happen every time, if I close the form and reopen it the insert works.
It's using an implicit cursor somewhere, possibly on KEY-COMMIT, PRE-INSERT, ON-INSERT, or POST-INSERT. (Or the problem could be with a database trigger on a table too if it uses PL/SQL with an implicit cursor.)
Look for code that looks like this:
SELECT... INTO... FROM...
Any time you do a SELECT INTO, it expects one and only one row returned. If you get a NO_DATA_FOUND, no rows were returned. If you get a TOO_MANY_ROWS, more than one row was returned.
Either surround it with an exception handler:
BEGIN
SELECT... INTO... FROM...
EXCEPTION
WHEN NO_DATA_FOUND THEN
DO_SOMETHING;
WHEN TOO_MANY_ROWS THEN
DO_SOMETHING_ELSE;
WHEN OTHERS
DO_SOME_CATCH_ALL_STUFF;
END; Or, make it into a cursor:
DECLARE
MY_VARIABLE <type> := NULL;
MY_CURSOR IS
SELECT...
FROM...;
BEGIN
OPEN MY_CURSOR;
FETCH MY_CURSOR INTO MY_VARIABLE;
IF MY_CURSOR%NOTFOUND THEN
CLOSE MY_CURSOR;
DO_SOMETHING;
ELSE
CLOSE MY_CURSOR;
DO_SOMETHING_ELSE;
END IF;
END;
Received on Fri Jun 30 2000 - 00:00:00 CEST