oracle
来源:互联网 发布:jav网络机顶盒v8固件 编辑:程序博客网 时间:2024/06/16 11:05
set serveroutput on
declare
name VARCHAR2(20):='faafaf';
begin
dbms_output.put_line(name);
end;
/
一定就单引号,多个空格也不行。
select ... into 语句赋值,其结果必须是一行,不能多行或无纪录。
select ename from scott.emp where empno=7934;
declare
name varchar2(50) default 'null';
begin
select ename into name from scott.emp where empno='7934';
dbms_output.put_line(name);
end;
/
课本P193
declare
m number;
n number;
begin
m:=10;
n:=20;
if m-n>=0 then
dbms_output.put_line(m||'>'||n);
end if;
dbms_output.put_line(m||'<'||n);
end;
课本P195
case 语句
declare
xf number;
begin
select sal into xf from scott.emp where empno=7934;
case
when xf>2500 then
dbms_output.put_line('你的钱好多啊');
when xf>1500 then
dbms_output.put_line('你的钱好多啊2');
else
dbms_output.put_line('你的钱好多啊3');
end case;
dbms_output.put_line('wc');
end;
/
create table scott.temp(id number);
declare
i integer:=1;
begin
loop
insert into scott.temp values (i);
exit when i=10;
i:=i+1;
end loop;
end;
select * from scott.tmep;
declare
name VARCHAR2(20):='faafaf';
begin
dbms_output.put_line(name);
end;
/
一定就单引号,多个空格也不行。
select ... into 语句赋值,其结果必须是一行,不能多行或无纪录。
select ename from scott.emp where empno=7934;
declare
name varchar2(50) default 'null';
begin
select ename into name from scott.emp where empno='7934';
dbms_output.put_line(name);
end;
/
课本P193
declare
m number;
n number;
begin
m:=10;
n:=20;
if m-n>=0 then
dbms_output.put_line(m||'>'||n);
end if;
dbms_output.put_line(m||'<'||n);
end;
课本P195
case 语句
declare
xf number;
begin
select sal into xf from scott.emp where empno=7934;
case
when xf>2500 then
dbms_output.put_line('你的钱好多啊');
when xf>1500 then
dbms_output.put_line('你的钱好多啊2');
else
dbms_output.put_line('你的钱好多啊3');
end case;
dbms_output.put_line('wc');
end;
/
create table scott.temp(id number);
declare
i integer:=1;
begin
loop
insert into scott.temp values (i);
exit when i=10;
i:=i+1;
end loop;
end;
select * from scott.tmep;
0 0
- Oracle???
- oracle
- oracle
- oracle
- oracle
- oracle...
- oracle
- oracle
- ORACLE
- Oracle
- ORACLE
- Oracle
- Oracle
- oracle
- oracle
- oracle
- ORACLE
- oracle
- 第十一周项目三——程序的多文件组织
- 切面条
- Android系统添加config.xml 新配置
- js控制合并单元格-行/列
- shell中的四种模式匹配
- oracle
- python的字符串、编码问题
- Leetcode: Spiral Matrix II
- PostgreSQL学习手册6-10
- shell的sort命令的-k参数
- 线程认识
- shell脚本中的sort命令
- 应用系统之间数据传输的几种方式
- 黑马程序员------I/O流