oracle中PLSQL语句
来源:互联网 发布:苹果mac充电器灯不亮 编辑:程序博客网 时间:2024/05/07 18:35
1.set autot off 禁止使用autotrace命令
set autot on 这个命令包括exp 和 stat(执行语句、生成explain plan、生成统计信息)
set autot trace 不执行sql语句,但(生成explain plan、生成统计信息)
set autot trace exp stat 与上句同
set autot trace stat 不执行sql语句,但(生成explain plan)
2.序列Sequence_name.nextval 求出接下来的最高值
Sequence_name.currval 最近一次调用nextval时返回的值
3. 创建以10开始的序列create sequence my_sequence start with 10;
查询序列中接下来的最高值 select my_sequence.nextval from dual;
4. create sequence student_seq;
create table student(n varchar(10));
insert into student values('a'||lpad(student_seq.nextval,9,'0'));
select * from student;
N
----------
a000000002
5. --execute immediate 'set constraints all deferred';
create or replace procedure p is
begin
insert into student values ('a000000004');
insert into student values('a000000005');
insert into student values ('a000000006');
commit;
end p;
6.select * from tab;查看表空间中所有表
7.select * from v$tablespace;查看数据库中的所有表空间
8.
set serveroutput on
即打开oracle自带的输出方法dbms_output。在执行set serveroutput on以后,
使用dbms_output方法可以输出信息,
例如:dbms_output.put_line('This is mine');
1)创建存储过程
SQL> set serveroutput on
SQL> create or replace procedure hello IS
2 begin
3 dbms_output.put_line('hello world');
4 end;
5 /
过程已创建。
2)执行存储过程
SQL> execute hello (或者exec hello)
hello world
PL/SQL 过程已成功完成。
3)删除存储过程
SQL> drop procedure hello
2 ;
过程已删除。
9.SQL*Plus 缓冲区默认大小是20,000字符,最大可以增加到1,000,000字符
SQL> execute dbms_output.enable(1000000);
PL/SQL 过程已成功完成。
将缓冲区的内容保存到文件中
SQL> create or replace procedure hello is
2 begin
3 dbms_output.put_line('hello world,zhang da wang,heihei');
4 end;
过程已创建。
SQL> save hello
已创建 file hello.sql --文件的路径为:F:\oracle\product\10.2.0\db_1\BIN
SQL> @hello.sql
过程已创建。
SQL> exec hello
hello world,zhang da wang,heihei
PL/SQL 过程已成功完成。
10.赋值操作符“:=”
if条件判断表达式IF(a=b)
字符串连接操作符“||”
变量声明区位于IS和BEGIN之间
- oracle中PLSQL语句
- Oracle中plSql中If语句
- Oracle PLSQL语句实例
- Oracle PLSQL语句实例
- oracle plsql语句、游标
- Oracle中PLSQL中if语句的写法
- Oracle 基本 以及 plsql 语句
- Oracle中plsql游标
- Oracle/PLSQL: FOR Loop 循环语句
- Oracle中的plsql语句的小基础
- oracle 存储过程以及plsql语句块
- ORACLE—plsql创建触发器语句
- oracle-PLSQL的一些基本语句使用
- plsql中查看Oracle版本
- plsql中配置oracle客户端
- oracle-检查对象存在与否,并建立相应对象--plsql中使用DDL语句如Create 等
- Oracle + plsql 可以执行的一条 while 循环语句
- Oracle pl/sql编程 4---plsql块中的sql语句
- Linux之进程篇
- proteus问题集锦
- cmd 实用快捷键
- Jboss 5 jndi环境搭建
- C# 读写ini文件
- oracle中PLSQL语句
- Linux下C开发工具介绍
- 将空间设为背景色
- 多线程详细分析与介绍
- exit(0)与exit(1)、return区别
- ubuntu下sun-java6-jdk的安装
- android性能调试
- VB.NET 机房收费系统之组合查询
- map/set iterator not dereferencable