oracle 创建过程
create table test1 as select 1 id,'create table test2(id number,name varchar2(200));insert into test2 values(1,''a'');' sqltext from dual
2 union all select 2,'truncate table test2;' from dual
3 union all select 3,'insert into test2 select rownum,dbms_random.string(''l'',3) from dual connect by rownum<10;delete from test2 where id between 3 and 5;' from dual;
Table created
SQL>
SQL> create or replace function exc_sql(str in varchar2)return varchar2
2 as
3 pragma autonomous_transaction;
4 v_error varchar2(200);
5 begin
6 for i in 1..length(str)-length(replace(str,';')) loop
7 execute immediate substr(str,instr(';'||str,';',1,i),instr(str,';',1,i)-instr(';'||str,';',1,i));
8 end loop;
9 commit;
10 return 'ok';
11 exception
12 when others then
13 v_error:=sqlerrm;
14 return v_error;
15 end;
16 /
Function created
SQL> select test1.*,exc_sql(sqltext) from test1 where id=1;
ID SQLTEXT EXC_SQL(SQLTEXT)
---------- -------------------------------------------------------------------------------- --------------------------------------------------------------------------------
1 create table test2(id number,name varchar2(200));insert into test2 values(1,'a') ok
SQL> select * from test2;
&nb
相关文档:
在一表orginfo上建立触发器,其中包括以下动作:
增删改此表的记录时,需要查询此表,甚至改写此表的其他记录。报告“ora-04091:表已经被修改,对于触发器/函数不可见”。
Cause: A trigger (or a user defined PL/SQL function that is referenced in this statement) attempted to look at (or modify) a tab ......
我在oracle 9i的环境下开发了occi的应用,结果放到10g(10.2.0.3)服务器上运行不了(只装了windows 版的10g服务端),只好把所有依赖的9i的dll拷过去,结果连接occi报错:
Error while trying to retrieve text for error ORA-32101
到http://www.oracle.com/technology/global/cn/software/tech/oci/instantclient/index.ht ......
package com.deng.oracle;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class TestOracle {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriv ......
Oracle管理与维护.数据库登录的身证验证
草木瓜
20080505
一、写在前面
曾经并不知道conn / as sysdba为何物,在unix下搞了半天方知,还需要加上"号,Oracle 10g里
终于也考虑到了这个问题,不再受到" as sysdba "的限制。
如下所示:
[oracle@liwei admin]$ sqlplus / as sysdba
......