我执行了一个创建下表的PL / sql脚本
TABLE_NAME VARCHAR2(30) := 'B2BOWNER.SSC_Page_Map';
我使用参数为此表插入了一个函数
CREATE OR REPLACE FUNCTION F_SSC_Page_Map_Insert( p_page_id IN B2BOWNER.SSC_Page_Map.Page_ID_NBR%TYPE,p_page_type IN B2BOWNER.SSC_Page_Map.Page_Type%TYPE,p_page_dcpn IN B2BOWNER.SSC_Page_Map.Page_Dcpn%TYPE)
我被通知我必须声明B2BOWNER.SSC_Page_Map之前,它作为我的函数的参数.为什么我得到这个错误?
编辑:实际错误
Warning: compiled but with compilation errors Errors for FUNCTION F_SSC_PAGE_MAP_INSERT LINE/COL ERROR -------- ----------------------------------------------------------------- 2/48 PLS-00201: identifier 'SSC_PAGE_MAP.PAGE_ID_NBR' must be declared 0/0 PL/sql: Compilation unit analysis terminated
RETURN INTEGER IS TABLE_DOES_NOT_EXIST exception; PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST,-942); -- ORA-00942 BEGIN INSERT INTO B2BOWNER.SSC_Page_Map VALUES( p_page_id,p_page_type,p_page_dcpn); RETURN 0; EXCEPTION WHEN TABLE_DOES_NOT_EXIST THEN RETURN -1; WHEN DUP_VAL_ON_INDEX THEN RETURN -2; WHEN INVALID_NUMBER THEN RETURN -3; WHEN OTHERS THEN RETURN -4; END; SHOW ERRORS PROCEDURE F_SSC_Page_Map_Insert; GRANT EXECUTE ON F_SSC_Page_Map_Insert TO B2B_USER_DBROLE; RETURN INTEGER
编辑:我更改参数并收到与insert命令相关的新错误
CREATE OR REPLACE FUNCTION F_SSC_Page_Map_Insert( p_page_id IN INTEGER,p_page_type IN VARCHAR2,p_page_dcpn IN VARCHAR2) RETURN INTEGER IS TABLE_DOES_NOT_EXIST exception; PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST,-942); -- ORA-00942 BEGIN INSERT INTO B2BOWNER.SSC_Page_Map VALUES( p_page_id,p_page_dcpn);
Errors for FUNCTION F_SSC_PAGE_MAP_INSERT LINE/COL ERROR -------- ----------------------------------------------------------------- 17/18 PL/sql: ORA-00942: table or view does not exist 16/5 PL/sql: sql Statement ignored
编辑:我执行了以下命令来检查我是否可以访问
DECLARE count_this INTEGER; BEGIN select count(*) into count_this from all_tables where owner = 'B2BOWNER' and table_name = 'SSC_PAGE_MAP'; DBMS_OUTPUT.PUT_LINE(count_this); END;
我收到的输出是
1 PL/sql procedure successfully completed.
我可以访问表.
编辑:
所以我终于通过使用PL / sql的架构在表中进行了插入,并且工作正常.看来我根本没有权力来创建功能,但这是一个假设.
编辑:
实际表DDL语句
v_create := 'CREATE TABLE ' || TABLE_NAME || ' ( PAGE_ID_NBR NUMERIC(10) NOT NULL Check(Page_ID_NBR > 0),PAGE_TYPE VARCHAR2(50) NOT NULL,PAGE_DCPN VARCHAR2(100) NOT NULL,PRIMARY KEY(Page_ID_NBR,Page_Type))'; EXECUTE IMMEDIATE v_create; COMMIT WORK; COMMIT COMMENT 'Create Table';