Função quot;se()quot;
Caros amigos,
Existe alguma função em SQL equivalente ao ´se()´ existente no excel?
[]´s
Existe alguma função em SQL equivalente ao ´se()´ existente no excel?
[]´s
Roa
Curtidas 0
Respostas
Aroldo Zanela
21/03/2003
There are two forms of if statement: if...then and the if...then...else. The syntax of an if...then statement is
if expression then statement
where expression returns a Boolean value. If expression is True, then statement is executed; otherwise it is not. For example,
if J <> 0 then Result := I/J;
The syntax of an if...then...else statement is
if expression then statement1 else statement2
where expression returns a Boolean value. If expression is True, then statement1 is executed; otherwise statement2 is executed. For example,
if J = 0 then
Exit
else
Result := I/J;
The then and else clauses contain one statement each, but it can be a structured statement. For example,
if J <> 0 then
begin
Result := I/J;
Count := Count + 1;
end
else if Count = Last then
Done := True
else
Exit;
Notice that there is never a semicolon between the then clause and the word else. You can place a semicolon after an entire if statement to separate it from the next statement in its block, but the then and else clauses require nothing more than a space or carriage return between them. Placing a semicolon immediately before else (in an if statement) is a common programming error.
if expression then statement
where expression returns a Boolean value. If expression is True, then statement is executed; otherwise it is not. For example,
if J <> 0 then Result := I/J;
The syntax of an if...then...else statement is
if expression then statement1 else statement2
where expression returns a Boolean value. If expression is True, then statement1 is executed; otherwise statement2 is executed. For example,
if J = 0 then
Exit
else
Result := I/J;
The then and else clauses contain one statement each, but it can be a structured statement. For example,
if J <> 0 then
begin
Result := I/J;
Count := Count + 1;
end
else if Count = Last then
Done := True
else
Exit;
Notice that there is never a semicolon between the then clause and the word else. You can place a semicolon after an entire if statement to separate it from the next statement in its block, but the then and else clauses require nothing more than a space or carriage return between them. Placing a semicolon immediately before else (in an if statement) is a common programming error.
GOSTEI 0