Error in creating a procedure
Hi all,when i am trying to create the below procedure i am getting error.Can someone suggest where am i doing wrong
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE XXC_MTL_TRANSACTIONS(file_number IN VARCHAR2) IS
2 --process_flag VARCHAR2(2);
3 m1 VARCHAR2(100);
4 --selected_flag VARCHAR2(2);
5 BEGIN
6 IF '&SELECTED_FLAG' = 'Y'
7 THEN
8 INSERT INTO mtl_transactions_interface
9 ( inventory_item_id, -- optional column
10 source_code,
11 source_line_id,
12 source_header_id,
13 process_flag,
14 transaction_mode,
15 last_update_date,
16 last_updated_by,
17 creation_date,
18 created_by,
19 organization_id,
20 transaction_quantity,
21 transaction_uom,
22 transaction_date,
23 transaction_type_id,
24 transaction_cost,
25 subinventory_code,
26 transfer_organization,
27 transfer_subinventory,
28 shipment_number
29 )
30 SELECT
31 lc.inventory_item_id,
32 'DATA COLLECTION', --source code
33 regal.regal_inv_landed_cost_seq.nextval, --source line id
34 regal.regal_inv_landed_cost_seq.nextval, --source header id
35 1, --process flag
36 3, --transaction mode
37 lc.last_update_date, --last update date
38 lc.last_updated_by, --last updated by
39 sysdate, --creation date
40 lc.created_by, --created by
41 lc.organization_id, --organization_id
42 lc.quantity_received , --transaction Quantity
43 msi.primary_uom_code , --transaction UOM
44 sysdate, --transaction date
45 3, --transaction type ID(3 for Direct Org Transfer)
46 lc.landed_cost, --transaction cost
47 'Vessel', -- SUBINVENTORY_CODE
48 82, -- TRANSFER ORGANIZATION
49 'Brooklyn', -- transfer subinventory
50 lc.file_number --shipment number
51 FROM
52 regal.regal_inv_landed_cost_tab lc,
53 mtl_system_items msi
54 WHERE
55 lc.file_number = 'NOV612'
56 AND lc.organization_id = msi.organization_id
57 AND lc.inventory_item_id = msi.inventory_item_id
58 AND process_flag IS NOT NULL;
59 COMMIT;
60 m1:=SQL%ROWCOUNT;
61 dbms_output.put_line(m1 || 'Records inserted'); --testing
62 END IF;
63 UPDATE regal.regal_inv_landed_cost_tab
64 SET process_flag ='Y'
65 WHERE '&SELECTED_FLAG' = 'Y'
66 AND process_flag IS NULL
67* END;
SQL> /
Enter value for selected_flag: Y
old 6: IF '&SELECTED_FLAG' = 'Y'
new 6: IF 'Y' = 'Y'
Enter value for selected_flag: Y
old 65: WHERE '&SELECTED_FLAG' = 'Y'
new 65: WHERE 'Y' = 'Y'
Warning: Procedure created with compilation errors.
SQL> sho error
Errors for PROCEDURE XXC_MTL_TRANSACTIONS:
LINE/COL ERROR
63/3 PL/SQL: SQL Statement ignored
67/5 PL/SQL: ORA-00933: SQL command not properly ended
68/0 PLS-00103: Encountered the symbol "end-of-file" when expecting
one of the following:
( begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-identifier>
<a bind variable> << continue close current delete fetch lock
insert open rollback savepoint set sql execute commit forall
merge pipe purgeThanks in advance!!
Update is missing semi-colon:
63 UPDATE regal.regal_inv_landed_cost_tab
64 SET process_flag ='Y'
65 WHERE '&SELECTED_FLAG' = 'Y'
66 AND process_flag IS NULL<font size=4 color=red>;</font>SY.
Similar Messages
-
Error While Creating PAS Procedure
Dear Friends
I am getting following error while creating PAS procedure. I login using Admin
Access to Database Admin.EWK Denied by the Operating System
What might be the reason for this error?
Rgds
SriGHi SriG,
When you try to open a PAS procedure, it creates a temporary editor work file on the client system. This file is created in the directory referenced by the DBHOME variable in the client-side lsserver.ini file. If the user doesn't have permission to write to this directory then the application will be
unable to open any database sets. So make sure your O.S. user has full access to DBHOME.
Regards,
Isabel -
Error while creating a procedure (PLS-00103)
Hi Am create the follwing Procedure:-
create or replace PROCEDURE XL_SP_ROGUEUSERS (
csrresultset_inout IN OUT sys_refcursor,
intuserkey_in IN NUMBER,
strsortcolumn_in IN VARCHAR2,
strsortorder_in IN VARCHAR2,
intstartrow_in IN NUMBER,
intpagesize_in IN NUMBER,
intdocount_in IN NUMBER,
inttotalrows_out OUT NUMBER,
strfiltercolumnlist_in IN VARCHAR2,
strfiltercolumnvaluelist_in IN VARCHAR2,
strudfcolumnlist_in IN VARCHAR2,
strudfcolumnvaluelist_in IN VARCHAR2,
struserlogin_in IN VARCHAR2,
strfirstname_in IN VARCHAR2,
strlastname_in IN VARCHAR2,
strdate_in IN VARCHAR2
AS
BEGIN
DECLARE
whereclause VARCHAR2(8000);
select_stmt VARCHAR2(8000);
strColumnList VARCHAR2(4000);
strDateFormat VARCHAR2 (80);
strFromClause VARCHAR2(4000);
strWhereClause VARCHAR2(4000);
strOrderByClause VARCHAR2(2000);
intSortDirection_in PLS_INTEGER;
entsum varchar2(20) := 'Entitlements Summary';
str_row EXCEPTION;
do_cnt EXCEPTION;
no_logged_in_user EXCEPTION;
property_not_found EXCEPTION;
pragma exception_init(Str_row,-20001);
pragma exception_init(Do_cnt,-20002);
pragma exception_init(no_logged_in_user,-20003);
BEGIN
-- Throw exception if the start row or page size is either NULL or have
-- values less than or equal to zero
IF (intstartrow_in <= 0 OR intpagesize_in <= 0 OR intstartrow_in IS NULL OR intpagesize_in IS NULL)
THEN
RAISE str_row;
END IF;
-- Throw exception if the intdocount_in parameter is NULL or has a value
-- other than 0 and 1
IF intdocount_in NOT IN (0, 1, 2) OR intdocount_in IS NULL
THEN
RAISE do_cnt;
END IF;
-- Throw exception if the intuserkey_in (logged in user) parameter is NULL
IF intuserkey_in IS NULL or intuserkey_in <= 0
THEN
RAISE no_logged_in_user;
END IF;
-- Now, we start accumulating the whereclause based on the input
-- parameters, performing error checking along the way.
--Organization Permissioning.
/* whereclause := ' and usr.act_key IN (SELECT DISTINCT act2.act_key FROM '||
' act act2, aad, usg, ugp, usr usr5 '||
' WHERE act2.act_key = aad.act_key '||
' and aad.ugp_key = usg.ugp_key '||
' and ugp.ugp_key = usg.ugp_key'||
' and usg.usr_key = usr5.usr_key'||
' and usr5.usr_key = '||intuserkey_in||')'; */
IF strfiltercolumnlist_in IS NOT NULL AND
strfiltercolumnvaluelist_in IS NOT NULL THEN
whereclause := whereclause
|| xl_sfg_parseparams(strfiltercolumnlist_in,
strfiltercolumnvaluelist_in);
END IF;
IF struserlogin_in IS NOT NULL THEN
whereclause := whereclause
|| ' AND UPPER(usr.usr_login) LIKE '
|| UPPER (''''||struserlogin_in||'''')
|| ' ';
END IF;
IF strudfcolumnlist_in IS NOT NULL AND
strudfcolumnvaluelist_in IS NOT NULL THEN
whereclause := whereclause
|| xl_sfg_parseparams(strudfcolumnlist_in,
strudfcolumnvaluelist_in);
END IF;
-- Perform the count query and store the result in inttotalrows_out
inttotalrows_out := 0;
IF intdocount_in IN (1,2) THEN
EXECUTE IMMEDIATE ' select count(*) from((SELECT upper(rcd.RCD_VALUE) as "User ID" '|| ' FROM rce, obj, rcd, orf '||
' WHERE '||
' RCE_STATUS like 'No Match Found' '||
' AND ((orf.ORF_FIELDNAME like 'User ID') or (orf.ORF_FIELDNAME like 'User%Login')) '||
' AND rce.OBJ_KEY = obj.OBJ_KEY '||
' AND rce.RCE_KEY = rcd.RCE_KEY '||
' AND rcd.ORF_KEY = orf.ORF_KEY '||
' ) '||
' MINUS '||
' (SELECT usr.USR_LOGIN FROM usr '||
' WHERE '||
' usr.USR_STATUS like 'Active')) '||
whereclause INTO inttotalrows_out;
-- UI needs the SP to return result set always. The following is returned
-- when the indocount is 2 which does not return any result set but count
IF intdocount_in = 2 THEN
select_stmt := 'SELECT ''dummy'' FROM dual';
OPEN csrresultset_inout FOR select_stmt;
END IF;
END IF;
-- If intdocount_in is 2, UI just wants to get the totalrows to give
-- the warning to users if the result set exceeds the limit set by
-- UI. When ntdocount_in is 2, the following block won't be executed.
IF intdocount_in IN (0,1) THEN
-- Construct the select query by calling XL_SPG_GetPagingSql.
-- This is the main query for this stored procedure
strOrderByClause := ' usr.usr_login';
--strOrderByClause := ' req.req_key';
IF strsortorder_in = 'DESC' THEN
intSortDirection_in := 0;
ELSE
intSortDirection_in := 1;
END IF;
XL_SPG_GetPagingSql(strColumnList,
strFromClause,
whereclause,
strOrderByClause,
intSortDirection_in,
intStartRow_in,
intPageSize_in,
select_stmt
OPEN csrresultset_inout FOR select_stmt;
END IF;
-- Exception Handling
EXCEPTION
WHEN Str_row THEN
RAISE_APPLICATION_ERROR(sqlcode,
'Start Row/Page Size cannot be NULL OR less than or equal to zero ');
WHEN Do_cnt THEN
RAISE_APPLICATION_ERROR(sqlcode,
'Do Count must be 0, 1 or 2. ');
WHEN no_logged_in_user THEN
RAISE_APPLICATION_ERROR(sqlcode,
'Logged-in User Key cannot be NULL OR less than or equal to zero ');
END;
end XL_SP_ROGUEUSERS;
But Am getting the following error message, I couldn't figure wat it is.Can anyone help me:-
PLS-00103: Encountered the symbol "NO" when expecting one of the following: * & = - + ; < / > at in is mod remainder not rem return returning <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between into using || bulk member SUBMULTISET_Please use tags when posting code. Also please format the code so that blocks line up vertically - often that makes syntax errors like missing END IFs etc much easier to spot.
-
Table doesn't exist error while creating a procedure
The query executes and retrieve records but when the query is put into a procedure , the procedure is giving error (4/30 PL/SQL: ORA-00942: table or view does not exist) during creation. The snurk_cmms_csht008_rfs_misc is a public synonym refering to db2 database. How to make the procedure to get created ?
SQL> CREATE PROCEDURE TEST AS
2 I VARCHAR2(20);
3 BEGIN
4 SELECT CD_PLANT INTO I FROM snurk_cmms_csht008_rfs_misc
5 WHERE ROWNUM <2;
6 END;
7 /
Warning: Procedure created with compilation errors.
SQL> SHOW ERRORS;
Errors for PROCEDURE TEST:
LINE/COL ERROR
4/2 PL/SQL: SQL Statement ignored
4/30 PL/SQL: ORA-00942: table or view does not exist
SQL> SHOW USER;
USER is "ORDV_SRC"
SQL> SELECT CD_PLANT FROM snurk_cmms_csht008_rfs_misc WHERE ROWNUM <2;
CD_PL
AP01A
thanks,
VinodhCreate a local view on the remote table (using the synonym).
Then you can reference the view always from your procedure.
Of cause during the creation of the view the database link to the remote DB must exist.
But later you can change your procedure/package even if the remote connection is not established.
Edited by: Sven W. on Sep 8, 2011 2:04 PM -
Got error when creating stored procedure
Hi,
I am a rookie in Oracle. I created a stored procedure:
create or replace procedure my_first_sp
as
begin
select cid from actions where rownum<3;
end;
And I got an error : "**** compilation error"
After I "show error" I got the description to see a "into" is expected.
But if I change the select statement to a insert statement, no error.
Please advice.
Thanks a lot.When you have a standalone SELECT statement in PL/SQL, you have to have an INTO clause if you want the results to be stored in a local variable.
In your case, it would appear that you want your query to return multiple rows. In that case, you'd want to create a cursor, i.e.
CREATE OR REPLACE my_first_sp
AS
BEGIN
FOR cursor_name IN (SELECT cid FROM actions WHERE rownum < 3)
LOOP
<<Do something>>
END LOOP;
END;I would also tend to suspect that your SELECT statement is wrong. This statement will return an arbitrary two cid values from the actions table, which is not likely what you want.
Justin -
Error while creating procedure and package
Hi,
I am getting an error while creating an procedure
create or replace procedure mke_test (mke_gender varchar2) is
begin
declare global temporary table mag_hotline_glob
INDIVIDUAL_ID NUMBER,
ONE_MONTH NUMBER,
THREE_MONTH NUMBER,
SIX_MONTH NUMBER,
TWELVE_MONTH NUMBER,
CHILDREN_PRES VARCHAR2(1 BYTE)
) with replace on commit preserve rows not logged;
begin
insert into mag_hotline_glob
select * from magazine_gender;
end;
end;
can anybody plz suggestIt's a total mess. You need to read the documentation first.
Create your table separately
CREATE global temporary table mag_hotline_glob(INDIVIDUAL_ID NUMBER,
ONE_MONTH NUMBER,
THREE_MONTH NUMBER,
SIX_MONTH NUMBER,
TWELVE_MONTH NUMBER,
CHILDREN_PRES VARCHAR2(1 BYTE)) with replace on commit preserve rows not logged;Then use the procedure (I don't know why, this INSERT statement you can fire yourself)
create or replace procedure mke_test(mke_gender varchar2) is
begin
insert into mag_hotline_glob
select * from magazine_gender;
end;If you want to create the GTT inside the procedure(should be avoided) then Use EXECUTE IMMEDIATE.
By the way, where are you using the IN parameter ? It' unnecessary. -
Error while creating procedure
i am creating the procedure which is having year as arguemnt (i am couting total number of user in year)
CREATE OR REPLACE PROCEDURE sample1 (a_year varchar2(4)) IS
BEGIN
select COUNT(*) Total_Count
from users a
where a.create_dt >= TO_DATE('01-JAN-'a_year, 'dd-mon-yyyy' )
and a.create_dt <= TO_DATE('31-DEC'a_year, 'dd-mon-yyyy' );
END sample1;if i am using cursor like below
CREATE OR REPLACE PROCEDURE sample1 (a_year char,p_Parent_RS IN OUT t_CursorPtr) IS
TYPE t_CursorPtr IS REF CURSOR;
BEGIN
OPEN p_Parent_RS FOR
select 'NEW ITEMS CREATED' Column_Name, COUNT(*) Total_Count
from attribs a
where a.create_dt >= TO_DATE('01-JAN-'||a_year, 'dd-mon-yyyy' )
and a.create_dt <= TO_DATE('31-DEC-'||a_year, 'dd-mon-yyyy' )
union all
-- new locations count
select 'NEW LOCATION COUNT' Column_Name, COUNT(*) Total_Count
from location a
where a.create_dt >= TO_DATE('01-JAN-'||a_year, 'dd-mon-yyyy' )
and a.create_dt <= TO_DATE('31-DEC-'||a_year, 'dd-mon-yyyy' )
union all
-- new interface nodes
select 'NEW INTERFACE NODE' Column_Name, COUNT(*) Total_Count
from interface_node a
where A.create_dt >= TO_DATE('01-JAN-'||a_year, 'dd-mon-yyyy' )
and a.create_dt <= TO_DATE('31-DEC-'||a_year, 'dd-mon-yyyy' )
union all
-- # of items with attributes
select 'ITEMS WITH ATTRIBUTE' Column_Name, COUNT(*) Total_Count
from attribs
where label_name_code not like '0'
--and component_code not like '0'
and item_act_inact_status = 'A'
and product_type_code IN ('FG','SF','BULK','SAM')
union all
-- total # of users
select 'TOTAL NUMBER OF USER' Column_Name, COUNT(*) Total_Count
from users a
where a.stat_code = 'A';
END sample1;i am getting below error
PLS-00201: identifier 'T_CURSORPTR' must be declared -
Compilation error while creating procedure
Hi,
I am getting compilation error while creating procedure
CREATE OR REPLACE My_CHANGEDATE IS
error_string VARCHAR2(400) := NULL;
BEGIN
Create table set_temp as select * from set;
CURSOR c1 is
SELECT a.SETNUM, b.CHANGEDATE from
set a, setsp_t2 b
where a.setnum = b.setnum
and trunc(a.changedate) < trunc(b.CHANGEDATE);
BEGIN
FOR rec IN c1 LOOP
UPDATE set SET changedate = rec.changedate
WHERE setnum = rec.setnum;
Insert into set_temp select * from set where setnum = rec.setnum;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
error_string := 'My_CHANGEDATE - '||SUBSTR(SQLERRM,1,350);
DBMS_OUTPUT.PUT_LINE(error_string);
RAISE;
END My_CHANGEDATE;I have taken your code and cleaned it up to be more readable. Please see the comments in the code.
CREATE OR REPLACE My_CHANGEDATE
IS
error_string VARCHAR2(400) := NULL;
BEGIN
/* The only way to issue DDL in a procedure is to either user
* DBMS_SQL or EXECUTE IMMEDIATE. Creating objects is generally
* not needed or recommended in frequently run code.
Create table set_temp as select * from set;
/* The cursor declarations need to go in the declaration section of the
* procedure (between IS .. BEGIN).
CURSOR c1 is
SELECT a.SETNUM, b.CHANGEDATE from
set a, setsp_t2 b
where a.setnum = b.setnum
and trunc(a.changedate) < trunc(b.CHANGEDATE);
BEGIN /* Where is the END that goes with this begin? */
/* Single record processing is generally not recommended. It is considered a "slow-by-slow" method. */
FOR rec IN c1 LOOP
UPDATE set SET changedate = rec.changedate
WHERE setnum = rec.setnum;
Insert into set_temp select * from set where setnum = rec.setnum;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
error_string := 'My_CHANGEDATE - '||SUBSTR(SQLERRM,1,350);
DBMS_OUTPUT.PUT_LINE(error_string);
RAISE;
END My_CHANGEDATE;My general recommendations are as follows:
1. Remove the CREATE TABLE from the procedure altogether.
2. Don't use reserved words for object names (e.g. SET)
3. Remove the record by record processing and consolidate it to a single UDPATE statement as follows (note untested):
UPDATE set s
SET changedate = (
SELECT CHANGEDATE
FROM SET A
, SETSO_T2 B
WHERE A.SETNUM = B.SETNUM
AND S.SETNUM = A.SETNUM
AND TRUNC(A.CHANGEDATE) < TRUNC(B.CHANGEDATE)
WHERE EXISTS(
SELECT NULL
FROM SET A
WHERE A.SETNUM = S.SETNUM
)HTH! -
Very weird ORA-06502 error while creating procedure
Hi All,
i try to create the following procedure (on a 10.2 database):
create or replace procedure audit_report
as
cursor c_audit_user (b_start_date date, b_end_date date)
is
select user_id
, os_user
, session_id
, host
, last_program
, last_action
, last_module
, to_char(logon_day,'dd-mm-yyyy') logon_day
, logon_time
, to_char(logoff_day,'dd-mm-yyyy') logoff_day
, logoff_time
, elapsed_minutes
from audit_user
where logon_day >= b_start_date
and logon_day < b_end_date
order by logon_day desc
cursor c_audit_ddl (b_start_date in date, b_end_date in date)
is
select user_name
, to_char(ddl_date,'dd-mm-yyyy hh24:mi:ss') ddl_date
, ddl_type
, object_type
, owner
, object_name
, sql_text
from audit_ddl
where ddl_date >= b_start_date
and ddl_date < b_end_date
order by ddl_date desc
cursor c_audit_trail (b_start_date in date, b_end_date in date)
is
select os_username
, username
, to_char(timestamp,'dd-mm-yyyy hh24:mi:ss') timestamp
, owner
, obj_name
, to_char(action) action
, action_name
, decode(ses_actions,'---S------------','DELETE',
'------S---------','INSERT',
'---------S------','SELECT',
'----------S-----','UPDATE',
'---S--S--S------','DELETE/INSERT/SELECT',
'---S--S--SS-----','DELETE/INSERT/SELECT/UPDATE',
'------S--S------','INSERT/SELECT',
'------S--SS-----','INSERT/SELECT/UPDATE',
'---------SS-----','SELECT/UPDATE',
'DDL ACTION') ses_actions
, priv_used
from dba_audit_Trail
where username <> 'DBSNMP'
and timestamp >= b_start_date
and timestamp < b_end_date
order by timestamp desc
v_header_user varchar2(255);
v_sep_user varchar2(255);
v_header_ddl varchar2(255);
v_sep_ddl varchar2(255);
v_header_dml varchar2(255);
v_sep_dml varchar2(255);
v_record_user varchar2(255);
v_record_ddl varchar2(255);
v_record_dml varchar2(255);
v_report utl_file.file_type;
v_file_dir varchar2(255);
v_file_name varchar2(255);
v_start_date date;
v_end_date date;
v_db_name varchar2(255);
begin
-- Find start and end date of previous week (Sunday to Monday)
if to_char(sysdate,'DAY') = 'MONDAY' then
v_start_date := trunc(sysdate-8);
v_end_date := trunc(sysdate-1);
elsif
to_char(sysdate,'DAY') = 'TUESDAY' then
v_start_date := trunc(sysdate-9);
v_end_date := trunc(sysdate-2);
elsif
to_char(sysdate,'DAY') = 'WEDNESDAY' then
v_start_date := trunc(sysdate-10);
v_end_date := trunc(sysdate-3);
elsif
to_char(sysdate,'DAY') = 'THURSDAY' then
v_start_date := trunc(sysdate-11);
v_end_date := trunc(sysdate-4);
elsif
to_char(sysdate,'DAY') = 'FRIDAY' then
v_start_date := trunc(sysdate-12);
v_end_date := trunc(sysdate-5);
elsif
to_char(sysdate,'DAY') = 'SATURDAY' then
v_start_date := trunc(sysdate-13);
v_end_date := trunc(sysdate-6);
elsif
to_char(sysdate,'DAY') = 'SUNDAY' then
v_start_date := trunc(sysdate-14);
v_end_date := trunc(sysdate-7);
end if;
--Fill headers
v_header_user := 'USER_ID OS_USER SESSION_ID HOST LAST_PROGR'||
' LAST_ACTION LAST_MODULE LOGON_DAY'||
' LOGON_TI LOGOFF_DAY LOGOFF_T ELAPSED_MINUTES';
v_sep_user := '---------- --------- ---------- -------- ----------'||
'-------------------- ----------- ----------- ---------'||
v_header_ddl := 'USER_NAME DDL_DATE DDL_TYPE OBJECT_TYPE'||
' OWNER OBJECT_NAME SQL_TEXT';
v_sep_ddl := '---------- --------------------- ---------- -----------'||
'--------- ---------- -------------------- -------------'||
v_header_dml := 'OS_USERNAME USERNAME TIMESTAMP OWNER'||
' OBJ_NAME ACTION ACTION_NAME SES_ACTIONS'||
' PRIV_USED';
v_sep_dml := '----------- ---------- --------------------- ---------- '||
'--------------- ------ --------------- ------------------'||
--Create audit report file
v_file_dir := 'AUDIT_REPORT_DIR';
select name
into v_db_name
from v$database;
v_file_name := 'audit_report_'||v_db_name||'_'||to_char(v_start_date,'yyyymmdd')||'-'||to_char(v_end_date-1,'yyyymmdd')||'.log';
v_report := utl_file.fopen(v_file_dir, v_file_name, 'w');
--Report Header
utl_file.put_line(v_report,'AUDIT REPORT');
utl_file.put_line(v_report,'------------');
utl_file.put_line(v_report,'Database: '||v_db_name);
utl_file.put_line(v_report,'From : '||to_char(trunc(v_start_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'To : '||to_char(trunc(v_end_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'Created : '||to_char(sysdate,'dd-mm-yyyy hh24:mi:ss'));
utl_file.new_line(v_report);
--Report Detail records
utl_file.put_line(v_report,v_header_user);
utl_file.put_line(v_report,v_sep_user);
for r_audit_user in c_audit_user(v_start_date,v_end_date) loop
v_record_user := rpad(r_audit_user.user_id,11,' ')||
rpad(r_audit_user.os_user,11,' ')||
rpad(r_audit_user.session_id,11,' ')||
rpad(r_audit_user.host,9,' ')||
rpad(r_audit_user.last_program,31,' ')||
rpad(r_audit_user.last_action,12,' ')||
rpad(r_audit_user.last_module,12,' ')||
rpad(r_audit_user.logon_day,11,' ')||
rpad(r_audit_user.logon_time,9,' ')||
rpad(r_audit_user.logoff_day,11,' ')||
rpad(r_audit_user.logoff_time,9,' ')||
lpad(r_audit_user.elapsed_minutes,15,' ');
utl_file.put_line(v_report,v_record_user);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_ddl);
utl_file.put_line(v_report,v_sep_ddl);
for r_audit_ddl in c_audit_ddl(v_start_date,v_end_date) loop
v_record_ddl := rpad(r_audit_ddl.user_name,11,' ')||
rpad(r_audit_ddl.ddl_date,22,' ')||
rpad(r_audit_ddl.ddl_type,11,' ')||
rpad(r_audit_ddl.object_type,21,' ')||
rpad(r_audit_ddl.owner,11,' ')||
rpad(r_audit_ddl.object_name,21,' ')||
rpad(r_audit_ddl.sql_text,100,' ');
utl_file.put_line(v_report,v_record_ddl);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_dml);
utl_file.put_line(v_report,v_sep_dml);
for r_audit_trail in c_audit_trail(v_start_date,v_end_date) loop
v_record_dml := rpad(r_audit_trail.os_username,12,' ')||
rpad(r_audit_trail.username,11,' ')||
rpad(r_audit_trail.timestamp,22,' ')||
rpad(r_audit_trail.owner,11,' ')||
rpad(r_audit_trail.obj_name,16,' ')||
rpad(r_audit_trail.action,7,' ')||
rpad(r_audit_trail.action_name,16,' ')||
rpad(r_audit_trail.ses_actions,19,' ')||
rpad(r_audit_trail.priv_used,20,' ');
utl_file.put_line(v_report,v_record_dml);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report, '*** End of report ***');
utl_file.fclose(v_report);
end;
This gives me the following error:
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 8
When i try to create the procedure as this, i get the same error:
create or replace procedure audit_report
as
/*cursor c_audit_user (b_start_date date, b_end_date date)
is
select user_id
, os_user
, session_id
, host
, last_program
, last_action
, last_module
, to_char(logon_day,'dd-mm-yyyy') logon_day
, logon_time
, to_char(logoff_day,'dd-mm-yyyy') logoff_day
, logoff_time
, elapsed_minutes
from audit_user
where logon_day >= b_start_date
and logon_day < b_end_date
order by logon_day desc
cursor c_audit_ddl (b_start_date in date, b_end_date in date)
is
select user_name
, to_char(ddl_date,'dd-mm-yyyy hh24:mi:ss') ddl_date
, ddl_type
, object_type
, owner
, object_name
, sql_text
from audit_ddl
where ddl_date >= b_start_date
and ddl_date < b_end_date
order by ddl_date desc
cursor c_audit_trail (b_start_date in date, b_end_date in date)
is
select os_username
, username
, to_char(timestamp,'dd-mm-yyyy hh24:mi:ss') timestamp
, owner
, obj_name
, to_char(action) action
, action_name
, decode(ses_actions,'---S------------','DELETE',
'------S---------','INSERT',
'---------S------','SELECT',
'----------S-----','UPDATE',
'---S--S--S------','DELETE/INSERT/SELECT',
'---S--S--SS-----','DELETE/INSERT/SELECT/UPDATE',
'------S--S------','INSERT/SELECT',
'------S--SS-----','INSERT/SELECT/UPDATE',
'---------SS-----','SELECT/UPDATE',
'DDL ACTION') ses_actions
, priv_used
from dba_audit_Trail
where username <> 'DBSNMP'
and timestamp >= b_start_date
and timestamp < b_end_date
order by timestamp desc
v_header_user varchar2(255);
v_sep_user varchar2(255);
v_header_ddl varchar2(255);
v_sep_ddl varchar2(255);
v_header_dml varchar2(255);
v_sep_dml varchar2(255);
v_record_user varchar2(255);
v_record_ddl varchar2(255);
v_record_dml varchar2(255);
v_report utl_file.file_type;
v_file_dir varchar2(255);
v_file_name varchar2(255);
v_start_date date;
v_end_date date;*/
v_db_name varchar2(255);
begin
/*-- Find start and end date of previous week (Sunday to Monday)
if to_char(sysdate,'DAY') = 'MONDAY' then
v_start_date := trunc(sysdate-8);
v_end_date := trunc(sysdate-1);
elsif
to_char(sysdate,'DAY') = 'TUESDAY' then
v_start_date := trunc(sysdate-9);
v_end_date := trunc(sysdate-2);
elsif
to_char(sysdate,'DAY') = 'WEDNESDAY' then
v_start_date := trunc(sysdate-10);
v_end_date := trunc(sysdate-3);
elsif
to_char(sysdate,'DAY') = 'THURSDAY' then
v_start_date := trunc(sysdate-11);
v_end_date := trunc(sysdate-4);
elsif
to_char(sysdate,'DAY') = 'FRIDAY' then
v_start_date := trunc(sysdate-12);
v_end_date := trunc(sysdate-5);
elsif
to_char(sysdate,'DAY') = 'SATURDAY' then
v_start_date := trunc(sysdate-13);
v_end_date := trunc(sysdate-6);
elsif
to_char(sysdate,'DAY') = 'SUNDAY' then
v_start_date := trunc(sysdate-14);
v_end_date := trunc(sysdate-7);
end if;
--Fill headers
v_header_user := 'USER_ID OS_USER SESSION_ID HOST LAST_PROGR'||
' LAST_ACTION LAST_MODULE LOGON_DAY'||
' LOGON_TI LOGOFF_DAY LOGOFF_T ELAPSED_MINUTES';
v_sep_user := '---------- --------- ---------- -------- ----------'||
'-------------------- ----------- ----------- ---------'||
v_header_ddl := 'USER_NAME DDL_DATE DDL_TYPE OBJECT_TYPE'||
' OWNER OBJECT_NAME SQL_TEXT';
v_sep_ddl := '---------- --------------------- ---------- -----------'||
'--------- ---------- -------------------- -------------'||
v_header_dml := 'OS_USERNAME USERNAME TIMESTAMP OWNER'||
' OBJ_NAME ACTION ACTION_NAME SES_ACTIONS'||
' PRIV_USED';
v_sep_dml := '----------- ---------- --------------------- ---------- '||
'--------------- ------ --------------- ------------------'||
--Create audit report file
v_file_dir := 'AUDIT_REPORT_DIR';
select name
into v_db_name
from v$database;
v_file_name := 'audit_report_'||v_db_name||'_'||to_char(v_start_date,'yyyymmdd')||'-'||to_char(v_end_date-1,'yyyymmdd')||'.log';
v_report := utl_file.fopen(v_file_dir, v_file_name, 'w');
--Report Header
utl_file.put_line(v_report,'AUDIT REPORT');
utl_file.put_line(v_report,'------------');
utl_file.put_line(v_report,'Database: '||v_db_name);
utl_file.put_line(v_report,'From : '||to_char(trunc(v_start_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'To : '||to_char(trunc(v_end_date),'dd-mm-yyyy'));
utl_file.put_line(v_report,'Created : '||to_char(sysdate,'dd-mm-yyyy hh24:mi:ss'));
utl_file.new_line(v_report);
--Report Detail records
utl_file.put_line(v_report,v_header_user);
utl_file.put_line(v_report,v_sep_user);
for r_audit_user in c_audit_user(v_start_date,v_end_date) loop
v_record_user := rpad(r_audit_user.user_id,11,' ')||
rpad(r_audit_user.os_user,11,' ')||
rpad(r_audit_user.session_id,11,' ')||
rpad(r_audit_user.host,9,' ')||
rpad(r_audit_user.last_program,31,' ')||
rpad(r_audit_user.last_action,12,' ')||
rpad(r_audit_user.last_module,12,' ')||
rpad(r_audit_user.logon_day,11,' ')||
rpad(r_audit_user.logon_time,9,' ')||
rpad(r_audit_user.logoff_day,11,' ')||
rpad(r_audit_user.logoff_time,9,' ')||
lpad(r_audit_user.elapsed_minutes,15,' ');
utl_file.put_line(v_report,v_record_user);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_ddl);
utl_file.put_line(v_report,v_sep_ddl);
for r_audit_ddl in c_audit_ddl(v_start_date,v_end_date) loop
v_record_ddl := rpad(r_audit_ddl.user_name,11,' ')||
rpad(r_audit_ddl.ddl_date,22,' ')||
rpad(r_audit_ddl.ddl_type,11,' ')||
rpad(r_audit_ddl.object_type,21,' ')||
rpad(r_audit_ddl.owner,11,' ')||
rpad(r_audit_ddl.object_name,21,' ')||
rpad(r_audit_ddl.sql_text,100,' ');
utl_file.put_line(v_report,v_record_ddl);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report,v_header_dml);
utl_file.put_line(v_report,v_sep_dml);
for r_audit_trail in c_audit_trail(v_start_date,v_end_date) loop
v_record_dml := rpad(r_audit_trail.os_username,12,' ')||
rpad(r_audit_trail.username,11,' ')||
rpad(r_audit_trail.timestamp,22,' ')||
rpad(r_audit_trail.owner,11,' ')||
rpad(r_audit_trail.obj_name,16,' ')||
rpad(r_audit_trail.action,7,' ')||
rpad(r_audit_trail.action_name,16,' ')||
rpad(r_audit_trail.ses_actions,19,' ')||
rpad(r_audit_trail.priv_used,20,' ');
utl_file.put_line(v_report,v_record_dml);
end loop;
utl_file.new_line(v_report);
utl_file.put_line(v_report, '*** End of report ***');
utl_file.fclose(v_report);*/
null;
end;
So all code is commented out, but still the error.
Any ideas?
Kind regards,
Davejust out of interest, what output do you get if you desc user_source?
I get:
NAME VARCHAR2(30)
TYPE VARCHAR2(12)
LINE NUMBER
TEXT VARCHAR2(4000) -
Encountered an error in repository runtime extension;Create LLang procedure failed
Hi Guys
I am implementing Apriori algorithm through graphical way. My model is validated but while activating this i am getting the error' Encountered an error in repository runtime extension;Create LLang procedure failed' Here i am attaching the model which i have created.
Regards
KarunaHi Folks,
I resolved this issue by setting schema as _SYS_AFL... Thanks for your help.
Regards
Karuna -
I'm trying to create a procedure where I pass in a cursor. I'm on Oracle 9i and SQL is not my main job, though I do a good bit of complex querying and reading SQL. The code below is simplified, but I am still receiving an error "PLS-00201: identifier 'TYPE' must be declared. I've tried several things and followed online examples of procedures, but I have not been able to make this work.
{code}
CREATE OR REPLACE procedure PERM.no_response_7days_inc
(sponsorship_cursor IN TYPE,
a_result OUT Number) IS
DeadLine_Days Number(3);
Date_Diff Number(3);
a_result Number (3);
begin
--sponsorship_cursor IS a_recordset;
a_result := 0;
-- do work with cursor information;
a_result := 1;
end;
{code}
thank you very much for your assistance.Hi,
danielk wrote:
... When I do the code above, I am still receiving an error, though a different one, "PLS-00410: duplicate fields in RECORD,TABLE or argument list are not permitted".It sounds like there's a mistake in the calling procedure, where it's doing something like
SELECT dummy
, dummy
FROM dual;which is legal in some contexts, but not in others.
Whenever you have a problem, post a complete test script that people can run to re-create the problem and test their ideas. -
Error while creating a new entity row for testEO
Hi All,
I have a 1st page where I enter the employeeNumber and that particular parameter should get displayed in the 2nd page when I click on the "SubmitButton".I am moving to the 2nd page using pageContext.forwardImmediately.I am passing my parameter with this URL.But, I am getting "Error while creating a new entity row for testEO" in my code before i enter anything in " employeeNumber " field in the 1st page.
My CO code is:
/*===========================================================================+
| Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA |
| All rights reserved. |
+===========================================================================+
| HISTORY |
+===========================================================================*/
package xxfc.oracle.apps.test.OAProject1.webui;
import com.sun.java.util.collections.HashMap;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
import oracle.jbo.Row;
import xxfc.oracle.apps.test.OAProject1.server.testVOImpl;
* Controller for ...
public class testCO extends OAControllerImpl
public static final String RCS_ID="$Header$";
public static final boolean RCS_ID_RECORDED =
VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
* Layout and page setup logic for a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
OAApplicationModule am =(OAApplicationModule) pageContext.getApplicationModule(webBean);
testVOImpl vo1 = (testVOImpl)am.findViewObject("testVO1");
vo1.executeQuery();
Row r = vo1.first();
System.out.println("**************Error in the below Line**********************");
Row row = vo1.createRow();
vo1.insertRow(row);
row.setNewRowState(Row.STATUS_INITIALIZED);
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModule am =(OAApplicationModule) pageContext.getApplicationModule(webBean);
OAViewObject vo1 = (OAViewObject)am.findViewObject("testVO1");
if(!vo1.isPreparedForExecution())
vo1.executeQuery();
Row row = vo1.getCurrentRow();
am.getOADBTransaction().commit();
String strEvent = pageContext.getParameter(EVENT_PARAM);
if (strEvent.equals("update"))
String custId = pageContext.getParameter("CustID");
pageContext.putParameter("CstID",custId);
HashMap hashMap = new HashMap();
hashMap.put("CustomerId",custId);
am.getOADBTransaction().commit();
pageContext.forwardImmediately("OA.jsp?page=/xxfc/oracle/apps/test/OAProject1/webui/popupPG&CustID=custId",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
hashMap, //hashmap
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES
thanks,
AkshataHi Niranjana,
It did not work I am getting the same error.does the WHO column order in the table matters? My WHO columns are in the below order:
LAST_UPDATE_DATE
LAST_UPDATED_BY
LAST_UPDATE_LOGIN
CREATION_DATE
CREATED_BY
my error is:
oracle.jbo.RowCreateException: JBO-25017: Error while creating a new entity row for testEO.
It appears on the top of my page as a message.
Thanks,
Akshata
Edited by: Akshata on Mar 15, 2012 12:29 AM -
Error while creating pourchase order
I am getting following error while creating PO
Account assignment mandatory for material 000000000000001335 (enter acc. ***. cat.)
Message no. ME062
Diagnosis
There is no provision for value-based inventory management for this material type in this plant. Account assignment is thus necessary.
Procedure
Please enter an account assignment category.
Please help
Regards
Ranjeeyhi,
As you are mentioning Material Type is -HAWA
Hawa material will have Valuation class as -Trading material
If we have Not ticked -Value and Qty updating for the HAWA material type then eventhrough we maintain Accounting Views. -In configuration
We get the error as a account assignment cat mandatory.
Please maintain Qty and Value update Tick then you can create PO
with regards
Shrinivas gangoor -
Error while creating new projects using api
Hello,
I am having error while creating projects using standard api, PA_PROJECT_PUB.CREATE_PROJECTS. The error I am having is as follow.
Source template ID is invalid.
===
My code is as follow:
SET SERVEROUTPUT ON SIZE 1000000
SET VERIFY OFF
define no=&amg_number
DECLARE
-- Variables used to initialize the session
l_user_id NUMBER;
l_responsibility_id NUMBER;
cursor get_key_members is
select person_id, project_role_type, rownum
from pa_project_players
where project_id = 1;
-- Counter variables
a NUMBER := 0;
m NUMBER := 0;
-- Variables needed for API standard parameters
l_commit VARCHAR2(1) := 'F';
l_init_msg_list VARCHAR2(1) := 'T';
l_api_version_number NUMBER :=1.0;
l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
-- Variables used specifically in error message retrieval
l_encoded VARCHAR2(1) := 'F';
l_data VARCHAR2(2000);
l_msg_index NUMBER;
l_msg_index_out NUMBER;
-- Variables needed for Oracle Project specific parameters
-- Input variables
l_pm_product_code VARCHAR2(30);
l_project_in pa_project_pub.project_in_rec_type;
l_key_members pa_project_pub.project_role_tbl_type;
l_class_categories pa_project_pub.class_category_tbl_type;
l_tasks_in pa_project_pub.task_in_tbl_type;
-- Record variables for loading table variables above
l_key_member_rec pa_project_pub.project_role_rec_type;
l_class_category_rec pa_project_pub.class_category_rec_type;
l_task_rec pa_project_pub.task_in_rec_type;
-- Output variables
l_workflow_started VARCHAR2(100);
l_project_out pa_project_pub.project_out_rec_type;
l_tasks_out pa_project_pub.task_out_tbl_type;
-- Exception to call messag handlers if API returns an error.
API_ERROR EXCEPTION;
BEGIN
-- Initialize the session with my user id and Projects, Vision Serves (USA0
-- responsibility:
select user_id into l_user_id
from fnd_user
where user_name = 'SSHAH';
select responsibility_id into l_responsibility_id
from fnd_responsibility_tl
where responsibility_name = 'Projects Implementation Superuser';
pa_interface_utils_pub.set_global_info(
p_api_version_number => l_api_version_number,
p_responsibility_id => l_responsibility_id,
p_user_id => l_user_id,
p_msg_count => l_msg_count,
p_msg_data => l_msg_data,
p_return_status => l_return_status);
if l_return_status != 'S' then
raise API_ERROR;
end if;
-- Provide values for input variables
-- L_PM_PRODUCT_CODE: These are stored in pa_lookups and can be defined
-- by the user. In this case we select a pre-defined one.
select lookup_code into l_pm_product_code
from pa_lookups
where lookup_type = 'PM_PRODUCT_CODE'
and meaning = 'Conversion';
-- L_PROJECT_IN: We have to provide values for all required elements
-- of this record (see p 5-13, 5-14 for the definition of the record).
-- Customers will normally select this information from some external
-- source
l_project_in.pm_project_reference := 'AGL-AMG Project &no';
l_project_in.project_name := 'AGL-AMG Project &no';
l_project_in.created_from_project_id := 1;
l_project_in.carrying_out_organization_id := 2864; /*Cons. West*/
l_project_in.project_status_code := 'UNAPPROVED';
l_project_in.start_date := '01-JAN-11';
l_project_in.completion_date := '31-DEC-11';
l_project_in.description := 'Trying Hard';
l_project_in.project_relationship_code := 'Primary';
-- L_KEY_MEMBERS: To load the key member table we load individual
-- key member records and assign them to the key member table. In
-- the example below I am selecting all of the key member setup
-- from an existing project with 4 key members ('EE-Proj-01'):
for km in get_key_members loop
-- Get the next record and load into key members record:
l_key_member_rec.person_id := km.person_id;
l_key_member_rec.project_role_type := km.project_role_type;
-- Assign this record to the table (array)
l_key_members(km.rownum) := l_key_member_rec;
end loop;
-- L_CLASS_CATEGORIES: commented out below should fix the error we get
-- because the template does not have an assigment for the mandatory class
-- 'BAS Test'
l_class_category_rec.class_category := 'Product';
l_class_category_rec.class_code := 'Non-classified';
-- Assign the record to the table (array)
l_class_categories(1) := l_class_category_rec;
-- L_TASKS_IN: We will load in a single task and a subtask providing only
-- the basic fields (see pp. 5-16,5-17,5-18 for the definition of
-- the task record)
l_task_rec.pm_task_reference := '1';
l_task_rec.pa_task_number := '1';
l_task_rec.task_name := 'Construction';
l_task_rec.pm_parent_task_reference := '' ;
l_task_rec.task_description := 'Plant function';
-- Assign the top task to the table.
l_taskS_in(1) := l_task_rec;
-- Assign values for the sub task
l_task_rec.pm_task_reference := '1.1';
l_task_rec.pa_task_number := '1.1';
l_task_rec.task_name := 'Brick laying';
l_task_rec.pm_parent_task_reference := '1' ;
l_task_rec.task_description := 'Plant building';
-- Assign the subtask to the task table.
l_tasks_in(2) := l_task_rec;
-- All inputs are assigned, so call the API:
pa_project_pub.create_project
(p_api_version_number => l_api_version_number,
p_commit => l_commit,
p_init_msg_list => l_init_msg_list,
p_msg_count => l_msg_count,
p_msg_data => l_msg_data,
p_return_status => l_return_status,
p_workflow_started => l_workflow_started,
p_pm_product_code => l_pm_product_code,
p_project_in => l_project_in,
p_project_out => l_project_out,
p_key_members => l_key_members,
p_class_categories => l_class_categories,
p_tasks_in => l_tasks_in,
p_tasks_out => l_tasks_out);
-- Check the return status, if it is not success, then raise message handling
-- exception.
IF l_return_status != 'S' THEN
dbms_output.put_line('Msg_count: '||to_char(l_msg_count));
dbms_output.put_line('Error: ret status: '||l_return_status);
RAISE API_ERROR;
END IF;
-- perform manual commit since p_commit was set to False.
COMMIT;
--HANDLE EXCEPTIONS
EXCEPTION
WHEN API_ERROR THEN
FOR i IN 1..l_msg_count LOOP
pa_interface_utils_pub.get_messages(
p_msg_count => l_msg_count,
p_encoded => l_encoded,
p_msg_index => i,
p_msg_data => l_msg_data,
p_data => l_data,
p_msg_index_out => l_msg_index_out);
dbms_output.put_line('ERROR: '||to_char(l_msg_index_out)||': '||l_data);
END LOOP;
rollback;
WHEN OTHERS THEN
dbms_output.put_line('Error: '||sqlerrm);
FOR i IN 1..l_msg_count LOOP
pa_interface_utils_pub.get_messages(
p_msg_count => l_msg_count,
p_encoded => l_encoded,
p_msg_index => i,
p_msg_data => l_msg_data,
p_data => l_data,
p_msg_index_out => l_msg_index_out);
dbms_output.put_line('ERROR: '||to_char(l_msg_index_out)||': '||l_data);
END LOOP;
rollback;
END;
===
Msg_count: 1
Error: ret status: E
ERROR: 1: Project: 'AGL-AMG Project 1123'
Source template ID is invalid.
PL/SQL procedure successfully completed.I was using a custom Application, which had a id other then 275 (which belongs to Oracle projects)
-
Error while creating MV replication group object
Hi,
I am getting error while creating replication group object. I tried to create using OEM and SQLPlus
OEM error
This error while creating M.V. rep. group object
There is a table or view named SCOTT.EMP.
It must be dropped before a materialized view can be created.
In SQLPLUS
SQL> CONNECT MVIEWADMIN/MVIEWADMIN@SWEET
Connected.
SQL>
SQL> BEGIN
2 DBMS_REPCAT.CREATE_MVIEW_REPOBJECT (
3 gname => 'SCOTT',
4 sname => 'KARTHIK',
5 oname => 'emp_mv',
6 type => 'SNAPSHOT',
7 min_communication => TRUE);
8 END;
9 /
BEGIN
ERROR at line 1:
ORA-23306: schema KARTHIK does not exist
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_REPCAT_SNA_UTL", line 2840
ORA-06512: at "SYS.DBMS_REPCAT_SNA_UTL", line 773
ORA-06512: at "SYS.DBMS_REPCAT_SNA_UTL", line 5570
ORA-06512: at "SYS.DBMS_REPCAT_SNA", line 82
ORA-06512: at "SYS.DBMS_REPCAT", line 1332
ORA-06512: at line 2
Please not already I have created KARTHIK schema.Arthik,
I think I know what may have happened.
As I can see you are trying to create support for an updateable materialized view.
You have to make sure the name of the schema that owns the materialized view is the same as the schema owner of the master table (at master site).
From the code you have shown, I bet the owner of table EMP is SCOTT.
From the other hand, you want to create materialized view EMP_MV under schema KARTHIK that refers to table SCOTT.EMP at master site.
According to the documentation, the schema name used in DBMS_REPCAT.CREATE_MVIEW_REPOBJECT must be same as the schema that owns the master table.
Please check the documentation at the link below
http://download.oracle.com/docs/cd/B19306_01/server.102/b14227/rarrcatpac.htm#i109228
I tried to reproduce your example in my environment, and I got exactly the same error which actually confirms my assumption that the reason for the error is the fact that you tried to create the materialized view in a schema with different name than the one where master table exists.
I'll skip some of the steps that I used to create the replication environment.
I have two databases, DB1.world and DB2.world
On DB2.world I will generate replication support for table EMP which belongs to user SCOTT
SQL> conn scott/*****@DB2.world
Connected.
SQL>create materialized view log on EMP with primary key;
Materialized view log created.
SQL>
SQL>conn repadmin/*****@DB2.world
Connected.
SQL>BEGIN
2 DBMS_REPCAT.CREATE_MASTER_REPGROUP(
3 gname => 'GROUPA',
4 qualifier => '',
5 group_comment => '');
6* END;
PL/SQL procedure successfully completed.
SQL>BEGIN
2 DBMS_REPCAT.CREATE_MASTER_REPOBJECT(
3 gname => 'GROUPA',
4 type => 'TABLE',
5 oname => 'EMP',
6 sname => 'SCOTT',
7 copy_rows => TRUE,
8 use_existing_object => TRUE);
9* END;
10 /
PL/SQL procedure successfully completed.
SQL> BEGIN
2 DBMS_REPCAT.GENERATE_REPLICATION_SUPPORT(
3 sname => 'SCOTT',
4 oname => 'EMP',
5 type => 'TABLE',
6 min_communication => TRUE);
7 END;
8 /
PL/SQL procedure successfully completed.
SQL>execute DBMS_REPCAT.RESUME_MASTER_ACTIVITY(gname => 'GROUPA');
PL/SQL procedure successfully completed.
SQL> select status from dba_repgroup;
STATUS
NORMAL Now let's create updateable materialized view at DB1. Before that I want to let you know that I created one sample in DB1 user named MYUSER. MVIEWADMIN is Materialized View administrator.
SQL>conn mviewadmin/****@DB1.world
Connected.
SQL> BEGIN
2 DBMS_REFRESH.MAKE(
3 name => 'MVIEWADMIN.MV_REFRESH_GROUPA',
4 list => '',
5 next_date => SYSDATE,
6 interval => '/*1:Hr*/ sysdate + 1/24',
7 push_deferred_rpc => TRUE,
8 refresh_after_errors => TRUE,
9 parallelism => 1);
10 END;
11 /
PL/SQL procedure successfully completed.
SQL> BEGIN
3 DBMS_REPCAT.CREATE_SNAPSHOT_REPGROUP(
5 gname => 'GROUPA',
7 master => 'DB2.wolrd',
9 propagation_mode => 'ASYNCHRONOUS');
11 END;
12 /
PL/SQL procedure successfully completed.
SQL>conn myuser/*****@DB1.world
Connected.
SQL>CREATE MATERIALIZED VIEW MYUSER.EMP_MV
2 REFRESH FAST
3 FOR UPDATE
4 AS SELECT EMPNO, ENAME, JOB, MGR, SAL, COMM, DEPTNO, HIREDATE
5* FROM [email protected];
Materialized view created.
SQL>conn mviewadmin/******@DB1.world
Connected.
SQL> BEGIN
2 DBMS_REFRESH.ADD(
3 name => 'MVIEWADMIN.MV_REFRESH_GROUPA',
4 list => 'MYUSER.EMP_MV',
5 lax => TRUE);
6 END;
7 /
PL/SQL procedure successfully completed.And now lets run CREATE_MVIEW_REPOBJECT.
SQL> BEGIN
2 DBMS_REPCAT.CREATE_MVIEW_REPOBJECT(
3 gname => 'GROUPA',
4 sname => 'MYUSER',
5 oname => 'EMP_MV',
6 type => 'SNAPSHOT',
7 min_communication => TRUE);
8 END;
9 /
BEGIN
ERROR at line 1:
ORA-23306: schema MYUSER does not exist
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_REPCAT_SNA_UTL", line 2840
ORA-06512: at "SYS.DBMS_REPCAT_SNA_UTL", line 773
ORA-06512: at "SYS.DBMS_REPCAT_SNA_UTL", line 5570
ORA-06512: at "SYS.DBMS_REPCAT_SNA", line 82
ORA-06512: at "SYS.DBMS_REPCAT", line 1332
ORA-06512: at line 3 I reproduced exactly the same error message.
So the problem is clearly in the schema name that owns the materialized view.
Now lets see if what would happen if I create the MV under schema SCOTT which has the same name as the schema on DB2.world where the master table exists.
SQL>conn scott/****@DB1.world
Connected.
SQL>CREATE MATERIALIZED VIEW SCOTT.EMP_MV
2 REFRESH FAST
3 FOR UPDATE
4 AS SELECT EMPNO, ENAME, JOB, MGR, SAL, COMM, DEPTNO, HIREDATE
5* FROM [email protected];
Materialized view created.
SQL>conn mviewadmin/******@DB1.world
Connected.
SQL> BEGIN
2 DBMS_REFRESH.ADD(
3 name => 'MVIEWADMIN.MV_REFRESH_GROUPA',
4 list => 'SCOTT.EMP_MV',
5 lax => TRUE);
6 END;
7 /
PL/SQL procedure successfully completed.And now lets run CREATE_MVIEW_REPOBJECT.
SQL> BEGIN
2 DBMS_REPCAT.CREATE_MVIEW_REPOBJECT(
3 gname => 'GROUPA',
4 sname => 'SCOTT',
5 oname => 'EMP_MV',
6 type => 'SNAPSHOT',
7 min_communication => TRUE);
8 END;
PL/SQL procedure successfully completed.As you can see everything works fine when the name of the schema owner of the MV at DB1.world is the same as the schema owner of the master table at DB2.world .
-- Mihajlo
Message was edited by:
tekicora
Maybe you are looking for
-
I read in numerous forums and never came up with a real answer if it is possible to add a SSD (solid state drive) drive to your MacBook. My test model was a new aluminum MacBook 2.4 already updated to 4 gigs from OWC for $80 delivered. (which I might
-
SOP to Demand Management - Mass Transfer -RMCA0766 - Program does not exist
Dear Experts, I am configuring the mass transfer from SOP to Demand Management. I want to maintain the variant for the program RMCA0766 so that I can create the Mass transfer job. But I get the message RMCA0766 does not exist. So, How do I generate
-
Need a method for importing Palm III data into a Palm Centro
I just bought a Palm Centro (Verizon), with the expectation of importing data from my old Palm III. From the Palm III Desktop, I exported Contacts, Calendar, Tasks, and Memos into separate folders (this was done on a Windows XP PC) and copied the re
-
I sent a PDF by iMessage yesterday. The message went but iMessage froze, then the whole Mac froze (the spinning wheel), needing a cold restart. Does this mean that I should never send PDF's by iMessage?
-
I've made successful droplets in the past, but for some reason I am having a problem with one in particular. First, my desire: To create a droplet that I can drag and drop a folder of raw images on that will select the "Auto" feature in the Camera Ra