Plsql运行mysql脚本_oracle中PLSQL语句

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 st

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之间

f68f2add0b68e4f9810432fce46917b7.png

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值