You should show the error you get...
with the following:
CREATE OR REPLACE PROCEDURE myproc ()
LANGUAGE SQL
BEGIN
UPDATE BASPPRC01
SET PRCCLASS=IN_PRCCLASS,PRCTER=IN_PRCTER,MESSAGE=IN_MESSAGE
WHERE CAST(IN_LOC||IN_MCO||IN_SYMBOL||IN_POLICYNUM||IN_MODULE||IN_RISKLOC AS CHAR(21))
= CAST(LOCATION||MASTERCO||SYMBOL||POLICYNUM||MODULE||RISKLOC AS CHAR(21)) ;
IF @@ROWCOUNT = 0
BEGIN
INSERT INTO BASPPRC01
(LOCATION,MASTERCO,SYMBOL,POLICYNUM,MODULE,RISKLOC,PRCCLASS,PRCTER,MESSAGE)
VALUES
(IN_LOC
, IN_MCO
, IN_SYMBOL
, IN_POLICYNUM
, IN_MODULE
, IN_RISKLOC
, IN_PRCCLASS
, IN_PRCTER
, IN_MESSAGE ) ;
END
COMMIT TRANSACTION ;
END;
I get [SQL0199] Keyword BEGIN not expected. Valid tokens: THEN.
This passes a syntax check, note THEN
and END IF
instead of BEGIN
also, COMMIT
instead of COMMIT TRANSACTION
CREATE OR REPLACE PROCEDURE procedure2 ()
LANGUAGE SQL
BEGIN
UPDATE BASPPRC01
SET PRCCLASS=IN_PRCCLASS,PRCTER=IN_PRCTER,MESSAGE=IN_MESSAGE
WHERE CAST(IN_LOC||IN_MCO||IN_SYMBOL||IN_POLICYNUM||IN_MODULE||IN_RISKLOC AS CHAR(21))
= CAST(LOCATION||MASTERCO||SYMBOL||POLICYNUM||MODULE||RISKLOC AS CHAR(21)) ;
IF @@ROWCOUNT = 0 THEN
INSERT INTO BASPPRC01
(LOCATION,MASTERCO,SYMBOL,POLICYNUM,MODULE,RISKLOC,PRCCLASS,PRCTER,MESSAGE)
VALUES
(IN_LOC
, IN_MCO
, IN_SYMBOL
, IN_POLICYNUM
, IN_MODULE
, IN_RISKLOC
, IN_PRCCLASS
, IN_PRCTER
, IN_MESSAGE ) ;
END IF;
COMMIT;
END;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…