存储过程 编译错误:PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:

来源:互联网 发布:松竹梅清酒 知乎 编辑:程序博客网 时间:2024/05/17 04:45

必须使用动态的语句, DDL 语句,在存储过程中, 需要改为动态语句  :

execute immediate 'sql语句' ; 

我的是因为执行了  

truncate table t_pvbdp_comprehensiv_statistic
换成  
 execute immediate 'truncate table t_pvbdp_comprehensiv_statistic' ; 

就可以了



DDL 语句指 : 

DDL     create table 创建表   alter table  修改表  drop table 删除表  truncate table 删除表中所有行   create index 创建索引  drop index  删除索引当执行DDL语句时,在每一条语句前后,oracle都将提交当前的事务。如果用户使用insert命令将记录插入到数据库后,执行了一条DDL语句(如create table),此时来自insert命令的数据将被提交到数据库。当DDL语句执行完成时,DDL语句会被自动提交,不能回滚。

0 0
原创粉丝点击