 |
 |
Archives of the TeradataForum
Message Posted: Fri, 22 Feb 2008 @ 18:22:05 GMT
Subj: | | Stored Procedure error SPL1031 |
|
From: | | Hassinger, Bill |
I am creating a stored procedure to revoke logons for dormant account. Below is the Text and error codes, can someone help me correct the
problem?
CREATE PROCEDURE sysdba.DormantUser()
BEGIN
/* declare Variables */
DECLARE userid CHAR(8);
/* create cursor */
FOR Dormant AS secondcurse CURSOR FOR
SELECT UserName
FROM DBC.Allusers
WHERE (UserName LIKE 'student_1%')
/* process records */
DO
SET userid = Dormant.UserName ;
REVOKE Logon ON ALL TO :userid ;
INSERT INTO mmadmindb.removeaccess(
loginid ,DateofAction , ReasonCode ,
CommentText , AdminID)
SELECT :UserId ,DATE ,'r'
, 'Logon Revoked as Dormant Account' ,
USER ;
END FOR;
END;
ERRORS:
SPL1031:E(L12), Referring to undefined alias 'UserName'._
SPL1027:E(L13), Missing/Invalid SQL statement'E(3707):Syntax error,
expected something like a name between the 'TO' keyword and ...
Thanks
Bill H
| |