Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction of Oracle database output input syntax and variables

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Oracle database output input syntax and variable introduction, together with Xiaobian to see it. outputs the input

output syntax

dbms_output.put_line begin //output and newline dbms_output.put_line ('hello ')||"Zhang San"); //No newline dbms_output.put ('you are good'); //Add a new line dbms_putout.new_line();end;

entry grammar

& variable name (Note: If it is a string, add single quotes, such as '& variable name') begin dbms_output.put_line ('Zhang San'); dbms_output.put_line ('Li Si');end; variable

Containers for storing data

syntax

declare Variable name 1 Variable Type 1[:= Value1] Variable Name 2 Variable Type 2[:= Value2]

assignment

Method 1: Variable Name:= Value;/Variable Name:=& Variable Name (Determine Value) Method 2: Assignment from query statements---ambiguous values sql: select variable name = column name 1,... from table name where condition oracle: select Column 1, Column 2,... into variable name1, variable name2,... from table name where condition

Examples of variable usage

declare stuName varchar2(30); stuAge number; begin stuName:='jack'; stuAge:=30; dbms_output.put_line('name'||stuName||'age'||stuAge); end

The following query employee name, salary according to the number

declare empno_n number; --employee number ename_s varchar2(30); --name variable sal_n number; --salary begin empno_n:=&empno_n; --Receives a value entered by the user select ename,sal into ename_s,sal_n from emp where empno=empno_n; dbms_output.put_line ('Employee Name:'||ename_s||'Salary'||sal_n); end

The above is Oracle database output input syntax and variable introduction details, after reading whether there is any harvest? If you want to know more, welcome to the industry information! Is a senior professional cloud computing service provider in the industry oh, if you want to buy Cloud Virtual Machine, Hong Kong server, American server and other products, you can pay more attention.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 263

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report