db2新手。版本11。在创建存储过程时,它在“from”附近给出了一个错误错误语法预期:bulkinfo
CREATE PROCEDURE My_StrProc
( IN @rollNumber Varchar(18),
IN @studentType Varchar(3),
OUT @studentID Varchar(15),
OUT @oldStudentType Varchar(4) ,
OUT @oldBranch Varchar(3) ,
OUT @newStudentType Varchar(4) ,
OUT @newBranch Varchar(4)
)
BEGIN
IF @studentType IS NOT NULL
THEN
Select
@studentID = REGISTRATION_NO,
@oldStudentType = OLD_STUD_TYPE,
@oldBranch = OLD_BRANCH,
@newStudentType = NEW_STUD_TYPE,
@newBranch = NEW_BRANCH
From
Migrated_Student
Where
OLD_STUDENT_NUM = @rollNumber and
ACTIVE = 'P';
ELSE
Select
@studentID = REGISTRATIONNO,
@oldStudentType = OLD_STUD_TYPE,
@oldBranch = OLD_BRANCH,
@newStudentType = NEW_STUD_TYPE,
@newBranch = NEW_BRANCH
From
Migrated_Student
Where
OLD_STUDENT _NUM = @rollNumber and
OLD_ STUDENT _TYPE = @studentType and
ACTIVE = 'P';
END IF;
END;
1条答案
按热度按时间bxjv4tth1#
如果您使用的是ansisqlpl语法,那么您的过程如下所示。
注意,与其他rdbms不同,变量和参数不应该以@字符开头。
使用命名约定,比如
p_
表示参数,或v_
表示变量只是可选的噪声,但有些人喜欢它。