Error In Executing VPD Policy Function
Hi,
I have 10.2.0.3 DB running on windows. I have created a function to implement
the VPD. Here is code for Function:
Create or Replace FUNCTION vpd_p return varchar2
as
retn varchar2(50) := user;
begin
if upper(user) = 'P10' then
retn := 'DEPTNO = 10' ;
end if;
if upper(user) = 'SCOTT' then
retn := 'DEPTNO = 10' ;
end if;
if user = 'P20' then
retn := 'DEPTNO = 10 or DEPTNO = 20' ;
end if;
return retn;
end;
end;I add a policy as:
Begin
dbms_rls.add_policy
( 'SCOTT' ,
'e' ,
'MY_POLICY',
'SCOTT' ,
'vpd_p' ,
'SELECT'
end;When i am accessing the table on which i applied poliyc i was
getting the following error:
Policy function execution error:
Logon user : P10
Table/View : SCOTT.E
Policy name : MY_POLICY
Policy function: SCOTT.PK_1.VPD_P
ORA-06550: line 1, column 15:
PLS-00306: wrong number or types of arguments in call to 'VPD_P'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
*** 2008-02-13 19:49:48.922
Policy function execution error:
Logon user : P10
Table/View : SCOTT.E
Policy name : MY_POLICY
Policy function: SCOTT.PK_1.VPD_P
ORA-06550: line 1, column 7:
PL/SQL: Statement ignoredWhen i modified my function to below code, it works fine:
Create or Replace FUNCTION vpd_p (abc varchar2 , abcd varchar2)
return varchar2
as
retn varchar2(50) := user;
begin
if upper(user) = 'P10' then
retn := 'DEPTNO = 10' ;
end if;
if upper(user) = 'SCOTT' then
retn := 'DEPTNO = 10' ;
end if;
if user = 'P20' then
retn := 'DEPTNO = 10 or DEPTNO = 20' ;
end if;
return retn;
end;
end;Even if i change the DATATYPE for "abc" or "abcd" variables to NUMBER
it starts giving the same error. So, my query is why we have to pass any
two VARCHAR2 type variables to apply the VPD policy through function,
even when we are not using these variables anywhere. In documentation
also, i can't find any reason for same.
Please suggest any reason for this abnormal behaviour.........
my query is why we have to pass any
two VARCHAR2 type variables to apply the VPD policy through function,
even when we are not using these variables anywhere. In documentation
also, i can't find any reason for same.Look the Usage Notes in the documentation:
* the policy functions which generate dynamic predicates are called by the server. Following is the interface for the function:
FUNCTION policy_function (object_schema IN VARCHAR2, object_name VARCHAR2)
RETURN VARCHAR2
--- object_schema is the schema owning the table of view.
--- object_name is the name of table, view, or synonym to which the policy applies.
Similar Messages
-
Error encountered with VPD Policy in place
Local Platform: Windows XP
SQL DEV Version: 1.0.0.15.57
Host: Solaris Oracle 10.2.0.2.0
The problem I am incurring is related to using a VPD Policy and trying to update data via the table editor. I have included my function, the add policy statements and everything needed to duplicate this on the EMP table.
I am able to update the tables with the VPD policy in place using both SQLPLUS and the pl/sql editor region within SQL Developer..
The only thing that would need changed is before the function is compiled the user that you will be using to login to the database needs to be set within the function.
create or replace function
vpd_test_function
-- Function must have the following parameters
(schema in varchar2, tab in varchar2)
-- Function will return a string that is used as a WHERE clause
return varchar2
as
v_user varchar2(100);
out_string varchar2(4000) default null;
begin
-- get session user
v_user := UPPER(nvl(v('APP_USER'),USER));
-- create where clause when user is authorized to see parts of the table
if (v_user = 'DB_USER') then
out_string := out_string || '(nvl(deptno,0) <>10 and nvl(deptno,0) <>30)';
end if;
return out_string;
end;
begin
DBMS_RLS.add_policy
(object_schema => 'DB_USER',
object_name => 'EMP',
policy_name => 'VPD_TEST_POLICY',
function_schema => 'DB_USER',
policy_function => 'vpd_TEST_FUNCTION',
statement_types => 'SELECT,INSERT,UPDATE,DELETE');
end;
SELECT * FROM USER_POLICIES;
OBJECT_NAME POLICY_GROUP POLICY_NAME PF_OWNER PACKAGE FUNCTION SEL INS UPD DEL IDX CHK_OPTION ENABLE STATIC_POLICY POLICY_TYPE LONG_PREDICATE
EMP SYS_DEFAULT VPD_TEST_POLICY DB_USER VPD_TEST_FUNCTION YES YES YES YES NO NO YES NO DYNAMIC NO
1 rows selected
Change empno 7788 salary from 3000 to 85 results by clicking on a table and editing the value and clicking commit
UPDATE "DB_USER"."EMP" SET SAL = "85" WHERE ROWID = 'AAAXLmAAGAAAAylAAF' AND ORA_ROWSCN = '7788'
One error saving changes to table "DB_USER"."EMP":
Row 3: ORA-00904: "ORA_ROWSCN": invalid identifier
When run as a script or execute statement in SQL Developer (it works):
UPDATE EMP SET SAL = 85 WHERE EMPNO = 7788;
1 rows updated
Change policy by first dropping and then recreating, selecting to only apply the policy to select statements rather than INS,DEL,SEL,UPD:
BEGIN
DBMS_RLS.DROP_POLICY (
object_schema => 'DB_USER',
object_name => 'EMP',
policy_name => 'VPD_TEST_POLICY');
end;
begin
DBMS_RLS.add_policy
(object_schema => 'DB_USER',
object_name => 'EMP',
policy_name => 'VPD_TEST_POLICY',
function_schema => 'DB_USER',
policy_function => 'vpd_TEST_FUNCTION',
statement_types => 'SELECT');
end;
SELECT * FROM USER_POLICIES;
OBJECT_NAME POLICY_GROUP POLICY_NAME PF_OWNER PACKAGE FUNCTION SEL INS UPD DEL IDX CHK_OPTION ENABLE STATIC_POLICY POLICY_TYPE LONG_PREDICATE
EMP SYS_DEFAULT VPD_TEST_POLICY DB_USER VPD_TEST_FUNCTION YES NO NO NO NO NO YES NO DYNAMIC NO
1 rows selected
Change empno 7788 salary from 3000 to 85 results by clicking on a table and editing the value and clicking commit
One error saving changes to table "DB_USER"."EMP":
Row 3: Data updated by another user, cannot update row.
The following popup is displayed as well....
But once again when run as a script or execute statement in SQL Developer (it works):
UPDATE EMP SET SAL = 85 WHERE EMPNO = 7788;
1 rows updated
The last thing I would like to add is that if I drop the policy and I edit the table it works just fine ..
UPDATE "DB_USER"."EMP" SET SAL = "85" WHERE ROWID = 'AAAXLmAAGAAAAylAAF' AND ORA_ROWSCN = '57937995'
Commit Successful
The only twist is that if you notice when I have the VPD policy in place SQL Developer is aying that the ORA_ROWSCN is equal to EMPNO/the primary key and not the try ORA_ROWSCN...
Any ideas, I can file a TAR as well if you would like me to?
Thanks
JustinI first identified the problem setting up VPD for a DB user, I granted them update privileges and I wanted to ensure everything was working and that is how I found it. So yes I logged into the DB as the "other user" and then went to "Other Users" and went to the table that was owned by another schema with a VPD policy when I first encounter the error.
It was when I setup the test case to post here on OTN that I discovered the error ALSO exists if I own the table as well so for me in my test cases it did not matter who the original owner of the table was. The only thing that mattered was whether or not a VPD policy was enabled on a table. -
Problem with VPD policy function
Hi All,
I'm trying to secure database tables with VPD and getting "ORA-28112: failed to execute policy function" error when I query the table.
--My schema is "sales"
grant crete any context to sales;
-- created context using this statement
create OR REPLACE context sales_APP_CTX using PKG_SECURITY ACCESSED GLOBALLY;
-- Package spec
CREATE OR REPLACE PACKAGE PKG_SECURITY is
function vpd_sec_pol_func return varchar2 ;
procedure set_sales_app_context(p_user varchar2,p_security_level varchar2);
end;
-- package body
CREATE OR REPLACE PACKAGE BODY PKG_SECURITY is
function vpd_sec_pol_func return varchar2 is
-- v_user varchar2(100) := UPPER(portal.wwctx_api.get_user);
begin
if user not in ('SALES','ORACLE') then
return ' state in (select state from app_user_states where user_id = sys_context(''SALES_APP_CTX'', ''APP_USER''))';
else
return null;
end if;
end;
procedure set_sales_app_context(p_user varchar2,p_security_level varchar2) is
begin
dbms_session.set_context('SALES_APP_CTX','APP_USER',p_user);
-- dbms_session.set_context('SALES_APP_CTX','SECURITY_LEVEL',p_security_level);
end;
end;
-- Added the policy to the table
begin
dbms_rls.add_policy
( object_schema => 'SALES',
object_name => 'SALES_SUMMARY',
policy_name => 'SALES_SUMMARY_POLICY',
function_schema => 'SALES',
policy_function => 'PKG_SECURITY.VPD_SEC_POL_FUNC',
statement_types => 'SELECT,INSERT,UPDATE,DELETE' ,
update_check => TRUE );
end;
-- I was able to set context using sqlplus by executing the procedure
exec PKG_SECURITY.set_sales_app_context('TEST_USER','R');
What am I doing wrong?
ThanksHi,
ml_huang wrote:
Is it necessary to create 'Context' and 'Procedure' before the function and policy?It is not necessary to create a context.
A context can be very useful for doing row-level security, but it is not required.
Even if you are using SYS_CONTEXT, you can create the function first, if you want to.
Sorry, I don't understand what 'Procedure' you mean.
I have created a function (with no parameters) and a policy and kept getting the Ora-28112 error.Policy functions must accept 2 VARCHAR2 parameters. See the messages above.
Any suggestions for me? Thanks!Start your own thread for your own question.
I think more people will want to read (and therefore respond to) a new message with 0 replies than a 3-month old message with 4 replies. -
Error when execute a planning function on selected line
Hello together,
we are using SAP BusinessObjects Analysis 1.4 SP9 (1.4.9.3241, Office 2013) and SAP BW 7.3 SP 11 (SAPKW73011).
When executing a planning function on an selected line in the crosstab, the following error appears:
The VBA Coding used is from HowTo Execute a Planning Function on Selected Lines in an Analysis for Office Workbook.
The Code worked fine with an older version of SAP BO Analysis and Excel 2007.
Going to debugging:
As you can see in the screenshot, the selected line (Dimension "0PRODUCT") is selected correctly.
The settings for the planning function are the following:
Thank you in advance for any advice.
Best regards
AlexHello together,
we are using SAP BusinessObjects Analysis 1.4 SP9 (1.4.9.3241, Office 2013) and SAP BW 7.3 SP 11 (SAPKW73011).
When executing a planning function on an selected line in the crosstab, the following error appears:
The VBA Coding used is from HowTo Execute a Planning Function on Selected Lines in an Analysis for Office Workbook.
The Code worked fine with an older version of SAP BO Analysis and Excel 2007.
Going to debugging:
As you can see in the screenshot, the selected line (Dimension "0PRODUCT") is selected correctly.
The settings for the planning function are the following:
Thank you in advance for any advice.
Best regards
Alex -
VPD-Policy function, dependent on CURRENT_SQL
Hello ALL,
i must implement VPD into a medium size data warehouse database, the customer is using 10gR2.
There are some detail tables from which it should be allowed for certain users to retrieve aggregated data, but not to retrieve the details itself.
The background is that everybody in the organization should be able to see the aggregated data for the whole organization, but should have access to the details only for the own organizational unit and units below.
The aggregations are made on the fly. A simple example with the Scott.EMP table would look like this:
- SELECT salary FROM emp -- should be blocked
- SELECt Avg(salary) FROM emp -- shold return the average
I told the customer that this is not possible with VPD - unfortunately they found the SYS_CONTEXT('USERENV''CURRENT_SQL') function and are now asking me to create the policy, based on the current SQL statement... :-(
I consider this as being extremely RISKY, to do so i have to parse the SQL statement to ensure that the aggregation function is used for the protected column, that is not in a comment, and so on...
My questions:
1. Is there another way to achieve such a behavior of a policy function?
2. If not, is there more information available about the current SQL than just the statement as a string? (Access to the builtin SQL parser's tree...)
3. Would you agree that making a policy function based on the SQL statement is a risky thing?
4. Has anybody else ever done this before?
Thank you very much in advance for all answers and your help.
Best regards from Houston,TX
Frank/2
Edited by: fjuedes on Mar 18, 2010 3:41 PMfjuedes wrote:
Hello ALL,
i must implement VPD into a medium size data warehouse database, the customer is using 10gR2.
There are some detail tables from which it should be allowed for certain users to retrieve aggregated data, but not to retrieve the details itself.
The background is that everybody in the organization should be able to see the aggregated data for the whole organization, but should have access to the details only for the own organizational unit and units below.
The aggregations are made on the fly. A simple example with the Scott.EMP table would look like this:
- SELECT salary FROM emp -- should be blocked
- SELECt Avg(salary) FROM emp -- shold return the average
I told the customer that this is not possible with VPD - unfortunately they found the SYS_CONTEXT('USERENV''CURRENT_SQL') function and are now asking me to create the policy, based on the current SQL statement... :-(
I consider this as being extremely RISKY, to do so i have to parse the SQL statement to ensure that the aggregation function is used for the protected column, that is not in a comment, and so on...
My questions:
1. Is there another way to achieve such a behavior of a policy function?
2. If not, is there more information available about the current SQL than just the statement as a string? (Access to the builtin SQL parser's tree...)
3. Would you agree that making a policy function based on the SQL statement is a risky thing?
4. Has anybody else ever done this before?
Thank you very much in advance for all answers and your help.
Best regards from Houston,TX
Frank/2
Edited by: fjuedes on Mar 18, 2010 3:41 PMThis sounds very much like something a colleague of mine did at a sister organization. I don't have the details (I've asked him to send me the specs as I would like to implement the same thing) but it did involve creating and populating some additional tables to define who had access to which departments, and use info from that table to help build the VPD functions. Another key, though, is that he/we do NOT have the requirement to let people see enterprise-wide aggregation. If user Dilbert is defined as having access only to members of departments 10, 15, and 20, then any aggregates he runs will only include those departments. -
Error while executing User defined function
I am getting the follower error when i try to exceute the following function.
[Error] Script lines: 0-0 --------------------------ExecuteCallableQuery: Execute: ORA-06550: line 2, column 8:
PLS-00201: identifier 'DWADTEST.CHECKABI' must be declared
ORA-06550: line 2, column 2:
PL/SQL: Statement ignored
CREATE OR REPLACE FUNCTION "DWADTEST"."CheckABI" ( columnname IN VARCHAR2, columnvalue IN VARCHAR2, ABINumber IN VARCHAR2)
RETURN VARCHAR2
IS
return_value VARCHAR2 (25) := NULL;
tablevalue VARCHAR2 (25) := NULL;
BEGIN
SELECT columnname INTO tablevalue FROM D_BUSI_DEMOG WHERE ABINUM = ABINumber;
IF
columnvalue = NULL
THEN
return_value := tablevalue;
ELSE
return_value := columnvalue;
END IF;
RETURN return_value;
END;
Can anybody help me?I removed all inside code and try to run it. But still it is giving same error message.
[Error] Script lines: 0-0 --------------------------ExecuteCallableQuery: Execute: ORA-06550: line 2, column 8:
PLS-00201: identifier 'DWADTEST.CHECKABI' must be declared
ORA-06550: line 2, column 2:
PL/SQL: Statement ignored
CREATE OR REPLACE FUNCTION "DWADTEST"."CheckABI" ( columnname IN VARCHAR2) RETURN VARCHAR2
IS
BEGIN
RETURN 'return_value';
END; -
Error in executing remote enabled function module
Hi All,
I have created a remote enabled function module.
The function module works fine without entering the RFC dest sys.
When i enter the RFC dest sys and execute it, i get the error
Exception SYSTEM_FAILURE
Message ID 00
Message number 341
Message Runtime error CALL_FUNCTION_NOT_FOUND has occured
The RFC connection actually works fine to connect to the system when i test it from SM59.
But what could be the reason for the above error?
Actual intent is that I want to execute FM created in sys1 to be executed on sys2 from sys1 itself.
Regards,
RahulHi,
I guess there is no other way. For an RFC enabled function module it should exist in SYS2 .Then only you will be able to call from SYS1.
Your RFC connection will work fine if you provide all the technical parameters correctly.A RFC function module has nothing to do with this connection
Regards,
Lakshman.
Edited by: Lakshman N on May 14, 2010 11:25 AM -
ORA-28112: failed to execute policy function - Error in Application Builder
Hey all,
I've added a policy function to one of my tables and now I'm getting this error when I try to update a report region that references that table.
"Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-28112: failed to execute policy function"
If I remove the policy then everything works fine. My application also runs fine with the policy in place. I just get these errors in the application builder when updating a report or an LOV that references the secure table.
The parsing schema is APPL_USER.
Here is the policy function:
FUNCTION DOCUMENT_TABLE_POLICY (object_schema IN VARCHAR2 DEFAULT NULL
,object_name IN VARCHAR2 DEFAULT NULL)
RETURN VARCHAR2 IS
v_nt_seq NUMBER;
BEGIN
IF user = 'APPL_USER' OR INSTR(user, 'ITFC_') = 1 THEN
RETURN NULL;
END IF;
IF V('APP_USER') IS NOT NULL THEN
IF V('F_NT_SEQ') IS NOT NULL THEN
v_nt_seq := V('F_NT_SEQ');
ELSE
SELECT NT_SEQ
INTO v_nt_seq
FROM APPL_USERS
WHERE UPPER(NT_ID) = UPPER(V('APP_USER'));
END IF;
RETURN '(DOCUMENT_TYPE, MANAGED_BY_ELEMENT, PROGRAM_CODE, CONTRACT_NUMBER) IN (SELECT DISTINCT R.DOCUMENT_TYPE, USL.ELEMENT, USL.PROGRAM_CODE, USL.CONTRACT_NUMBER FROM IPRACA_USERS_SECURITY_LINK USL, IPRACA_SECURITY_ROLES R WHERE R.SECURITY_ROLE_SEQ = USL.SECURITY_ROLE_SEQ AND USL.NT_SEQ = ' || TO_CHAR(v_nt_seq) || ')';
END IF;
--UNAUTHORIZED USERS CAN SEE NO DATA
RETURN '1=0';
END;
This is how I setup the policy:
BEGIN
DBMS_RLS.ADD_POLICY(
object_schema => 'APPL_USER'
,object_name => 'APPL_DOCUMENT'
,policy_name => 'APPL_DOCUMENT_POLICY'
,function_schema => 'APPL_USER'
,policy_function=> 'APPL_SECURITY.DOCUMENT_TABLE_POLICY'
END;
Any help would be greatly appreciated!
Thanks,
Jonathan Hart
APEX 3.1.1Thanks.
After looking at it again, I think that may be the problem, too. I guess the APP_USER is set when in the application builder and the Builder is running the report query as it is being parsed which is causing the error. I added a Begin - Exception block around that query and everything seems to work now.
Thanks again! -
Trying to implement a VPD policy but got the following error ORA-20001
hey good day,
I'm trying to implement a VPD policy to my application. After I have performed the below task (Label 1) in oracle 10g database. When I'm about to access my application page in ApEx 3.2.1 I got the following error
ORA-20001: get_dbms_sql_cursor error ORA-28110: policy function or package CHARLES.VPD_PREDICATE has error
any form of assistance will be greatly appreciated.
thanks in advance
Label 1
USER is "VPD_ADMIN"
SQL> create or replace context empnum_ctx using set_empnum_ctx_pkg;
Context created.
SQL> CREATE OR REPLACE PACKAGE set_empnum_ctx_pkg IS
2 PROCEDURE set_empnum;
3 END;
4 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY set_empnum_ctx_pkg IS
2 PROCEDURE set_empnum IS
3 emp_id NUMBER;
4 BEGIN
5 SELECT EMPNUM INTO emp_id FROM CHARLES.INSTRUCTOR
6 WHERE upper(username) = nvl(v('APP_USER'), USER);
7 DBMS_SESSION.SET_CONTEXT('empnum_ctx', 'empnum', emp_id);
8
9 EXCEPTION
10 WHEN NO_DATA_FOUND THEN NULL;
11 END;
12 END;
13 /
Package body created.
SQL> create or replace package vpd_policy as
2 function vpd_predicate(object_schema in varchar2 default null, object_name in varchar2 default null)
3 return varchar2;
4 end;
5 /
Package created.
SQL> create or replace package body vpd_policy as function vpd_predicate(
2 object_schema in varchar2 default null, object_name in varchar2 default null)
3 return varchar2 as
4
5 BEGIN
6 if (USER = 'ADMIN') and (v('APP_USER') is null) or
7 (USER = 'MICHAEL.GRAY') and (v('APP_USER') is NULL) then
8 return '';
9 else
10 return '(
11 exists (
12 select "INSTRUCTOR"."EMPNUM" as "EMPNUM",
13 "INSTRUCTOR"."FIRSTNAME" as "FIRSTNAME",
14 "INSTRUCTOR"."LASTNAME" as "LASTNAME",
15 "LOAD"."COURSEID" as "COURSEID",
16 "COURSE"."CREDIT" as "CREDIT",
17 "COURSE"."HPW" as "HPW",
18 "LOAD"."CAMPID" as "CAMPID",
19 "LOAD"."YR" as "YR",
20 "INSTRUCTOR"."POS" as "POS",
21 "INSTRUCTOR"."USERNAME" as "USERNAME",
22 "INSTRUCTOR"."DEPARTMENT_NAME" as "DEPARTMENT_NAME",
23 "LOAD"."SEMESTER" as "SEMESTER"
24 from "COURSE" "COURSE",
25 "INSTRUCTOR" "INSTRUCTOR",
26 "LOAD" "LOAD"
27 where "INSTRUCTOR"."EMPNUM"="LOAD"."EMPNUM"
28 and "LOAD"."COURSEID"="COURSE"."COURSEID"
29 and department_name = (
30 select department_name from departments
31 where upper (assigned_to) = nvl(v(''APP_USER''),USER) )
32 )
33
34 or upper(username) = nvl(v(''APP_USER''), USER)
35 ) ';
36
37 END IF;
38 END vpd_predicate;
39 END vpd_policy;
40 /
Package body created.
SQL> begin
2 dbms_rls.add_policy(
3 object_schema => 'charles',
4 object_name => 'load',
5 policy_name => 'Loading Policy',
6 function_schema => 'charles',
7 policy_function => 'vpd_predicate',
8 statement_types => 'select, update, insert, delete');
9 end;
10 /
PL/SQL procedure successfully completed.ORA-20001 isn't an Oracle error message it was coded into your application by a developer: Look it up.
Consider too the following:
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;so if the employee identifier is not found ... is this really what you want? If an employee isn't valid shouldn't you know it? -
Error while executing the function
hi,
I have a table with the following data.
T_1 T_2 T_3 T_4
a.1 1 aa ff
a.1 2 ab ff
a.2 1 ba ff
a.2 2 bb ff
a.2 3 bc ff
a.2 4 bd ff
a.3 1 ca ff
a.3 3 cc ff
a.4 2 db ffi want the data in the following way.
col_1 col_2 col3
a.1 1,2 aa ,ab
a.2 1,2 ,3,4 ba,bb,bc,bd
a.3 1,3 ca,cc
a.4 2 db For this , i have written a package as shown below.
create or replace package t_emp_pkg as
type typ_emp is record
tv_t_1 t_Emp.t_1%type,
tv_t_2 varchar2(20),
tv_t_3 varchar2(20));
type typ_emp_tab is table of typ_emp;
function t_emp_func(pv_value in varchar2) return typ_emp_tab;
end t_emp_pkg;
create or replace package body t_emp_pkg as
function t_emp_func(pv_value in varchar2) return typ_emp_Tab is
cursor c1(v_value varchar2) is
select distinct t_1 from t_emp where t_4 = v_value ;
cursor c2(pv_t_1 varchar2) is
select t_2,t_3 from t_emp
where t_1 = pv_t_1;
typ_emp_table typ_emp_tab := typ_emp_tab();
t_count number := 0;
c1_cur_rec c1%rowtype;
c2_cur_rec c2%rowtype;
v_temp_value1 varchar2(30);
v_temp_value2 varchar2(30);
begin
open c1(pv_value);
loop
fetch c1 into c1_cur_rec;
exit when c1%notfound;
v_temp_value1 := null;
v_temp_value2 := null;
open c2(c1_cur_rec.t_1);
loop
fetch c2 into c2_cur_rec;
exit when c2%notfound;
v_temp_value1 := v_temp_value1||','||c2_cur_rec.t_2;
v_temp_value2 := v_temp_value2||','||c2_cur_rec.t_3;
end loop;
--close c2;
t_count := t_count+1;
typ_emp_table(t_count).tv_t_1 := c1_cur_rec.t_1;
typ_emp_table(t_count).tv_t_2 := v_temp_value1;
typ_emp_table(t_count).tv_t_3 := v_temp_value2;
--dbms_output.put_line(typ_emp_table(t_count).tv_t_1);
--dbms_output.put_line(typ_emp_table(t_count).tv_t_2);
--dbms_output.put_line(typ_emp_table(t_count).tv_t_3);
end loop;
close c1;
return typ_emp_table;
end;
end;
When i executed the function , i got the following error.
SQL> declare
2 v t_emp_pkg.typ_emp_tab := t_emp_pkg.typ_emp_tab();
3 begin
4 v := t_emp_pkg.t_emp_func('ff');
5 for i in v.first..v.last loop
6 dbms_output.put_line(v(i).tv_t_1 ||', '||v(i).tv_t_2||', '||v(i).tv_t_3);
7 end loop;
8 end;
9 /
declare
ERROR at line 1:
ORA-06533: Subscript beyond count
ORA-06512: at "SCOTT.T_EMP_PKG", line 30
ORA-06512: at line 4
but when i am running this queries in anonymous block (i.e) using declare,begin,end , i am getting the data correctly.
1 declare
2 pv_value varchar2(5) := 'ff';
3 cursor c1(v_value varchar2) is
4 select distinct t_1 from t_emp where t_4 = v_value ;
5 cursor c2(pv_t_1 varchar2) is
6 select t_2,t_3 from t_emp
7 where t_1 = pv_t_1;
8 --typ_emp_table typ_emp_tab := typ_emp_tab();
9 t_count number := 0;
10 c1_cur_rec c1%rowtype;
11 c2_cur_rec c2%rowtype;
12 v_temp_value1 varchar2(300);
13 v_temp_value2 varchar2(300);
14 begin
15 open c1(pv_value);
16 loop
17 fetch c1 into c1_cur_rec;
18 exit when c1%notfound;
19 v_temp_value1 := null;
20 v_temp_value2 := null;
21 open c2(c1_cur_rec.t_1);
22 loop
23 fetch c2 into c2_cur_rec;
24 exit when c2%notfound;
25 v_temp_value1 := v_temp_value1||','||c2_cur_rec.t_2;
26 v_temp_value2 := v_temp_value2||','||c2_cur_rec.t_3;
27 end loop;
28 close c2;
29 t_count := t_count+1;
30 --typ_emp_table(t_count).tv_t_1 := c1_cur_rec.t_1;
31 --typ_emp_table(t_count).tv_t_2 := v_temp_value1;
32 --typ_emp_table(t_count).tv_t_3 := v_temp_value2;
33 dbms_output.put_line(c1_cur_rec.t_1);
34 dbms_output.put_line(v_temp_value1);
35 dbms_output.put_line(v_temp_value2);
36 end loop;
37 close c1;
38* end;
39 /
a.2
,1,2,3,4
,ba,bb,bc,bd
a.3
,1,3
,ca,cc
a.4
,2
,db
a.1
,1,2
,aa,ab
PL/SQL procedure successfully completed.So can anybody tell me why it is not executing correctly when executing as a function.
Thanks in advance.hi devmiral,
I am not sure exactly where i am making the mistake. I have modified the package but still i am getting the error.
create or replace package body t_emp_pkg as
function t_emp_func(pv_value in varchar2) return typ_emp_Tab is
cursor c1(v_value varchar2) is
select distinct t_1 from t_emp where t_4 = v_value ;
cursor c2(pv_t_1 varchar2) is
select t_2,t_3 from t_emp
where t_1 = pv_t_1;
typ_emp_table typ_emp_tab ;
--:= typ_emp_tab();
t_count number := 0;
c1_cur_rec c1%rowtype;
c2_cur_rec c2%rowtype;
v_temp_value1 varchar2(30);
v_temp_value2 varchar2(30);
begin
open c1(pv_value);
loop
fetch c1 into c1_cur_rec;
exit when c1%notfound;
v_temp_value1 := null;
v_temp_value2 := null;
open c2(c1_cur_rec.t_1);
loop
fetch c2 into c2_cur_rec;
exit when c2%notfound;
v_temp_value1 := v_temp_value1||','||c2_cur_rec.t_2;
v_temp_value2 := v_temp_value2||','||c2_cur_rec.t_3;
end loop;
--close c2;
t_count := t_count+1;
typ_emp_table(t_count).tv_t_1 := c1_cur_rec.t_1;
typ_emp_table(t_count).tv_t_2 := v_temp_value1;
typ_emp_table(t_count).tv_t_3 := v_temp_value2;
typ_emp_table := typ_emp_tab(c1_cur_rec.t_1,v_temp_value1,v_temp_value2);
typ_emp_table.extend;
end loop;
close c1;
return typ_emp_table;
end;
end;
SQL> @t_emp_pkg_body.sql
Warning: Package Body created with compilation errors.
SQL> sho err
Errors for PACKAGE BODY T_EMP_PKG:
LINE/COL ERROR
36/1 PL/SQL: Statement ignored
36/18 PLS-00306: wrong number or types of arguments in call to
'TYP_EMP_TAB'
36/18 PLS-00306: wrong number or types of arguments in call to
'TYP_EMP_TAB'
36/18 PLS-00306: wrong number or types of arguments in call to
'TYP_EMP_TAB'Thanks in advance. -
Error while executing planning Function
Hi All,
I'm getting some error while executing planning function. Below are errors. Please check and provide solution.
Errors occurred when executing planning function RTFMPF01/RTFMPG01
Value 08 of chara Region does not correspond to the attrib.val MI of chara Store
Value 10 of chara Region does not correspond to the attrib.val RM of chara Store
Value 11 of chara Region does not correspond to the attrib.val NA of chara Store
Thanks,
VamsiHi,
Value 08 of chara Region does not correspond to the attrib.val MI of chara Store
Looks like there is a characteristics relationship which derives the attribute store from Region.
Check the master data for Region for attribute Store and the corresponding values.
The values that are maintained in the master data will only be allowed to enter in the cube.
Thanks
pratyush -
Error while executing function
hiii all,
hope doing welll
iam getting error while executing the function and error is
ORA-00932: inconsistent datatypes: expected NUMBER got AMPLEX_GRAND1.SYS_PLSQL_75185_9_1hii sir this is my function
create or replace
FUNCTION FnFetchEmployeesforjobsheet
v_user_id IN NUMBER
RETURN FnFetchEmployeesforjobshee_pkg.tt_v_employees_type PIPELINED
AS
--declare @manager as int
v_empid VARCHAR2(20);
v_compid VARCHAR2(20);
v_temp NUMBER(1, 0) := 0;
v_temp_1 SYS_REFCURSOR;
v_temp_2 TT_V_EMPLOYEES%ROWTYPE;
BEGIN
BEGIN
SELECT 1 INTO v_temp
FROM DUAL
WHERE EXISTS ( SELECT 1
FROM user_list
WHERE Access_level = 0
AND USER_ID = v_user_id );
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
IF v_temp = 1 THEN
BEGIN
SELECT Emp_ID
INTO v_empid
FROM User_List
WHERE USER_ID = v_user_id;
SELECT Comp_ID
INTO v_compid
FROM Employee
WHERE Emp_ID = v_empid;
INSERT INTO tt_v_employees
( SELECT DISTINCT Emp_id ,
v_user_id
FROM employee
WHERE Comp_ID = v_compid );
END;
END IF;
BEGIN
SELECT 1 INTO v_temp
FROM DUAL
WHERE EXISTS ( SELECT 1
FROM user_list
WHERE Access_level = 2
AND USER_ID = v_user_id );
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
IF v_temp = 1 THEN
BEGIN
INSERT INTO tt_v_employees
( SELECT e.Emp_ID ,
v_user_id
FROM employee e
JOIN user_list ul
ON ul.Emp_ID = e.Emp_ID
WHERE USER_ID = v_user_id );
END;
END IF;
BEGIN
SELECT 1 INTO v_temp
FROM DUAL
WHERE EXISTS ( SELECT 1
FROM user_list
WHERE Access_level = 1
AND USER_ID = v_user_id );
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
IF v_temp = 1 THEN
DECLARE
v_Emp_id VARCHAR2(50);
BEGIN
SELECT e.Emp_id
INTO v_Emp_id
FROM employee e
JOIN user_list ul
ON ul.Emp_ID = e.Emp_ID
WHERE USER_ID = v_user_id;
--insert @employees select e.Emp_id,User_ID from employee e inner join user_list ul on ul.Emp_ID = e.Emp_ID
--where User_ID = @user_id
--insert @employees select Emp_ID from User_List where User_Id=@user_id
INSERT INTO tt_v_employees
( Emp_ID )
VALUES ( v_Emp_id );
INSERT INTO tt_v_employees
--select Emp_ID,@user_id from employee where Emp_ID = @Emp_id
--union
SELECT Emp_ID ,
v_user_id
FROM employee
WHERE Managerid = v_Emp_id
AND STATUS = 1 );
END;
END IF;
OPEN v_temp_1 FOR
SELECT *
FROM tt_v_employees;
LOOP
FETCH v_temp_1 INTO v_temp_2;
EXIT WHEN v_temp_1%NOTFOUND;
PIPE ROW ( v_temp_2 );
END LOOP;
END;
and my table is
CREATE GLOBAL TEMPORARY TABLE tt_v_employees
Emp_ID VARCHAR2(8) ,
USER_ID NUMBER(10,0)
and i am executing this function ,like this
select FnFetchEmployeesforjobshee_pkg.FnFetchEmployeesforjobsheet('1') from dual; and getting this error
SQL Error: ORA-00904: "FNFETCHEMPLOYEESFORJOBSHEE_PKG"."FNFETCHEMPLOYEESFORJOBSHEET": invalid identifier
00904. 00000 - "%s: invalid identifier" -
An error occurred when executing a REMOTE FUNCTION CALL.
Dear all,
We have two syetms called DXD and GRD , we have a remote enabled function module in the DXD system , when i am trying to call this Function module from
GRD system it is going for the short dump, and giving the follwing error,
<b>Error analysis
An error occurred when executing a REMOTE FUNCTION CALL.
It was logged under the name "RFC_NO_AUTHORITY"
on the called page.</b>
But i do have the access for the DXD system also, i am really struggling to solve this problem, if any lights are there to help me , i will be thank full for then,
some body suggested for me that we need to maintain the Trusted system tables in the target system.
Thanks & regards
Satya.first u( user id ) have to get the Authorizations to use RFC ?
object will be like S_RFC or some thing like this.
when u get this kind of error just call /NSU53 then u will come to know which Authorization Object is missing from ur User Profile.
Regards
Prabhu -
Error when executing function in MSS launchpad report ???
In MSS lanchpad report, we have the following problem:
Error in Manager Sef-Service
When calling the report, the following error occurred:
System: HRP
Error when executing function
Basically in MSS report, I select employees in the first iView which calls another ABAP query in back-end to display back-end t-code inside iView of portal through ITS service. What could be the reason for it? please advice.
Thanks,
AnthonyPlease try converting the standadrd-delivered scenario RPT0, then check
out the things.
Also problem may be that your function code names contain
the character '&'. This causes a problem when the selected function
code is passed to the ITS-WebGUI as a URL parameter. Please use only
standard characters (A..Z and _) when you define a function code.
Then it should work.
Please go through the following link also
http://help.sap.com/saphelp_erp2005vp/helpdata/en/3a/
3198408d953154e10000000a1550b0/frameset.htm
Please test in backend using Se38 > PWPC_RPT_START_REPORT_TEST
The Reporting Iview in the portal has the Report category type, by
the report category type is set to "RPT0". Therefore, when the
application is launched, the reporting category type is also sent as URL
parameter to the backend system. As of ECC 6.0 only the reporting
category type "RPT0" is supported. ensure this is set for your custom reports if you are using own scenarion
then set in the Iview property of reports as well
ie example
1)Change the Iview property "Scenario" of the Reporting iview from
"RPT0" to your own "ZRPT", than this set of reports will work. however,
the standard reports will not work.
pwpc_convert_mdt_to_lpa >>
The following list of reports have been converted. -
Error while executing C MEX S-function 'sysgen', (mdlTerminate)
Hi
We are trying to use System generator with Vivado 2014.4. We are encountering the above problem, which is causing a segmentation violation and MATLAB crach, when a simulation in sysgen is finishing up.
It seems like that there has been an equivalent problem before, in an older version of System Generator, which has been answered in AR#31095. Search results say that this AR was:
Why do I receive "Error while executing C MEX S-function 'sysgen', (mdlTerminate). Unexpected unknown exception from MEX file" when I simulate my System Generator model? How do I set up my system environment properly? See (Xilinx Answer 31095).
Unfortunately, the AR is missing in the xilinx site. What did this answer record say? Might be applicable to our case?
That is because the bpel file contains the absolute path to the xsl file instead of the relative path.
ora:doXSLTransformForDoc('file:/C:/JDeveloper/mywork/xsl/tranform_02.xsl' .....
should be
ora:doXSLTransformForDoc('xsl/tranform_02.xsl' .....
As far as I know, this is a bug in JDeveloper for putting this information here. I've removed it using the source view only to find it there again.
Maybe you are looking for
-
Unable to see the attachment in the responses after downloading it on to excel.
I am still a free user, as I am testing the FormCentral to see it suites our requirements. I have a question. I created a test form and distributed it among my colleagues. I also requested them to submit an attachment with their response. I am able t
-
I will thank a lot the person who can solve my problem pleas thakns!!
-
Move from iPhoto '11 to Lightroom using PS Elements to keep Events and Albums
I am trying to move from iPhoto '11 to Lightroom by using PS Elements as a go-between to keep events and album but it doesn't appear that the option to keep events and albums is possible using iPhoto '11. However, the instructions for coming from iP
-
Missing the Personalizations while uploading from 11i to R12
Hi, I am working on the Upgrade project . We are upgrading the Oracle applications from 11.5.10.2 to 12.1.2 . So i am uploading the all personalizations from 11i to R12. I created the ldt file from 11i and and tried to upload in R12. But some of the
-
Cannot create additional Radio Button items
Hi. I am new to Appleworks database, so this my be a stupid question. When I try to add a field and define it as a radio button group, then try to customize the buttons via Options, it normally only shows 2 buttons "Item 1" and "Item 2". I can modify