---
--- ======================PL-SQL Basic====================
---
/**create table stu*/
create table stu(
id number(3),
name char(8),
score number(3),
age number(2),
sex char(2)
)
---
--- =========================over========================
---
/**insert one result*/
insert into stu values(3,'zheng',88,24,'f')
---
--- =========================over========================
---
/**query table stu*/
select * from stu
---
--- ==========================over=======================
---
/**select the count of score>60*/
declare
totle number(3);
begin
select count(*) into totle
from stu
where score>60;
/*if -- end if,please remember it*/
if totle<>0 then
dbms_output.put_line('the number of score>60 is '||to_char(totle));
end if;
end;
---
--- ==========================over=======================
---
/**select score >95,exist?*/
declare
totle number(3);
begin
select count(*) into totle
from stu
where score>80;
if totle<>0 then
/**add one condition*/
if totle>1 then
dbms_output.put_line('score>95 exist! ^^...the totle is:'||totle);
end if;
end if;
end;
---
--- =========================over========================
---
/**function avg*/
declare
avgage number(3,1);
begin
select avg(age) into avgage
from stu;
if avgage>24 then
dbms_output.put_line('the age is beyond 24! and avg(age) is:'||avgage);
else
dbms_output.put_line('the age is low to 24!');
end if;
end;
---
--- ========================over=========================
---
/**for the math function*/
declare
a number;
b number;
c number;
d number;
x1 number(4,2);
x2 number(4,2);
begin
a:=2;
b:=8;
c:=4;
/**sqrt() for d*/
d:=sqrt(b*b-4*a*c);
/**if -- else series*/
if a=0 then
x1:=-b/a;
dbms_output.put_line('only one result:'||to_char(x1));
elsif d<0 then
dbms_output.put_line('the result doesnt exist!');
else
x1:=(-b-d)/(2*a);
x2:=(-b+d)/(2*a);
dbms_output.put_line('there are two fun_result:x1='||x1);
dbms_output.put_line('there are two fun_result:x2='||x2);
end if;
end;
---
--- ========================over=========================
---
/**10! --method1*/
declare
i number;
step number;
begin
i:=1;
step:=1;
loop
i:=i*step;
step:=step+1;
if step>10 then
exit;
end if;
end loop;
dbms_output.put_line('10!='||i);
end;
---
--- ========================over=========================
---
/**10! --method2*/
declare
i number;
step number;
begin
i:=1;
step:=1;
loop
i:=i*step;
step:=step+1;
exit when(step>10);
end loop;
dbms_output.put_line('10!='||i);
end;
---
--- ========================over=========================
---
/**10! --method3*/
declare
i number;
step number;
begin
i:=1;
step:=1;
/**
* while loop...end loop;
*/
while step<11
loop
i:=i*step;
step:=step+1;
end loop;
dbms_output.put_line('10!='||i);
end;
---
--- ========================over=========================
---
/**10! --method4*/
declare
i number:=1;
step number;
begin
for step in 1..10
loop
i:=i*step;
end loop;
dbms_output.put_line('10!='||i);
end;
---
--- ========================over=========================
---
/**case -- when*/
declare
stuname char(8);
stuscore number(2);
begin
select name into stuname
from stu
where id=2;
case stuname
when 'master' then stuscore:='98';
when 'lang' then stuscore:='91';
when 'zheng' then stuscore:='88';
else
stuscore:='name is nulll!';
end case;
dbms_output.put_line(stuname||':'||stuscore);
end;
---
--- ========================over=========================
---
分享到:
相关推荐
PL-SQL Developer V11.06_64位汉化破解版。这个是连接Oracle数据库的开发工具,需要配合instantclient-basic-windows.x64-11.2.0.4.0 这个工具实现连接远程的Oracle Server
pl/sql basic procedures/vectors/triggers
重装pl/sql,到官网去注册,下载,还遇到链接库不匹配,搞半天,这次就直接放上来了
Technology PL/SQL Disciplined PL/SQL By Steven Feuerstein Four simple guidelines for improving the quantity and quality of PL/SQL code you write
文件中包含了instantclient-basic-win32-11.2.0.1.0.rar,PLSQL+Developer+10.0.2.1697+中文绿色注册版.rar,详细配置文档 如有疑问参考博客:https://blog.csdn.net/idomyway/article/details/81210805
instantclient-basic-win32-10.2.0.5,oracle32位客户端,解决PL/SQL DEV 不能识别oci.dll的问题
精简oracle客户端,如可以通过该软件实现PL/SQL developer链接到远程服务器上的Oracle服务器
1、下载instantclient-basic-win32-11.2.0.1.0此为压缩包,解压就行(路径如:D:\oracle\instantclient\instantclient).解压的路径自行调整 2、新建tnsnames.ora文件,路径如(D:\oracle\instantclient\instantclient...
win7+64位+Oracle+11g+64位下使用PLSQL+Developer+的解决法1)安装Oracle11g64位2)安装32位的Oracle客户端(instantclient-basic-win32-11.2.0.1.0)下载instantclient-basic-win32-11.2.0.1.0.zip(一定得是32位的...
接着打开PL/SQL,在perference->Connection里面设置OCI Library和Oracle_Home,我的设置是OCI Library=c:\oracleclient\oci.dll,Oracle_Home=c:\oracleclient,c:\oracleclient是指刚才解压缩Instant Client的目录 ...
解决Oracle11g,PL/SQL连接报错问题 解压 解压instantclient-basic-nt-11.2.0.2.0.zip,例如到D:\instantclient_11_2 3、设置PLSQL Developer 启动PLSQL Developer,不登录点取消进入PLSQL Developer,Tools->>...
instantclient是连接orcal数据库的一个轻量级客户端工具,对于想用plsql但又不想安装oracle client的可以用这个替代;压缩包内附安装及配置说明;
Basic Oracle Security and PL / SQL
pl/sql 无法连接到oracle使用,详情见帖。此插件为64位,当提示确认安装了64位oracle client时可以使用此插件。
PLSQL_ instantclient-basic-windows.x64-12.2, pl/sql配置Oracle绿色客户端InstantClient
oracle官方精简64位PL/SQL客户端 instantclient-basic-windows.x64-12.1.0.2.0.7z
免安装Oracle客户端软件 配置pl/sql可远程连接oracle 具体配置信息可参考 http://blog.csdn.net/itmyhome1990/article/details/8796781
instantclient-basic-win32-10.2.0.5,oracle32位客户端,解决PL/SQL DEV 不能识别oci.dll的问题
用于SQL和PL / SQL查询的SQL * Plus命令行工具.方便用户通过plsql连接,有32位和64位 包含: instantclient-basic-windows.x64-12.2.0.1.0 instantclient-sqlplus-windows.x64-12.2.0.1.0
instaclient-basic-win32-11.2.0.1.0 CSDN下载!!! 这个在安装 PL/SQL Developer 集成开发工具时,必须的,而且必须为32bit的,如果你下载并配置了64bit的,到最后你还是会发现没有效果。