数字转日期 pl/sql_PL / SQL程序加两个数字

数字转日期 pl/sql

In the previous tutorial we have learnt much about PL/SQL variables, operators, data types and other such fundamental topics. Let us get into real programming now onwards.

For starters, let us look at a PL/SQL program to add two numbers or integers and fetching the result into a third variable.

This program takes two inputs one for each variable and adds the result to a third variable and prints it. 

PL/SQL Program To Add Two Numbers


Output

PL/SQL Program To Add Two Numbers

Since, we need variables in this program code so we need to declare them in the declaration section. In the begin section, we need to initialize and take input from the user. All the logical and mathematical calculations for this program logic need to be established here.

Var1:=&var1;
This statement assigns the value that the user enters for the variable. Similarly, we have taken input for next variable.

Var3:=var1+var2
This statement is used to assign the calculated values of Var1 and Var2 into the third variable.

Dbms_output.put_line()
The statement takes a parameter which can be printed onto the console screen.

Note: For this statement to work properly, it is sometimes necessary to use a particular statement as mentioned below:

When you start the SQL Command Prompt/Terminal, just type:


Set serveroutput on;

This statement is used to activate the working of print statement on the console screen. This will help to get the proper output onto the screen/terminal as expected.

Finally, the End statement is used to terminate the code.

翻译自: https://www.thecrazyprogrammer.com/2015/06/plsql-program-to-add-two-numbers.html

数字转日期 pl/sql

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值