Home > Database > Mysql Tutorial > body text

Oracle database output input

jacklove
Release: 2018-06-11 23:11:03
Original
3390 people have browsed it

Output input

  • Output syntax

dbms_output.put_line(输出内容)
begin  //输出并换行
  dbms_output.put_line('你好'||"张三");  //不换行
  dbms_output.put('你也好');  //新增一行
  dbms_putout.new_line();end;
Copy after login
  • Input syntax

&变量名 (注:如果是字符串,则加单引号,如 '&变量名')begin
  dbms_output.put_line('张三');
  dbms_output.put_line('李四');end;
Copy after login

Variable

Container for storing data

  • Syntax

 declare
      变量名1   变量类型1[:=值1]
      变量名2   变量类型2[:=值2]
Copy after login
  • Assignment

 方式一:
     变量名:=值;/变量名:=&变量名(确定值)
 方式二:
     从查询语句中进行赋值 --- 不明确的值
 sql:
    select 变量名=列名1,... from 表名 where 条件
 oracle:
    select 列名1,列名2,...into 变量名1,变量名2,... from 表名 where 条件
Copy after login
  • Example of variable usage

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

The following is to query the employee name and salary based on the number

declare
 empno_n number; --员工编号
 ename_s varchar2(30); --姓名变量
 sal_n   number; --薪水
 begin
    empno_n:=&empno_n; --接收用户输入的值
    select ename,sal into ename_s,sal_n from emp where  empno=empno_n; 
    dbms_output.put_line('员工姓名:'||ename_s||'薪水'||sal_n); end
Copy after login

This article explains Oracle database output and input, please pay attention to php Chinese website for more related content.

Related recommendations;

$Selector--how to encapsulate DOM into jquery objects

Native js componentization Develop simple carousel chart example code

css3 animated navigation bar 3D

The above is the detailed content of Oracle database output input. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template