Answer the question
In order to leave comments, you need to log in
Why does the update statement not work?
CREATE OR REPLACE FUNCTION SALES.GetCertificateSeq( id in number )
RETURN NUMBER AS PRAGMA autonomous_transaction;
currentSequence NUMBER(10,0);
BEGIN
currentSequence := 0;
SELECT
max(vr.CERTIFICATE) INTO currentSequence
FROM
VAGON_REGISTR vr
WHERE
vr.ID = id;
IF currentSequence is not null THEN
return currentSequence;
END IF;
currentSequence := CERTIFICATE_SEQ.NEXTVAL;
UPDATE
VAGON_REGISTR vr
SET vr.CERTIFICATE = currentSequence WHERE vr.ID = id;
return currentSequence;
END;
Answer the question
In order to leave comments, you need to log in
I recommend that you redo this code.
In the presence of neglect of some development standards.
one.
id in number
currentSequence NUMBER(10,0);I believe that you are not paid for lines of code. This should be combined into
BEGIN
currentSequence := 0;
currentSequence NUMBER(10,0) := 0 ;
currentSequence := 0;
SELECT
max(vr.CERTIFICATE) INTO currentSequence
FROM
VAGON_REGISTR vr
WHERE
vr.ID = id;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question