数字转日期 pl/sql_交换两个数字的PL / SQL程序

蔚落 2022-12-07 13:54 221阅读 0赞

0e14885b70dcdd492fb2e85aefb00069.png

数字转日期 pl/sql

Here you will get pl/sql program to swap two numbers with and without using temporary variable.

在这里,您将获得pl / sql程序,可以在使用和不使用临时变量的情况下交换两个数字。

Method 1: Using Temporary Variable

方法1:使用临时变量

  1. declare
  2. a number;
  3. b number;
  4. temp number;
  5. begin
  6. a:=5;
  7. b:=10;
  8. dbms_output.put_line('before swapping:');
  9. dbms_output.put_line('a='||a||' b='||b);
  10. temp:=a;
  11. a:=b;
  12. b:=temp;
  13. dbms_output.put_line('after swapping:');
  14. dbms_output.put_line('a='||a||' b='||b);
  15. end;
  16. /

Output

输出量

before swapping: a=5 b=10 after swapping: a=10 b=5

交换前: a = 5 b = 10 交换后: a = 10 b = 5

Method 2: Without Using Temporary Variable

方法2:不使用临时变量

  1. declare
  2. a number;
  3. b number;
  4. begin
  5. a:=5;
  6. b:=10;
  7. dbms_output.put_line('before swapping:');
  8. dbms_output.put_line('a='||a||' b='||b);
  9. a:=a+b;
  10. b:=a-b;
  11. a:=a-b;
  12. dbms_output.put_line('after swapping:');
  13. dbms_output.put_line('a='||a||' b='||b);
  14. end;
  15. /

翻译自: https://www.thecrazyprogrammer.com/2017/08/plsql-program-swap-two-numbers.html

数字转日期 pl/sql

发表评论

表情:
评论列表 (有 0 条评论,221人围观)

还没有评论,来说两句吧...

相关阅读