Hi,

I'm new to SAP DB and totally stuck.

I tried to compile the following procedure but I allways get the error
"Missing delimiter". Some of the database columns are named like keywords
(which can't be the problem cause there are no problems in normal inserts or
updates).

Any help would be apreciated.

CREATE DBPROC getnewkey (IN strtable CHAR(20), IN dpkey FIXED(14,0), OUT
newID FIXED(14,0)) AS

VAR l_key FIXED(14,0);

SET l_key = -1;

SELECT "KEY" FROM USER.PRIMKEYS WHERE "TABLE" = :strtable;

IF ($rc = 0) THEN
    BEGIN
        FETCH INTO :l_key;
        IF l_key > -1 THEN
            BEGIN
                SET l_key = l_key + 1;
                UPDATE USER.primkeys SET key = :l_key WHERE table =
:strtable;
            END
        ELSE
            BEGIN
                INSERT INTO USER.primkeys (key, table) VALUES (:dpkey,
:strtable);
                SET l_key = dpkey;
            END
    END

SET newID = l_key;




_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to