admin管理员组文章数量:1122846
IF inOverseasFlag = 'YES' THEN
ELSE
SELECT MPMD06X, -- Account Name
MPMD04X, -- Sort Code
MPMD05X, -- Account Number
MPMD09X -- BS Rollno
INTO vBankAccountName, vBankSortCode, vBankAccountNumber, vBsRollNo
FROM MP_Mandate
WHERE BGroup = inBGroup
AND Mandate = inMandate;
END IF;
IF inOverseasFlag = 'YES' THEN
ELSE
SELECT MPMD06X, -- Account Name
MPMD04X, -- Sort Code
MPMD05X, -- Account Number
MPMD09X -- BS Rollno
INTO vBankAccountName, vBankSortCode, vBankAccountNumber, vBsRollNo
FROM MP_Mandate
WHERE BGroup = inBGroup
AND Mandate = inMandate;
END IF;
Share
Improve this question
edited Nov 21, 2024 at 18:34
msanford
12.2k13 gold badges71 silver badges98 bronze badges
asked Nov 21, 2024 at 18:31
AlexAlex
1
3
|
1 Answer
Reset to default 1"Do nothing" in pl/sql can be achieved with the NULL
statement. The NULL statement is a ''no-op" (no operation)—it only passes control to the next statement. Sometimes it can be useful to write an branch in an IF ELSEIF
statement that doesn't do anything but makes code more understandable. It also comes in handy when writing new code as a temporary placeholder.
Example:
DECLARE
l_var VARCHAR2(100);
BEGIN
IF (l_var = 'FOO') THEN
-- no action needed for FOO, but showing it here anyway.
NULL;
ELSIF (l_var = 'BAR') THEN
dbms_output.put_line('BAR');
END IF;
END;
For reference, here is the documentation
本文标签: plsqlIn the if statement I would like the first parameter to do nothingStack Overflow
版权声明:本文标题:plsql - In the if statement I would like the first parameter to do nothing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736308050a1933524.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
IF inOverseasFlag != 'YES' THEN SELECT MPMD06X,
etc.!=
means does not equal. Documentation: Comparison Conditions. "If A Then X Else Y" is logically the same as "If !A Then Y Else X" where A is a binary condition. – Andrew Morton Commented Nov 21, 2024 at 18:41