AD

Conditional statements

Conditional statements

With if and case statements

If statement

If syntax

If (expression1) then pl / sql_statement

Else

Pl / sql_statement;

End if;

If (expression1) then pl / sql_statement

Else if (expression2)

Pl / sql_statement;

Else

Pl / sql_statement;

End if;

Case statement

After the introduction from oracle9i

Case <selector>

When <expression1> then pl/sql_statement1;

When <expression2> then pl/sql_statement2;

... ....

[Else pl / sql_statement;]

End;

/ / Case

SQL> declare score number (2): = 80;

2 begin

3 if score> 70 then dbms_output.put_line ('pass in');

4 end if;

5 end;

6 /

SQL> declare score number (2): = 80;

2 begin if score> 90 then dbms_output.put_line ('pass in');

3 else dbms_output.put_line ('unqualified success');

4 end if;

5 end;

6 /

Results failed

SQL> declare score number (2): = 8;

2 begin

3 case score

4 when 9 then dbms_output.put_line ('excellent results');

5 when 8 then dbms_output.put_line ('success off');

6 end case;

7 end;

8 /
标签: lt, sql statement, syntax, conditional statements, pl sql, dbms, case statements, case statement, score number, unqualified success
分类: Database
时间: 2011-04-13

相关文章

  1. [Ghost city classroom] 2-1 acquaintance conditional statements and variables

    Learning Objective: To understand conditional statements and variable tutorial content: Now the stage put a MC ...
  2. linux shell conditional statements

    shell nested conditional statement, the judge twice as far as possible close to the collection <script type ...
  3. Oracle conditional statements and loops

    There are two ways to achieve terms of cycle 1, for the variable in the beginning ... the end of numerical val ...
  4. sqlserver conditional statements

    update update table set Field 1=case when 1 then the condition value 1 when 2 then the condition value 2 else ...
  5. Step-by-step learning Ruby (11): Control statements

    A comparison statement Most other languages, here the attention of <=> Comparison is mainly used to dete ...
  6. PL / SQL Advanced Control statements

    • Introduction In any computer language (C, JAVA, pascal) has a variety of control statements (conditional sta ...
  7. Index-based optimization of SQL statements 降龙十八掌

    Index-based optimization of SQL statements The Dragon 18 Palm Master Plan Create the necessary index <br /& ...
  8. mysql command-line commands and SQL statements, MySQL modify delete increase the field type, field data, etc.

    I. Common mysql command-line command 1 Start service net start mysql MYSQL Stop service net stop mysql MYSQL 2 ...
  9. [Transfer] mysql command-line commands and SQL statements, MySQL modify delete add field type, field data, etc. ..

    I. Common mysql command-line command 1 Start service net start mysql MYSQL Stop service net stop mysql MYSQL 2 ...
  10. JavaScript trap

    This was originally Translation of Estelle Weyl "15 JavaScript Gotchas" , Which are at the introduct ...
  11. Learn Ruby Record - (ruby grammar)

    ROR has been seen that the learners said and I quote: 1, do not ask why so many: a lot of the rules is, as lon ...
  12. Allow the development of automation: the continuing reconfiguration

    Allow the development of automation: the continuing reconfiguration 2008-08-13 Author: Paul Duvall Source: IBM ...
  13. Eclipse plug-ins download Address

    1 EMF, GEF - Graphical Editor Framework, UML2, VE - Visual Editor download here http://www.eclipse.org/downloa ...
  14. Eclipse plug-ins download the relevant address

    Eclipse Download EMF, GEF - Graphical Editor Framework, UML2, VE - Visual Editor download here http://www.ecli ...
  15. Download eclipse plug-ins

    velocity plug: You can download, http://sourceforge.net/projects/veloedit/ There are a: http://www.cnblogs.com ...
  16. MyEclipse shortcut keys and plug-ins Guinness

    Related Articles: Eclipse summary of commonly used classification of shortcut keys Let us work together more e ...
  17. Eclipse plug-common

    subversion Version control, which is equivalent to CVS Installation: http://subclipse.tigris.org/install.html ...
  18. Eclipse plug-in resource links

    1 EMF, GEF - Graphical Editor Framework, UML2, VE - Visual Editor download here http://www.eclipse.org/downloa ...
  19. JavaScript actual manual (covering a wealth of application examples JQuery)

    "JavaScript combat manual" ISBN :978-7-111-25867-4 Price: 89.00 yuan An important aspect of this boo ...