Error logging in merge statement
how to handle error logging in merge statement??
thanks in advance!!!
Welcome to the forum!
Whenever you post please provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
>
how to handle error logging in merge statement??
>
Do it the way the documentation tells you to.
See the error_logging_clause of the MERGE statement in the SQL Language doc
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm
It contains an example of using error logging with MERGE
>
error_logging_clause
The error_logging_clause has the same behavior in a MERGE statement as in an INSERT statement. Refer to the INSERT statement error_logging_clause for more information.
See Also:
"Inserting Into a Table with Error Logging: Example"
Similar Messages
-
Oracle 9.2i - Log Errors in a Merge Statement
Hi all,
I want to log errors in a merge statement in way to allow the statement to finish without rollback. I see that in Oracle 10g2 it is possible with "LOG ERRORS INTO err$_dest ('MERGE') REJECT LIMIT UNLIMITED;" instruction but, apparently, it's not possible in Oracle 9.2i.
Is there another way to solve this problem?Depending on what type of errors you expect, you may be helped by deferring your constraints: unique, foreign key and check constraints can be deferred; that means they are only enforced when you commit.
You could defer all constraints, perform the bulk insert and then instead of committing you first try to set all constraints to immediate. If this fails, there are errors. If it does not, you can commit.
To find the exact errors, you can try to switch all deferred constraints back to immediate one by one. The ones that succeed are not violated by your transaction, oinly the ones that fail to switch to immediate are not met by your transaction.
For the violated constraints, you can find the offending records by simply selecting them. For example if the check constraint states Col X + Col Y < 10000 you will find the offending records by selecting all records where not (Col X + Col Y < 10000 ). Unfortunately we have no better mechanism than this for finding the records that are in violation of the rules.
best regards
Lucas -
DML Error logging for Update statement
Hello,
I am facing a problem with regard to DML Error logging with Update statement .
oracle : 10.2
I am executing following DML update:
BEGIN
UPDATE
table_1 a
SET a.Exp_DATE =a.EFF_DATE
WHERE a.col_a1 != (SELECT b.colb1
FROM table_2 b
WHERE a.msisdn =b.msisdn )
LOG ERRORS INTO table_1_ERR REJECT LIMIT UNLIMITED;
END ; I was expecting that "ORA-01427: single-row subquery returns more than one row" would be captured in LOG error table "table_1_err"
but instead I got run time error and whole dml was rolled back.
Please let me know whether this exception is not captured by DML error logging.
Thanks,
Abhishek*Oracle logs the following errors during DML operations:** Column values that are too large.
* Constraint violations (NOT NULL, unique, referential, and check constraints).
* Errors raised during trigger execution.
* Errors resulting from type conversion between a column in a subquery and the corresponding column of the table.
* Partition mapping errors.
>
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/transform.htm#sthref777 -
I am suddenly not getting email on my MacBook Pro, but am receiving e-mail on my iPhone. I'm getting message "Warning Recent errors logged" It repeatedly states "The Header From: address <postoffice> is not authorised - please go to control add PHP" But I only have 1 email address. I'm afraid to add anything on since I don't even know what this other e-mail address is. What should I do? And would this definitely be the cause of my not receiving e-mail?
I pressed check again and here is what appeared:
CONNECTED Apr 04 19:03:02.511 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
CONNECTED Apr 04 19:03:02.513 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:587 -- socket:0x1164f4730 -- thread:0x114a5a030
CONNECTED Apr 04 19:03:02.526 [kCFStreamSocketSecurityLevelNone] -- host:smtp.elikann.com -- port:2525 -- socket:0x11444a6a0 -- thread:0x11827f160
READ Apr 04 19:03:02.556 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
+OK <[email protected]>
READ Apr 04 19:03:02.563 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:587 -- socket:0x1164f4730 -- thread:0x114a5a030
220 mail.hostingplatform.com ESMTP
WROTE Apr 04 19:03:02.566 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
CAPA
CONNECTED Apr 04 19:03:02.568 [kCFStreamSocketSecurityLevelNone] -- host:mail.authsmtp.com -- port:2525 -- socket:0x11824ca00 -- thread:0x1176c1ab0
READ Apr 04 19:03:02.572 [kCFStreamSocketSecurityLevelNone] -- host:smtp.elikann.com -- port:2525 -- socket:0x11444a6a0 -- thread:0x11827f160
220 mail.hostingplatform.com ESMTP
WROTE Apr 04 19:03:02.585 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:587 -- socket:0x1164f4730 -- thread:0x114a5a030
EHLO 192.168.1.4
WROTE Apr 04 19:03:02.592 [kCFStreamSocketSecurityLevelNone] -- host:smtp.elikann.com -- port:2525 -- socket:0x11444a6a0 -- thread:0x11827f160
EHLO 192.168.1.4
READ Apr 04 19:03:02.610 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
-ERR authorization first
WROTE Apr 04 19:03:02.628 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
USER [email protected]
READ Apr 04 19:03:02.630 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:587 -- socket:0x1164f4730 -- thread:0x114a5a030
250-mail.hostingplatform.com
250-STARTTLS
250-PIPELINING
250-8BITMIME
250-SIZE 65000000
250 AUTH LOGIN PLAIN CRAM-MD5
READ Apr 04 19:03:02.639 [kCFStreamSocketSecurityLevelNone] -- host:smtp.elikann.com -- port:2525 -- socket:0x11444a6a0 -- thread:0x11827f160
250-mail.hostingplatform.com
250-STARTTLS
250-PIPELINING
250-8BITMIME
250-SIZE 65000000
250 AUTH LOGIN PLAIN CRAM-MD5
WROTE Apr 04 19:03:02.648 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:587 -- socket:0x1164f4730 -- thread:0x114a5a030
AUTH PLAIN (*** 44 bytes hidden ***)
WROTE Apr 04 19:03:02.667 [kCFStreamSocketSecurityLevelNone] -- host:smtp.elikann.com -- port:2525 -- socket:0x11444a6a0 -- thread:0x11827f160
AUTH PLAIN
READ Apr 04 19:03:02.670 [kCFStreamSocketSecurityLevelNone] -- host:mail.authsmtp.com -- port:2525 -- socket:0x11824ca00 -- thread:0x1176c1ab0
220 mail.authsmtp.com ESMTP Sendmail 8.14.2/8.14.2/; Fri, 5 Apr 2013 00:03:02 +0100 (BST)
READ Apr 04 19:03:02.671 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
+OK
WROTE Apr 04 19:03:02.691 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
PASS ************
WROTE Apr 04 19:03:02.698 [kCFStreamSocketSecurityLevelNone] -- host:mail.authsmtp.com -- port:2525 -- socket:0x11824ca00 -- thread:0x1176c1ab0
EHLO 192.168.1.4
READ Apr 04 19:03:02.704 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:587 -- socket:0x1164f4730 -- thread:0x114a5a030
235 ok, go ahead (#2.0.0)
READ Apr 04 19:03:02.712 [kCFStreamSocketSecurityLevelNone] -- host:smtp.elikann.com -- port:2525 -- socket:0x11444a6a0 -- thread:0x11827f160
334
WROTE Apr 04 19:03:02.734 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:587 -- socket:0x1164f4730 -- thread:0x114a5a030
QUIT
WROTE Apr 04 19:03:02.756 [kCFStreamSocketSecurityLevelNone] -- host:smtp.elikann.com -- port:2525 -- socket:0x11444a6a0 -- thread:0x11827f160
QUIT
READ Apr 04 19:03:02.759 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
+OK
WROTE Apr 04 19:03:02.776 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
QUIT
READ Apr 04 19:03:02.799 [kCFStreamSocketSecurityLevelNone] -- host:mail.authsmtp.com -- port:2525 -- socket:0x11824ca00 -- thread:0x1176c1ab0
250-mail.authsmtp.com Hello pool-72-93-40-57.bstnma.east.verizon.net [72.93.40.57], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 52428800
250-AUTH CRAM-MD5 DIGEST-MD5 LOGIN PLAIN
250-STARTTLS
250 HELP
WROTE Apr 04 19:03:02.808 [kCFStreamSocketSecurityLevelNone] -- host:mail.authsmtp.com -- port:2525 -- socket:0x11824ca00 -- thread:0x1176c1ab0
AUTH PLAIN ********************
READ Apr 04 19:03:02.822 [kCFStreamSocketSecurityLevelNone] -- host:mail.elikann.com -- port:110 -- socket:0x118296830 -- thread:0x10121d6c0
+OK
READ Apr 04 19:03:02.907 [kCFStreamSocketSecurityLevelNone] -- host:mail.authsmtp.com -- port:2525 -- socket:0x11824ca00 -- thread:0x1176c1ab0
235 2.0.0 OK Authenticated
WROTE Apr 04 19:03:02.917 [kCFStreamSocketSecurityLevelNone] -- host:mail.authsmtp.com -- port:2525 -- socket:0x11824ca00 -- thread:0x1176c1ab0
QUIT -
Indivual error recording in Merge Statement !!!!
Is it possible to record indivudual error in MERGE statement (Update / Insert).
I am unable to record those error. instead of MERGE if I update table in the cursor loop then I am able to record individual error but the process is time consuming.
Thanks in advance.
DebaHi Deba,
DML Error Logging:
SQL> create table tab1 (x number(1));
Table created.
SQL> exec dbms_errlog.create_error_log('tab1')
PL/SQL procedure successfully completed.
SQL>
SQL> merge into tab1 t
2 using (select 1 x from dual union all
3 select 112 x from dual) s
4 on (t.x = s.x)
5 when not matched
6 then insert (x) values (s.x)
7 log errors into err$_tab1 reject limit unlimited;
1 row merged.
SQL>
SQL> COL x for 9999
SQL> select * from tab1;
X
1
SQL> COL x for a4
SQL> select ora_err_number$, X from err$_tab1;
ORA_ERR_NUMBER$ X
1438 112
SQL>Regards
Peter -
Error while using Merge statement
Hi,
Can any one please look at the merge statement and help me understand the error.Thanks in advance.
MERGE /*+ APPEND */
INTO intf_lpa_master m
USING (SELECT std_district_student_id,
std_grade_code,
sub_test,
test_date,
performance_lvl_code,
test_lang_code,
v_student_id,
v_test_id,
v_lang_cd,
v_plc,
valid_test_date,
-- school_year,
-- school_id,
valid_src_stu_id,
test_code
FROM intf_lpa_master_vw
MINUS
SELECT std_district_student_id,
std_grade_code,
sub_test,
test_date,
performance_lvl_code,
test_lang_code,
v_student_id,
v_test_id,
v_lang_cd,
v_plc,
valid_test_date,
-- school_yr,
-- school_id,
valid_src_stu_id,
test_code
FROM intf_lpa_master
WHERE active_flag = 'Y') v
ON ( m.std_district_student_id = v.std_district_student_id
AND m.sub_test = v.sub_test
AND m.test_date = v.test_date)
WHEN MATCHED
THEN
UPDATE SET m.std_grade_code = v.std_grade_code,
m.performance_lvl_code = v.performance_lvl_code,
m.test_lang_code = v.test_lang_code,
m.active_flag = 'Y', -- if we are touching this record, it is to be active.
m.error_message = NULL, -- refresh these, to properly reconsider records.
m.create_date = SYSDATE,
m.record_id = intf_lpa_master_seq.NEXTVAL,
m.process_row = 'U',
m.last_update_date = SYSDATE,
m.last_update_user = 'PRE_PROCESS_LPA - UPDATE',
-- m.job_id = c_run_id ,
m.validation_step = NULL, -- refresh these, to properly reconsider records.
m.v_student_id = v.v_student_id,
m.v_test_id = v.v_test_id,
m.v_lang_cd = v.v_lang_cd,
m.v_plc = v.v_plc,
m.valid_test_date = v.valid_test_date,
-- m.school_year = v.schloo_year,
-- m.school_id = v.school_id,
m.valid_src_stu_id = v.valid_src_stu_id,
m.test_code = v.test_code
WHEN NOT MATCHED
THEN
INSERT (
m.std_district_student_id,
m.std_grade_code,
m.sub_test,
m.test_date,
m.performance_lvl_code,
m.test_lang_code,
m.active_flag,
m.error_message,
m.create_date,
m.record_id,
m.process_row,
m.last_update_date,
m.last_update_user,
-- m.job_id,
m.validation_step,
m.v_student_id,
m.v_test_id,
m.v_lang_cd,
m.v_plc,
m.valid_test_date,
-- m. school_year,
-- m. school_id,
m.valid_src_stu_id,
m.test_code)
VALUES (
v.std_district_student_id,
v.std_grade_code,
v.sub_test,
v.test_date,
v.performance_lvl_code,
v.test_lang_code,
'Y',
NULL,
SYSDATE,
intf_lpa_master_seq.NEXTVAL,
'I',
SYSDATE,
'PRE_PROCESS_LPA - INSERT',
-- c_run_id,
NULL,
v.v_student_id,
v.v_test_id,
v.v_lang_cd,
v.v_plc,
v.valid_test_date,
-- v. school_year,
-- v. school_id,
v.valid_src_stut_id,
v.test_code);
Error Message :
ORA-06553 : PLS-306:wrong number or types of arguments in call to 'V'There are a couple of thngs wrong here. In the when matched insert column list, you cannot qualify the field name with the table alias. It should be just:
insert (std_district_student_id, std_grade_code, sub_test ...)Are v_student_id, v_test_id, v_lang_cd, and v_plc really columns in the intf_lpa_master table? I am more used to seeing v_name as a variable naming convention than a column name, but I could be wrong.
John -
From where we can get error log of delivering state
Hi Experts,
I have processed large file and itseems the message got picked up successfully from sender side and got stucked in deleivering state. Can anyone suggest from where can we get error log that why the message is in delivering state.
I have checked in channel and MM log but nat able to find.
Thanks,
SwethaHi,
You can check in engine status - backlog data in adapter engine in component monitoring.
Please check below link:
[http://help.sap.com/saphelp_nwpi71/helpdata/en/12/5dd23aaad7b3408dde3c1577fda5b3/content.htm]
Regards,
Beena. -
Can you explain this error message with MERGE statement
Here is the code that gives me headache.
I give you the description of the two tables involved and the error message I get when I run a simple MERGE statement
SQL> desc employees
Name Null? Type
EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR2(20)
LAST_NAME NOT NULL VARCHAR2(25)
EMAIL NOT NULL VARCHAR2(25)
PHONE_NUMBER VARCHAR2(20)
HIRE_DATE NOT NULL DATE
JOB_ID NOT NULL VARCHAR2(10)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
SQL> desc emp2
Name Null? Type
EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR2(20)
LAST_NAME VARCHAR2(25)
1 MERGE INTO emp2 e2
2 USING employees e
3 ON (e2.employee_id = e.employee_id)
4 WHEN MATCHED THEN
5 UPDATE SET
6 e2.employee_id = e.employee_id,
7 e2.last_name = e.last_name,
8 e2.first_name = e.first_name
9 WHEN NOT MATCHED THEN
10 INSERT VALUES
11 (e.employee_id,
12 e.last_name,
13* e.first_name)
14 /
ON (e2.employee_id = e.employee_id)
ERROR at line 3:
ORA-00904: "E2"."EMPLOYEE_ID": invalid identifier
Any responce much appreciatedHi,
Columns going to be updated should not be in 'ON clause' , try to delete the line 6 of your query. By the way, there isno sense to update e2.employee_id = e.employee_id when matched, the equality is already verified.
Nicolas. -
ORA 900 error while executing MERGE statement
Hi All,
I am using Oracle 11 Rg1.
I have a summarization process running daily where the process of execution is as follows:-
1. Data loads every 10 min into a transaction table from external dat files
2. I have a package with 13 stored procedures - each procedure has a MERGE logic to summarize data from the above table into a summarization table. Each procedure select data depending on the business requirement
3. A wrapper file is invoked by a crontab daily to execute each procedue in the above package sequentially
4. Each of the 13 procs is executed and data summarized daily into the summarization tables
From a few days, I have been getting a strange error - where 5 of the stored procs are failing with the error code and description as ORA 900 - invalid sql statement. The structure of all the 13 procs is the same. The only difference is in the MERGE logic WHERE clauses.
Due to some data loss occurence I introduced conditions the WHERE clause that take into account pl/sql variables.
I shall paste one procedure here and provide additional details as the discussion progress to avoid making this first post very lengthy.
This logic is failing with ORA 900 when invoked from the wrapper in unix as :-
exec PKG_ODS_AV_SUMMARY.SP_LOAD_ODS_AV_SUMMARY_BYSRCCD(sysdate-1,'');
create or replace PACKAGE PKG_AV_SUMMARY AS
PROCEDURE SP_LOAD_SUMMARY_BYSRCCD (pv_sum_enddate IN DATE, pv_summm_type_indicator IN VARCHAR2);
END PKG_AV_SUMMARY;
create or replace
PACKAGE BODY PKG_AV_SUMMARY AS
--Girish:07June2011 global variables
-- Declaring package variables to hold common constant values
c_status_inprogress VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSTATUS_INPROGRESS');
c_status_success VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSTATUS_SUCCESS');
c_status_failure VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSTATUS_FAILURE');
c_summaryType_fullLoad VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSUMMTYPE_FULL');
c_summaryType_incrementLoad VARCHAR2(50) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSSUMMTYPE_INCR');
c_errordesc_summparamisN VARCHAR2(100) := PKG_SUMMARY_COMMON.FN_GET_CONSTANTVALUE('SUMMARIZATION','ODSSUMMARYPARAMETERSERRORDESC_SUMMPARAMISN');
PROCEDURE SP_LOAD_SUMMARY_BYSRCCD (pv_sum_enddate IN DATE, pv_summm_type_indicator IN VARCHAR2)
AS
lv_table_name VARCHAR2(30) := 'AV_SUMMARY_BYSRCCD';
ln_count NUMBER;
lv_summarizationrequired VARCHAR2(2);
lv_summm_type_indicator VARCHAR2(5);
lv_sum_startdate DATE;
lv_sum_enddate DATE;
lv_partitioned_start_date DATE;
lv_partitioned_end_date DATE;
ln_errorcode NUMBER;
lv_errormsg VARCHAR2(200);
e_exception exception;
BEGIN
-- lv_summm_type_indicator is used as IN OUT parameter for SP_INS_SUMMARY_PARAMETERS procedure.
lv_summm_type_indicator := pv_summm_type_indicator;
PKG_SUMMARY_COMMON.SP_INS_SUMMARY_PARAMETERS(lv_table_name, pv_sum_enddate, lv_summm_type_indicator,
lv_sum_startdate, lv_sum_enddate, ln_errorcode, lv_errormsg);
--raise e_exception;
IF ( lv_errormsg IS NOT NULL or LENGTH(lv_errormsg) <> 0 ) THEN
raise e_exception;
END IF;
lv_summarizationrequired := PKG_SUMMARY_COMMON.FN_fetch_summarizationRequired(lv_table_name);
IF( lv_summarizationrequired = 'Y' ) THEN
BEGIN
IF( lv_summm_type_indicator = c_summaryType_fullLoad) THEN
PKG_SUMMARY_COMMON.SP_FETCH_PARTITION_DATE('ARTICLE_VIEWS',lv_sum_startdate,lv_sum_enddate,lv_partitioned_start_date,lv_partitioned_end_date);
ELSE
lv_partitioned_start_date := lv_sum_startdate;
lv_partitioned_end_date := lv_sum_enddate;
END IF;
MERGE INTO av_summary_bysrccd
USING
(SELECT LAST_DAY(TRUNC(to_timestamp(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))) AS SUMMARY_DATE,
os.acctnum,
ol.sourcecode AS sourcecode,
ol.sourcename AS sourcename,
count(1) cnt_articleview
FROM article_views os , master_sourcecode ol
where os.sourcecode = ol.sourcecode
AND os.acctnum IS NOT NULL
AND ol.sourcecode IS NOT NULL
AND os.requestdatetime IS NOT NULL
AND UPPER(os.success_ind) = 'S'
AND (
(lv_summm_type_indicator = c_summaryType_fullLoad
AND (get_date_timestamp(os.requestdatetime) BETWEEN lv_sum_startdate AND lv_sum_enddate
AND os.entry_CreatedDate BETWEEN lv_partitioned_start_date AND lv_partitioned_end_date
OR (lv_summm_type_indicator = c_summaryType_incrementLoad
AND os.entry_createddate BETWEEN lv_sum_startdate AND lv_sum_enddate )
group by LAST_DAY(TRUNC(to_timestamp(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))),
os.acctnum,ol.sourcecode,ol.sourcename) mrg_query
ON (av_summary_bysrccd.acctnum = mrg_query.acctnum AND
av_summary_bysrccd.summary_date=mrg_query.summary_date AND
av_summary_bysrccd.sourcecode=mrg_query.sourcecode)
WHEN NOT MATCHED THEN
INSERT (SUMMARY_date,ACCTNUM,SOURCECODE,SOURCENAME,CNT_ARTICLEVIEW,ENTRY_LASTUPDATEDDATE)
VALUES(mrg_query.summary_date,mrg_query.acctnum,mrg_query.sourcecode,mrg_query.sourcename,
mrg_query.cnt_articleview,sysdate)
WHEN MATCHED THEN
UPDATE SET ods_av_summary_bysrccd.cnt_articleview=
CASE WHEN NVL(lv_summm_type_indicator,c_summaryType_incrementLoad) = c_summaryType_fullLoad THEN mrg_query.cnt_articleview
ELSE av_summary_bysrccd.cnt_articleview+mrg_query.cnt_articleview
END,
av_summary_bysrccd.entry_lastupdateddate=sysdate;
PKG_SUMMARY_COMMON.SP_UPD_SUMMARY_PARAMETERS(lv_table_name,c_status_inprogress,c_status_success,'');
END;
ELSE
PKG_SUMMARY_COMMON.SP_UPD_SUMMARY_PARAMETERS(lv_table_name,c_status_inprogress,c_status_failure,c_errordesc_summparamisN);
END IF;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
BEGIN
ROLLBACK;
lv_errormsg := SQLERRM;
ln_errorcode := SQLCODE;
ln_count := PKG_SUMMARY_COMMON.FN_GET_COUNTOFTABLEINSUMMPARAM(lv_table_name,c_status_inprogress);
IF ( ln_count <> 0 ) THEN
PKG_SUMMARY_COMMON.SP_UPD_SUMMARY_PARAMETERS(lv_table_name,c_status_inprogress,c_status_failure,lv_errormsg);
END IF;
COMMIT;
raise_application_error(-20004,lv_errormsg);
END;
END SP_LOAD_SUMMARY_BYSRCCD;
END PKG_AV_SUMMARY;Edited by: Chaitanya on Aug 29, 2011 1:56 AM
Edited by: Chaitanya on Aug 29, 2011 2:06 AMHi Sven,
Unfortunately, requestdatetime is a varchar2 column. The source table which has this column had been created a long back and recently we have started to take care of this issue by loading data after converting it into date format.
We have managed to locate the place in the logic where the error is occuring, but not why it might be occuring. Its due to the logic:-
AND (
(lv_summm_type_indicator = c_summaryType_fullLoad
AND (get_date_timestamp(os.requestdatetime) BETWEEN lv_sum_startdate AND lv_sum_enddate
AND os.entry_CreatedDate BETWEEN lv_partitioned_start_date AND lv_partitioned_end_date
OR (lv_summm_type_indicator = c_summaryType_incrementLoad
AND os.entry_createddate BETWEEN lv_sum_startdate AND lv_sum_enddate )
)When I hardcoded the values for lv_summm_type_indicator, c_summaryType_fullLoad and c_summaryType_incrementLoad, the logic worked fine:
AND (
('INCR' = 'FULL'
AND (get_date_timestamp(os.requestdatetime) BETWEEN lv_sum_startdate AND lv_sum_enddate
AND os.entry_CreatedDate BETWEEN lv_partitioned_start_date AND lv_partitioned_end_date
OR ('INCR' = 'INCR'
AND os.entry_createddate BETWEEN lv_sum_startdate AND lv_sum_enddate )
)But, the data for the pl sql variables is coming properly as I used dbms_output statements to check. So not sure what exactly is happening. -
Hello,
Here is the context :
- The DB (10.2) is in production. I can not disable/drop/alter constraints
- I have to reinject thousands of rows from another DB through database link but some of thoses lines may be rejected by the primary key / unique key in the production DB
- As the row number is very large, I do not want to do the following :
<pre>insert into t_prod ( ...)
select ... from t_remote@db_link
where ...
and .. not in (select ... from t_prod where ..)</pre> ;)
As the constraints are UK/PK, I can not use the error logging in insert statement
As the constraints must be kept enabled, I can not use the exceptions into in an alter constraint statement
Is there any way to avoid the infamous not in select ?
Thanks,
Christian.I prefere to use the SQL documentation over the Admin Manual (very personal preference). http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#BGBEIACB
Often it is more clear. In this case:
REJECT LIMIT
This clause lets you specify an integer as an upper limit for the number of errors to be logged before the statement terminates and rolls back any changes made by the statement. The default rejection limit is zero. For parallel DML operations, the reject limit is applied to each parallel server.
A reject limit of 0 would be mean, zero errors are logged before the statement terminates and rolls back.
I agree that this is the same as "no error logging". Good thing you pointed this out, I was not aware of it myself. -
Error executing a stored procedure from SSIS using the MERGE statement between databases
Good morning,
I'm trying to execute from SSIS a stored procedure that compares the content of two tables on different databases in the same server and updates one of them. To perform this action, I've created a stored procedure in the destination database and I'm
comparing the data between tables with the MERGE statement. When I execute the procedure on the destination database the error that I obtain is:
"Msg 916, Level 14, State 1, Procedure RefreshDestinationTable, Line 13
The server principal "XXXX" is not able to access the database "XXXX" under the current security context."
Some things to take in account:
1. I've created a temporary table on the same destination database to check if the problem was on the MERGE statement and it works fine.
2. I've created the procedure with the option "WITH EXECUTE AS DBO".
I've read that it can be a problem of permissions but I don't know if I'm executing the procedure from SSIS to which user/login I should give permissions and which.
Could you give me some tip to continue investigating how to solve the problem?
Thank you,
VirgilioRead Erland's article http://www.sommarskog.se/grantperm.html
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Getting an error in MERGE statement
Hi,
I am getting an error "missing keyword" when I execute the MERGE statement.
Here I have attached copy of MERGE statement which I am trying to execute.
(My requirement is if I find matching record then insert again it's a business requirement. And if not then set flag)
MERGE INTO t1
USING t2
ON (conditions)
WHEN MATCHED THEN
INSERT (column list from t1)
VALUES (from t2)
WHEN NOT MATCHED THEN
UPDATE
SET ... ;
Can someone guide me?
Thanks,This is why I told you yesterday in this thread...
Need suggestion in MERGE Statement
...that what you're asking is the opposite of the way MERGE works.
Guess you didn't want to believe me. -
ORA-02291 - ORA-02063 on merge with dml error logging through DB link
Hello all,
I have 2 DB's and I would like to merge records from A into B with dml error logging through a db link.
Exemple:
merge into B@dblink
using (select ... from A where...)
when matched then
when not matched then
log errors into err$_A reject limit unlimited;
When I use this, and exception is thrown:
ORA-02291: integrity constraint (B.constraint_name) violated - parent key not found
ORA-02063: preceding line from dblink
I've got no idea of what causes this.
Could anyone please help me ?
Thanks !
Regards,
TDE.Hello damorgan,
Thanks for your answer.
I've well understood that its was a foreign key violation, and I guess that's an error in the source: wee make only logical deletes, and I'm quite sure the problem is there.
Anyway, I really would understand why dml error logging doesn't work in this case.
I'll investigate and keep you informed.
Regards. -
DML ERROR LOGGING STATEMENT FAILS FOR MULTITABLE INSERT
When I use a simple expression in my dml error logging statement for a multitable insert I get 'end of file on communication channel' on the compile(in all guis tested). It works fine without the simple expression for the multitable insert. The simple expression works ok with a single table insert.
example:
this works ok for single table insert and blows up on multitable inserts:
LOG ERRORS INTO ERR$_INVOICE (TO_CHAR(SYSDATE,'YYYYMMDD HH:MI:SS')) REJECT LIMIT UNLIMITED;
this works ok for both:
LOG ERRORS INTO ERR$_CINVOICE REJECT LIMIT UNLIMITED;
any ideas?No version number, no DDl, and no DML. No help is possible.
Complete version information and a demo that people can run to duplicate your situation will increase the chance of getting help.
I, for example, have no idea what you intend with the statement multitable insert. Is this a reference to INSERT ALL or INSERT FIRST or some other syntax? -
I see this error: Error: 3624, Severity: 20, State: 1
Complete error in the error log is:
SQL Server Assertion: File: <loglock.cpp>, line=807 Failed Assertion = 'result == LCK_OK'. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check the database for structural integrity, or restart
the server to ensure in-memory data structures are not corrupted.
SQL Server 2008 R2 with Service pack 2 installed and mirrored.
I see this error in the sql server dump file:
0:000> .ecxr
rax=00000000676a7a6a rbx=0000000003fd3250 rcx=000000001048aaa0
rdx=0000000000000000 rsi=0000000003bbef3c rdi=0000000000000440
rip=000007fefd10940d rsp=000000001048b0b0 rbp=000000001048ca50
r8=0000000000000000 r9=0000000000000000 r10=00000000c000007c
r11=00000000012e98d0 r12=00000000000007c0 r13=0000000000000000
r14=0000000000000000 r15=00000000000007c0
iopl=0 nv up ei pl nz na po nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000206
KERNELBASE!RaiseException+0x39:
000007fe`fd10940d 4881c4c8000000 add rsp,0C8h
0:000> kC 1000
Call Site
KERNELBASE!RaiseException
sqlservr!CDmpDump::Dump
sqlservr!SQLDumperLibraryInvoke
sqlservr!CImageHelper::DoMiniDump
sqlservr!stackTrace
sqlservr!utassert_fail
sqlservr!LogLockCollectionAcquire::Callback
sqlservr!LogLockCollection::ApplyLocks
sqlservr!LogLockCollection::Acquire
sqlservr!DBMRedoManager::AnalyzeLogRecord
sqlservr!DBMRedoManager::RunAnalysis
sqlservr!DBMRedoManager::ApplyLogSegment
sqlservr!DBMRedoManager::Execute
sqlservr!SubprocEntrypoint
sqlservr!SOS_Task::Param::Execute
sqlservr!SOS_Scheduler::RunTask
sqlservr!SOS_Scheduler::ProcessTasks
sqlservr!SchedulerManager::WorkerEntryPoint
sqlservr!SystemThread::RunWorker
sqlservr!SystemThreadDispatcher::ProcessWorker
sqlservr!SchedulerManager::ThreadEntryPoint
msvcr80!endthreadex
msvcr80!endthreadex
kernel32!BaseThreadInitThunk
ntdll!RtlUserThreadStart
Not sure what to infer from this. Any help would be appreciated.
Let me know if more info. is needed.
Thanks !!!I did not have a chance to run that at the time the error happened, now everything is normal. Do you have any idea on what this means?
sqlservr!LogLockCollectionAcquire::Callback
I suggest you to run full DBCC CHECKDB , like I said assertion errors are basically related to Internal SQL Server problem
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Wiki Article
MVP
Maybe you are looking for
-
Time-out problems with RV320 (after upgrade from RV042)
config: dual wan WAN1: 4G router (DHCP) - approx 25Mbit/ 8Mbit WAN2: PPOE (DSL) - 1 Mbit/ 0.2 Mbit worked with a RV042 before and upgraded to a RV320 now. all other things are unchanged. 3 problems - 2 solved/ not critical - one still open: a) not cr
-
Dear all, What is the process in dealing with post dated cheque received? Configuration steps please guide me. Will award points Reg Kris
-
Hi, I want to have a hyperlink to a module (not a html <a href > link) in a nice format (fully justified) in a sentence. I tried using <mx:TextArray> and <mx:Text> but I have to break a sentence into several texts and adjust width of each item, and s
-
How to append text to jtextpane
i want to append the text to jtextpane,but i can't find the append() method like in jtextarea , is there any way to append the text to jtextpane
-
Loading images into text field - links problem
Hello, I use AS3 and I load external text from XML to the text field created manually. External text includes hyperlinks and <img> tags. The problem is if I load more than 1 image this way , my links no longer work. They work if I load only 1 image..