我有一个包裹如下:
create or replace PACKAGE PKG_CONV_PRODUCT
AS
PROCEDURE SP_LOAD_DATA;
PROCEDURE SP_CREATE_BACKUP_TABLES (P_LOADING_ID IN CONV_LOAD_STATS.LOADING_ID%TYPE);
END PKG_CONV_PRODUCT;
包装体如下:
create or replace PACKAGE BODY PKG_CONV_PRODUCT
AS
GV_LOADING_ID PLS_INTEGER;
TYPE TYP_TABLE_NAME
IS
TABLE OF USER_TABLES.TABLE_NAME%TYPE;
TAB_TABLE_NAME TYP_TABLE_NAME := TYP_TABLE_NAME ( 'PRODUCTS',
'PRODUCT_GROUP_CODES',
'PRODUCT_SUB_GROUPS',
'PRODUCT_GROUP_CODES_LICENSES',
'PRODUCTS_OBJECTIVES',
'PRODUCTS_HISTORY',
'PRODUCTS_BREAK_POINTS',
'PRODUCTS_LICENSES',
'PRODUCTS_CONCESSION_PERCENT',
'PRODUCTS_BD_STATUS')
PROCEDURE SP_LOAD_DATA
IS
BEGIN
GV_LOADING_ID := SEQ_CONV_PRODUCT.NEXTVAL;
SP_CREATE_BACKUP_TABLES (GV_LOADING_ID);
END SP_LOAD_DATA;
PROCEDURE SP_CREATE_BACKUP_TABLES(P_LOADING_ID IN CONV_LOAD_STATS.LOADING_ID%TYPE)
IS
L_TABLE_NAME VARCHAR2(50);
BEGIN
FOR INDX IN TAB_TABLE_NAME.FIRST .. TAB_TABLE_NAME.LAST
LOOP
L_TABLE_NAME := TAB_TABLE_NAME (INDX);
IF(L_TABLE_NAME = 'PRODUCT_GROUP_CODES_LICENSES') THEN
L_TABLE_NAME :='PROD_GRP_CODES_LICENSES';
ELSIF(L_TABLE_NAME = 'PRODUCTS_CONCESSION_PERCENT') THEN
L_TABLE_NAME :='PROD_CONCESSION_PERCENT';
ELSIF(L_TABLE_NAME = 'SPONSORS_ADVISORY_APPROVAL') THEN
L_TABLE_NAME :='SPON_ADVISORY_APPROVAL';
END IF;
EXECUTE IMMEDIATE
'CREATE TABLE BONUS.' ||
SUBSTR ('BKP' ||
P_LOADING_ID ||
L_TABLE_NAME ,
1,
30)||
' TABLESPACE APP_TABLE AS SELECT * FROM BONUS.' ||
L_TABLE_NAME ;
EXECUTE IMMEDIATE
'GRANT SELECT ON BONUS.' ||
SUBSTR ('BKP' ||
P_LOADING_ID ||
L_TABLE_NAME ,
1,
30)||
' TO ROLE_BONUS_SELECT_SR01';
END LOOP;
END SP_CREATE_BACKUP_TABLES;
END PKG_CONV_PRODUCT;
我收到了以下错误:
ORA-00955: name is already used by an existing object
ORA-06512: at "BONUS.PKG_CONV_PRODUCT", line 58
ORA-06512: at "BONUS.PKG_CONV_PRODUCT", line 40
ORA-06512: at line 2
你可以帮我解决这个问题吗?
答案 0 :(得分:0)
此查询
SELECT *
FROM user_objects
WHERE object_name = 'PKG_CONV_PRODUCT';
应该告诉你那里有什么物品。可能在不同的模式中有相同包的同义词?
编辑:看起来您的问题与您的包中的CREATE TABLE bonus ...语句有关。
你可以添加一个 执行立即('DROP TABLE BONUS');事先划线。
请注意,将删除BONUS表中的所有现有数据,并且您将需要另一个CREATE TABLE语句源,因为它当前正在查看BONUS表。