一个存储过程的问题
这个是执行动态SQL的存储过程,可是当执行以下的SQL语句的时候,却出现错误,错误信息为:ORA-00942:表或视图不存在。
insert into java.customers_4340000(customer_id,login_name,customer_type,name,sex,birth_date,
dist_code,address,postalcode,telephone,certificate_type,certificate_code,org_type,org_name,
description,customer_status,register_time,valid_date,message_address,fax,email,customer_point,
customer_level,vip_card_no,customer_like,custom_consume,credit_how,up_customer_id,fidelity_how,
certificate_address,send_type,password,linkman,linkman_telephone) values('000000000021',NULL,0,'newsky','',
NULL,'1','','2100000','','4','0000000000000021','','','','1',sysdate,to_date('yyyymmdd',''),'远大一路','',
'',0,0,NULL,'','',5,'','0','远大一路','3','222','于','5433092');
可是直接执行并没有错误,表和用户都是存在的。
储存过程如下:
CREATE OR REPLACE PROCEDURE LINE.execute_sql (sql_str IN VARCHAR2) AS
cid INTEGER;
v_rownum number(10);
BEGIN
/* Open new cursor and return cursor ID. */
cid := DBMS_SQL.OPEN_CURSOR;
/* Parse and immediately execute dynamic SQL statement built by
concatenating table name to DROP TABLE command. */
DBMS_SQL.PARSE(cid, sql_str, DBMS_SQL.V7);
v_rownum:=DBMS_SQL.EXECUTE(cid);
/* Close cursor. */
DBMS_SQL.CLOSE_CURSOR(cid);
EXCEPTION
/* If an exception is raised, close cursor before exiting. */
WHEN OTHERS THEN
DBMS_SQL.CLOSE_CURSOR(cid);
RAISE; -- reraise the exception
-- rollback;
END execute_sql;
/
|