1 查看oracle的版本信息
(1)用客户端连接到数据库,执行select * from v$instance
查看version项
(2)select * from product_component_version
(3)或查询V$VERSION查看组件级信息
2 merge into
1,变量类型
binary_integer
number
date
boolean
varchar2
char
2 声明变量
declare
v_num number := 0;
begin
v_num := 2/v_num;
dbms_output.put_line(v_num);
exception
when others then
dbms_output.put_line('error');
end ;
/
3、dbms_output.put_line('error'); 不能打印boolean false true null(默认)
4、rowtype
declare
v_temp lifztest3%rowtype;
begin
v_temp.xh := 'rp';
dbms_output.put_line(v_temp.xh);
end;
/
5、type
declare
v_temp lifztest3.xh%type;
begin
v_temp.xh := 'rp';
dbms_output.put_line(v_temp.xh);
end;
/
6
declare
i binary_integer :=1 ;
begin
loop
dbms_output.put_line(i);
i := i+1;
exit when ( i>=11 );
end loop;
end;
/
7 SQLCODE
8 SQLERRM
9游标
declare
cursor c is
select * from lifztest3;
v_xh c%rowtype;
begin
open c;
loop
fetch c into v_xh;
exit when ( c%notfound );
if(v_xh.xh in ('1','2')) then
dbms_output.put_line(v_xh.xh);
else
dbms_output.put_line('aaa'||v_xh.xh);
end if;
end loop;
close c;
end;
10 for 循环游标
declare
cursor c is
select * from lifztest3;
begin
for v_xh in c loop
dbms_output.put_line(v_xh.xh);
end loop;
end;
/
11 游标更新数据
declare
cursor c is
select * from lifztest3 for update;
begin
for v_xh in c loop
if(v_xh.xh = '1001') then
update lifztest3 set xh = '00001' where current of c;
else
update lifztest3 set xh = '1111' where current of c;
end if;
end loop;
commit;
end;
/
12 elsif
declare
cursor c is
select * from lifztest3 for update;
begin
for v_xh in c loop
if(v_xh.xh = '1001') then
update lifztest3 set xh = '00001' where current of c;
elsif(v_xh.xh <> '1111') then
update lifztest3 set xh = '100' where current of c;
end if;
end loop;
commit;
end;
/
13 存储过程
create or replace procedure lifzprot
is
cursor c is
select * from lifztest3 for update;
begin
for v_xh in c loop
if(v_xh.xh = '1001') then
update lifztest3 set xh = '00001' where current of c;
elsif(v_xh.xh <> '1111') then
update lifztest3 set xh = '111' where current of c;
end if;
end loop;
commit;
end;
/
14计算一个表字段数
select a.tname,count(*) field_count from tab a,user_col_comments b
where a.tabtype='TABLE' and a.tname=b.table_name and a.tname='表名' group by a.tname
分享到:
相关推荐
Oracle_plsql程序设计基础.pdf PLSQL程序设计.pdf Oracle_PLSQL入门之案例实践.doc PLSQL+Developer工具的使用.doc Oracle+PLSQL实例精解第4版+PDF+建库源码.rar Oracle存储过程超详细使用...oracle常用经典sql查询.pdf
Oracle 10g 的操作命令大全数据库的建立以及操作 表的操作,查询等,plsql的说明以及全部常用的命令。很全的。
ORACLE常用命令 一、ORACLE的启动和关闭 1、在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a、启动ORACLE系统 oracle>svrmgrl SVRMGR>connect internal SVRMGR>startup ...
oracle 数据库常用命令整理 plsql 定期维护 oracle oracle
oracle数据库命令大全
Oracle 常用命令举例 标题 基本语法 %type用法,%rowtype用法,TYPE用法 游标的使用 for 循环 loop循环 while循环 if / else 的用法 case 的用法 标题 错误定义 error的设定 exception用法 ...
详细介绍ORACLE sqlplus命令
里面整理了一些PL/SQL常用的命令,给Oracle数据库的初学者扫扫盲。
您可能感兴趣的文章:常用的Oracle doc命令(收藏)Oracle 多行记录合并/连接/聚合字符串的几种方法Oracle中字符串连接的实现方法php连接oracle数据库及查询数据的方法plsql连接oracle数据库报ora 12154错
Ora9iSQL参考手册,Ora92ErrMsg.chm,Oracle PLSQL.chm,oracle里的常用命令.doc,oracle知识库.CHM,OReilly - Learning.Oracle.PL-SQL.chm,plsql developer 7.0 最新中文手册.pdf,精通Oracle.10g.Pl.SQL编程.pdf
从基础步步深入,教你如何运用Oracle数据库,适合零基础学习Oracle数据库的人。附还包括:PLSQL Developer,Oracle命令大全,Oracle命令参考手册,Oracle常用函数等。
本压缩文件中包含下列文档: Oracle 数据库培训手册—DBA.pdf Oracle 程序员开发指南.pdf Oracle+PLSQL开发基础.doc Oracle9i 数据库设计指引全集.doc OracleTree.txt ... oracle里的常用命令.doc
8. Oracle 和 mysql 的一些简单命令对比参照 9. Oracle8i和Microsoft SQL Server7_0比较 10. Oracle8的不安全因素及几点说明 11. Oracle常见错误代码 12. Oracle常用Script 13. Oracle常用数据字典 14. ORACLE...
启动oracle9i数据库命令: $ sqlplus /nolog SQL*Plus: Release 9.2.0.1.0 - Production on Fri Oct 31 13:53:53 2003 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. SQL> connect / as ...
│ oracle里常用命令 - Oracle - 51CTO技术论坛_中国领先的IT技术社区.mht │ Sequence相关操作命令 - lvhuiqing的专栏 - CSDN博客.mht │ Sequence相关操作命令 - lvhuiqing的专栏 - CSDN博客.mht.lnk │ 为什么...
01-常用命令.txt 02-表空间建表.txt 03-基本查询语句学习笔记.txt 04-高级查询语句学习笔记.txt 05-锁和表分区学习笔记.txt 06-同义词和序列学习笔记.txt 07-视图和索引学习笔记.txt 08-PLSQL和游标结合学习笔记.txt...
这里简单介绍两种常用数据类型:number、varchar2。 number 用来存储整数和浮点数。范围为1e130~10e125,其使用语法为: number[(precision, scale)] 其中(precision, scale)是可选的,precision表示所有数字的...
3、sqlplus常用命令 4、sql 5、锁和表分区 6、数据库对象 7、oop 8、PLSQL 9、游标 10、程和函数 11、触发器 12、导入导出备份 13、如何正确利用rownum来限制查询所返回的行数 每个目录都是单个文件
一、方式一 select * from student for update student表需要操作人修改完commit之后才可以做其他的操作,否则该表会被锁住。... 您可能感兴趣的文章:oracle sqlplus 常用命令大全plsql连接oracle数据库报ora 12
适合自学大数据,文档详细,涉及到Oracle...Linux系统常用命令 大数据:hadoop hive shell脚本 大数据搬运工具:sqoop ,ketlle. 调度工具:azkaban, 可视化软件使用:帆软 数据仓库设计理论,数仓建模,三范式等;