Help on MERGE - update or insert problem
Dear Everybody,
I've a DB with 3 tables to serve for Staff Time Attendance purpose, table tbl_TimeSheetIn(EmpCode, CardID, DateClock, TimeClock) using for input RAW text file exported from TimeMachine, the same for tbl_TimeSheetOut (EmpCode, CardID, DateClock, TimeClock).
Noted that we may have over 2 record with same EmpCode, CardID, DateClock (but different TimeClock) due to Staff can have admin shift or split shift (in, out 2 times/day).
Then I will import them to table tbl_TimeSheet(EmpCode, CardID, DateWork, TimeIn, TimeOut) for reporting purpose.
Firstly I insert all the records in tbl_TimeSheetIn to tbl_TimeSheet, it was import successful. Then when I using MERGE to update (if exist records with same CardID and TimeIn then update TimeOut to tbl_TimeSheet) / or insert (if not exist).
The MS SQL Server 2008 R2 told me that error : "sql merge cannot update the same row of the target table multiple times..."
Please help me to overcome.
Thanks.
Dear All,
I'm not really clear on your answers, please correct me if I'm posting wrong:
1/ Table TimeSheet SQL create:
CREATE TABLE [dbo].[tbl_Timesheet](
[EmpCode] [varchar](15) NOT NULL,
[FullName] [varchar](255) NULL,
[CardID] [varchar](50) NULL,
[DateWork] [datetime] NULL,
[ShiftCode] [varchar](15) NULL,
[TimeIn] [varchar](50) NULL,
[TimeOut] [varchar](50) NULL,
[TimeIn1] [varchar](50) NULL,
[TimeOut1] [varchar](50) NULL,
[GetData] [bit] NULL,
[Machine] [varchar](2) NULL,
[DayWork] [numeric](18, 0) NULL,
[TimeWork] [decimal](18, 2) NULL,
[OT] [decimal](18, 2) NULL,
[OTCheck] [bit] NULL,
[TimeOverKind] [varchar](50) NULL,
[PH] [bit] NULL,
[SplitShift] [bit] NULL,
[NightHours] [numeric](18, 0) NULL,
[NightShift] [bit] NULL,
[PersonCreate] [varchar](50) NULL,
[DateCreate] [datetime] NULL,
[PersonUpdate] [varchar](50) NULL,
[DateUpdate] [datetime] NULL,
[PersonDelete] [varchar](50) NULL,
[DateDelete] [datetime] NULL,
[Status] [char](1) NULL,
[RepairNight] [bit] NULL
) ON [PRIMARY]
2/ Insert into table TimeSheet:
INSERT INTO [galaxy].[dbo].[tbl_Timesheet]
([EmpCode]
,[FullName]
,[CardID]
,[DateWork]
,[ShiftCode]
,[TimeIn]
,[TimeOut]
,[TimeIn1]
,[TimeOut1]
,[GetData]
,[Machine]
,[DayWork]
,[TimeWork]
,[OT]
,[OTCheck]
,[TimeOverKind]
,[PH]
,[SplitShift]
,[NightHours]
,[NightShift]
,[PersonCreate]
,[DateCreate]
,[PersonUpdate]
,[DateUpdate]
,[PersonDelete]
,[DateDelete]
,[Status]
,[RepairNight])
VALUES
(<EmpCode, varchar(15),>
,<FullName, varchar(255),>
,<CardID, varchar(50),>
,<DateWork, datetime,>
,<ShiftCode, varchar(15),>
,<TimeIn, varchar(50),>
,<TimeOut, varchar(50),>
,<TimeIn1, varchar(50),>
,<TimeOut1, varchar(50),>
,<GetData, bit,>
,<Machine, varchar(2),>
,<DayWork, numeric(18,0),>
,<TimeWork, decimal(18,2),>
,<OT, decimal(18,2),>
,<OTCheck, bit,>
,<TimeOverKind, varchar(50),>
,<PH, bit,>
,<SplitShift, bit,>
,<NightHours, numeric(18,0),>
,<NightShift, bit,>
,<PersonCreate, varchar(50),>
,<DateCreate, datetime,>
,<PersonUpdate, varchar(50),>
,<DateUpdate, datetime,>
,<PersonDelete, varchar(50),>
,<DateDelete, datetime,>
,<Status, char(1),>
,<RepairNight, bit,>)
GO
3/ Create table TimeSheetIN: (the table TimeSheetOUT is the same structure)
CREATE TABLE [dbo].[tbl_TimeSheetIn](
[EmpCode] [varchar](50) NULL,
[FullName] [varchar](255) NULL,
[CardID] [varchar](50) NULL,
[Shift] [varchar](50) NULL,
[In] [varchar](50) NULL,
[DateClock] [datetime] NULL,
[TimeClock] [nvarchar](50) NULL,
[Machine] [nvarchar](50) NULL,
[SplipShift] [bit] NULL,
[NightShift] [bit] NULL,
[Status] [bit] NULL
) ON [PRIMARY]
4/ Sample TIME-IN RAW data saved by TimeMachine:
The first and last "01" is meaning 01= TimeMachineIN, 02 = TimeMachineOUT
The second "08/08/2014-hour:minute" is the timestamp.
The third field "056754" is the Card ID that swiped to the TimeMachine.
01-08/08/2014-03:45-056754-000-01
01-08/08/2014-04:42-040728-000-01
01-08/08/2014-04:51-057669-000-01
01-08/08/2014-04:55-031901-000-01
01-08/08/2014-05:04-043041-000-01
01-08/08/2014-05:06-000009-000-01
01-08/08/2014-05:06-000009-000-01
01-08/08/2014-05:06-000009-000-01
01-08/08/2014-05:07-053475-000-01
01-08/08/2014-05:07-052484-000-01
01-08/08/2014-05:10-052903-000-01
01-08/08/2014-05:14-003793-000-01
01-08/08/2014-05:14-041943-000-01
01-08/08/2014-05:17-054198-000-01
01-08/08/2014-05:22-063167-000-01
01-08/08/2014-05:22-063167-000-01
01-08/08/2014-05:22-011222-000-01
01-08/08/2014-05:24-063456-000-01
01-08/08/2014-05:25-003774-000-01
01-08/08/2014-05:26-013766-000-01
01-08/08/2014-05:28-050486-000-01
01-08/08/2014-05:28-004848-000-01
01-08/08/2014-05:28-002451-000-01
01-08/08/2014-05:30-003081-000-01
01-08/08/2014-05:31-042905-001-01
01-08/08/2014-05:32-052972-001-01
01-08/08/2014-05:33-052784-001-01
01-08/08/2014-05:33-006167-001-01
01-08/08/2014-05:34-059076-001-01
01-08/08/2014-05:35-062392-001-01
01-08/08/2014-05:35-055203-001-01
01-08/08/2014-05:39-008412-001-01
01-08/08/2014-05:40-001304-001-01
01-08/08/2014-05:40-000425-001-01
01-08/08/2014-05:40-041020-001-01
01-08/08/2014-05:40-004425-001-01
01-08/08/2014-05:41-005730-001-01
01-08/08/2014-05:41-000150-001-01
01-08/08/2014-05:41-039497-001-01
01-08/08/2014-05:42-020359-001-01
01-08/08/2014-05:44-002768-001-01
01-08/08/2014-05:46-008554-001-01
01-08/08/2014-05:47-062433-001-01
01-08/08/2014-05:49-057113-001-01
01-08/08/2014-05:50-008897-000-01
01-08/08/2014-05:51-063289-000-01
01-08/08/2014-05:52-063094-000-01
01-08/08/2014-05:52-056876-000-01
01-08/08/2014-05:56-000623-000-01
01-08/08/2014-05:57-057709-000-01
01-08/08/2014-05:58-059140-000-01
01-08/08/2014-05:59-060519-000-01
01-08/08/2014-05:59-043165-000-01
01-08/08/2014-06:01-031229-000-01
01-08/08/2014-06:04-051997-000-01
01-08/08/2014-06:07-028859-000-01
01-08/08/2014-06:10-032838-000-01
01-08/08/2014-06:10-002286-000-01
01-08/08/2014-06:11-058050-000-01
01-08/08/2014-06:12-001798-000-01
01-08/08/2014-06:15-030404-000-01
01-08/08/2014-06:18-059036-000-01
01-08/08/2014-06:21-058131-000-01
01-08/08/2014-06:22-018613-000-01
01-08/08/2014-06:23-054936-000-01
01-08/08/2014-06:26-033243-000-01
01-08/08/2014-06:26-054015-000-01
01-08/08/2014-06:27-063110-000-01
01-08/08/2014-06:28-055311-000-01
01-08/08/2014-06:28-034760-000-01
01-08/08/2014-06:31-061295-000-01
01-08/08/2014-06:32-058615-000-01
01-08/08/2014-06:33-000102-000-01
01-08/08/2014-06:33-021545-000-01
01-08/08/2014-06:33-054996-000-01
01-08/08/2014-06:34-048489-000-01
01-08/08/2014-06:36-014041-000-01
01-08/08/2014-06:36-048227-000-01
01-08/08/2014-06:40-065214-000-01
01-08/08/2014-06:43-007016-000-01
01-08/08/2014-06:45-023272-000-01
01-08/08/2014-06:46-032925-000-01
01-08/08/2014-06:47-025179-000-01
01-08/08/2014-06:48-064937-000-01
01-08/08/2014-06:50-050279-000-01
01-08/08/2014-06:51-049712-000-01
01-08/08/2014-06:52-033507-000-01
01-08/08/2014-06:55-041976-000-01
01-08/08/2014-06:55-005446-000-01
01-08/08/2014-06:56-063172-000-01
01-08/08/2014-06:58-063867-000-01
01-08/08/2014-07:01-019547-000-01
01-08/08/2014-07:01-019547-000-01
01-08/08/2014-07:02-016590-000-01
01-08/08/2014-07:02-056763-000-01
01-08/08/2014-07:03-027498-000-01
01-08/08/2014-07:07-051058-000-01
01-08/08/2014-07:10-051587-001-01
01-08/08/2014-07:10-053394-001-01
01-08/08/2014-07:11-045334-001-01
01-08/08/2014-07:13-038671-001-01
01-08/08/2014-07:13-005557-001-01
01-08/08/2014-07:14-064639-001-01
01-08/08/2014-07:14-032678-001-01
01-08/08/2014-07:15-061645-001-01
01-08/08/2014-07:16-003595-001-01
01-08/08/2014-07:17-050347-001-01
01-08/08/2014-07:17-053350-001-01
01-08/08/2014-07:17-014524-001-01
01-08/08/2014-07:18-010926-001-01
01-08/08/2014-07:18-048403-001-01
01-08/08/2014-07:18-050532-001-01
01-08/08/2014-07:19-047985-001-01
01-08/08/2014-07:20-061195-001-01
01-08/08/2014-07:21-061436-001-01
01-08/08/2014-07:21-016390-001-01
01-08/08/2014-07:22-016390-001-01
01-08/08/2014-07:22-016390-001-01
01-08/08/2014-07:22-057759-001-01
01-08/08/2014-07:23-054787-001-01
01-08/08/2014-07:23-059724-001-01
01-08/08/2014-07:24-052044-001-01
01-08/08/2014-07:24-049546-001-01
01-08/08/2014-07:24-027477-001-01
01-08/08/2014-07:26-048695-001-01
01-08/08/2014-07:27-046872-001-01
01-08/08/2014-07:27-050108-001-01
01-08/08/2014-07:27-059403-001-01
01-08/08/2014-07:27-013749-001-01
01-08/08/2014-07:27-060240-001-01
01-08/08/2014-07:27-056000-001-01
01-08/08/2014-07:27-038821-001-01
01-08/08/2014-07:27-050474-001-01
01-08/08/2014-07:28-061648-001-01
01-08/08/2014-07:28-057240-001-01
01-08/08/2014-07:31-061966-001-01
01-08/08/2014-07:32-051497-001-01
01-08/08/2014-07:32-054737-001-01
01-08/08/2014-07:32-052703-001-01
01-08/08/2014-07:32-064745-001-01
01-08/08/2014-07:33-054460-001-01
01-08/08/2014-07:33-054737-001-01
01-08/08/2014-07:34-055981-001-01
01-08/08/2014-07:35-055981-001-01
01-08/08/2014-07:35-055981-001-01
01-08/08/2014-07:35-045137-001-01
01-08/08/2014-07:35-051481-001-01
01-08/08/2014-07:35-051481-001-01
01-08/08/2014-07:36-065152-001-01
01-08/08/2014-07:37-058405-001-01
01-08/08/2014-07:37-029877-001-01
01-08/08/2014-07:37-052475-001-01
01-08/08/2014-07:37-051129-001-01
01-08/08/2014-07:37-045677-001-01
01-08/08/2014-07:38-041931-001-01
01-08/08/2014-07:38-050680-001-01
01-08/08/2014-07:38-040996-001-01
01-08/08/2014-07:38-059372-001-01
01-08/08/2014-07:39-027264-001-01
01-08/08/2014-07:39-003033-001-01
01-08/08/2014-07:39-014569-001-01
01-08/08/2014-07:40-063698-001-01
01-08/08/2014-07:40-003634-001-01
01-08/08/2014-07:43-007651-001-01
01-08/08/2014-07:43-045060-001-01
01-08/08/2014-07:44-038222-001-01
01-08/08/2014-07:44-047332-001-01
01-08/08/2014-07:45-006906-001-01
01-08/08/2014-07:45-006906-001-01
01-08/08/2014-07:45-046651-001-01
01-08/08/2014-07:45-039297-001-01
01-08/08/2014-07:48-045246-001-01
01-08/08/2014-07:48-053924-001-01
01-08/08/2014-07:50-003076-001-01
01-08/08/2014-07:51-055873-001-01
01-08/08/2014-07:52-050955-001-01
01-08/08/2014-07:52-001166-001-01
01-08/08/2014-07:52-035073-001-01
01-08/08/2014-07:52-055622-001-01
01-08/08/2014-07:53-027282-001-01
01-08/08/2014-07:53-048704-001-01
01-08/08/2014-07:54-004748-001-01
01-08/08/2014-07:55-038200-001-01
01-08/08/2014-07:55-051753-001-01
01-08/08/2014-07:56-054934-001-01
01-08/08/2014-07:56-061067-001-01
01-08/08/2014-07:57-057270-001-01
01-08/08/2014-07:57-060981-001-01
01-08/08/2014-07:57-023918-001-01
01-08/08/2014-07:58-047387-001-01
01-08/08/2014-08:00-052597-001-01
01-08/08/2014-08:00-045822-001-01
01-08/08/2014-08:00-048454-001-01
01-08/08/2014-08:01-050857-001-01
01-08/08/2014-08:02-033425-001-01
01-08/08/2014-08:02-063120-001-01
01-08/08/2014-08:03-018354-001-01
01-08/08/2014-08:03-047112-001-01
01-08/08/2014-08:08-058460-001-01
01-08/08/2014-08:20-005220-001-01
01-08/08/2014-08:30-004555-001-01
01-08/08/2014-08:32-017684-001-01
01-08/08/2014-08:35-017731-001-01
01-08/08/2014-08:39-002712-001-01
01-08/08/2014-08:44-047975-001-01
01-08/08/2014-08:46-057662-001-01
01-08/08/2014-08:46-063944-001-01
01-08/08/2014-08:55-059774-000-01
01-08/08/2014-09:03-010054-000-01
01-08/08/2014-09:10-020059-000-01
01-08/08/2014-09:14-042237-000-01
01-08/08/2014-09:18-022890-000-01
01-08/08/2014-09:28-023631-000-01
01-08/08/2014-09:31-015077-000-01
01-08/08/2014-09:34-008631-000-01
01-08/08/2014-09:36-049989-000-01
01-08/08/2014-09:38-060644-000-01
01-08/08/2014-09:42-057517-000-01
01-08/08/2014-09:43-027757-000-01
01-08/08/2014-09:45-052521-000-01
01-08/08/2014-09:46-049662-000-01
01-08/08/2014-09:48-032028-000-01
01-08/08/2014-09:49-001324-000-01
01-08/08/2014-09:49-056744-000-01
01-08/08/2014-09:49-028800-000-01
01-08/08/2014-09:55-005286-000-01
01-08/08/2014-10:03-054784-000-01
01-08/08/2014-10:07-019507-000-01
01-08/08/2014-10:08-025898-000-01
01-08/08/2014-10:14-060406-000-01
01-08/08/2014-10:14-007510-000-01
01-08/08/2014-10:16-059298-000-01
01-08/08/2014-10:20-034286-000-01
01-08/08/2014-10:21-034091-000-01
01-08/08/2014-10:21-045028-000-01
01-08/08/2014-10:28-055300-000-01
01-08/08/2014-10:33-005604-000-01
01-08/08/2014-10:38-005905-000-01
01-08/08/2014-10:38-064865-000-01
01-08/08/2014-10:41-025212-000-01
01-08/08/2014-10:48-041915-000-01
01-08/08/2014-10:51-051505-000-01
01-08/08/2014-10:53-019945-000-01
01-08/08/2014-11:07-041655-000-01
01-08/08/2014-11:19-014515-000-01
01-08/08/2014-11:26-049413-000-01
01-08/08/2014-11:27-062044-000-01
01-08/08/2014-11:28-049233-000-01
01-08/08/2014-11:42-026640-000-01
01-08/08/2014-11:47-064359-000-01
01-08/08/2014-11:48-007078-000-01
01-08/08/2014-11:52-048103-000-01
01-08/08/2014-11:53-014852-000-01
01-08/08/2014-12:01-026113-000-01
01-08/08/2014-12:01-008824-000-01
01-08/08/2014-12:01-052499-000-01
01-08/08/2014-12:04-041278-000-01
01-08/08/2014-12:31-005443-000-01
01-08/08/2014-12:32-053289-000-01
01-08/08/2014-12:36-060865-000-01
01-08/08/2014-12:39-030586-000-01
01-08/08/2014-12:41-055094-000-01
01-08/08/2014-12:48-050863-000-01
01-08/08/2014-12:49-036761-000-01
01-08/08/2014-12:51-053258-000-01
01-08/08/2014-12:55-046322-000-01
01-08/08/2014-13:00-058606-000-01
01-08/08/2014-13:04-029842-000-01
01-08/08/2014-13:05-008027-000-01
01-08/08/2014-13:07-064275-000-01
01-08/08/2014-13:07-055346-000-01
01-08/08/2014-13:08-006385-000-01
01-08/08/2014-13:09-010322-000-01
01-08/08/2014-13:14-009055-000-01
01-08/08/2014-13:16-021256-000-01
01-08/08/2014-13:17-007973-000-01
01-08/08/2014-13:21-024016-000-01
01-08/08/2014-13:23-015629-000-01
01-08/08/2014-13:23-048406-000-01
01-08/08/2014-13:26-049452-000-01
01-08/08/2014-13:27-057269-000-01
01-08/08/2014-13:27-018685-000-01
01-08/08/2014-13:28-005590-000-01
01-08/08/2014-13:31-000381-000-01
01-08/08/2014-13:31-033454-000-01
01-08/08/2014-13:35-063564-000-01
01-08/08/2014-13:35-032226-000-01
01-08/08/2014-13:35-048433-000-01
01-08/08/2014-13:36-042137-000-01
01-08/08/2014-13:38-060938-000-01
01-08/08/2014-13:39-041270-000-01
01-08/08/2014-13:40-064443-000-01
01-08/08/2014-13:40-055690-000-01
01-08/08/2014-13:40-000687-000-01
01-08/08/2014-13:41-055236-000-01
01-08/08/2014-13:43-058536-000-01
01-08/08/2014-13:43-062012-000-01
01-08/08/2014-13:43-062012-000-01
01-08/08/2014-13:44-056544-000-01
01-08/08/2014-13:45-046377-000-01
01-08/08/2014-13:47-051446-000-01
01-08/08/2014-13:47-010440-000-01
01-08/08/2014-13:48-031836-000-01
01-08/08/2014-13:48-031836-000-01
01-08/08/2014-13:51-054780-000-01
01-08/08/2014-13:51-054780-000-01
01-08/08/2014-13:53-057966-000-01
01-08/08/2014-13:55-054056-000-01
01-08/08/2014-13:59-037241-000-01
01-08/08/2014-14:00-055587-000-01
01-08/08/2014-14:00-061113-000-01
01-08/08/2014-14:02-012158-000-01
01-08/08/2014-14:03-023550-000-01
01-08/08/2014-14:04-003850-000-01
01-08/08/2014-14:05-034102-000-01
01-08/08/2014-14:07-004271-000-01
01-08/08/2014-14:09-051288-000-01
01-08/08/2014-14:11-023683-000-01
01-08/08/2014-14:11-042140-000-01
01-08/08/2014-14:13-063106-000-01
01-08/08/2014-14:15-029901-000-01
01-08/08/2014-14:22-052273-000-01
01-08/08/2014-14:22-043073-000-01
01-08/08/2014-14:25-001497-000-01
01-08/08/2014-14:25-042960-000-01
01-08/08/2014-14:28-049727-000-01
01-08/08/2014-14:30-046112-000-01
01-08/08/2014-14:31-059973-000-01
01-08/08/2014-14:32-014674-000-01
01-08/08/2014-14:33-032273-000-01
01-08/08/2014-14:33-063760-000-01
01-08/08/2014-14:34-004670-000-01
01-08/08/2014-14:35-058519-000-01
01-08/08/2014-14:37-003641-000-01
01-08/08/2014-14:38-064434-000-01
01-08/08/2014-14:38-033137-000-01
01-08/08/2014-14:38-033137-000-01
01-08/08/2014-14:38-063678-000-01
01-08/08/2014-14:39-002798-000-01
01-08/08/2014-14:41-058884-000-01
01-08/08/2014-14:41-005746-000-01
01-08/08/2014-14:42-048181-000-01
01-08/08/2014-14:46-045659-000-01
01-08/08/2014-14:46-054010-000-01
01-08/08/2014-14:47-011094-000-01
01-08/08/2014-14:50-001699-000-01
01-08/08/2014-14:58-007854-000-01
01-08/08/2014-15:15-055981-000-01
01-08/08/2014-15:33-046290-000-01
01-08/08/2014-15:39-035301-000-01
01-08/08/2014-16:16-041655-000-01
01-08/08/2014-16:16-051505-000-01
01-08/08/2014-16:18-050966-000-01
01-08/08/2014-16:19-055651-000-01
01-08/08/2014-16:20-027757-000-01
01-08/08/2014-16:25-023631-000-01
01-08/08/2014-16:27-003052-000-01
01-08/08/2014-16:27-015077-000-01
01-08/08/2014-16:28-049989-000-01
01-08/08/2014-16:32-002895-000-01
01-08/08/2014-16:45-058424-000-01
01-08/08/2014-16:49-027264-000-01
01-08/08/2014-16:55-064582-000-01
01-08/08/2014-16:57-034286-000-01
01-08/08/2014-16:58-032028-000-01
01-08/08/2014-17:14-056744-000-01
01-08/08/2014-17:18-013766-000-01
01-08/08/2014-17:27-025898-000-01
01-08/08/2014-17:27-007510-000-01
01-08/08/2014-17:30-050108-000-01
01-08/08/2014-17:33-059298-000-01
01-08/08/2014-17:49-045028-000-01
01-08/08/2014-17:54-034091-000-01
01-08/08/2014-21:03-047660-000-01
01-08/08/2014-21:07-050663-000-01
01-08/08/2014-21:14-064154-000-01
01-08/08/2014-21:16-059488-000-01
01-08/08/2014-21:17-058243-000-01
01-08/08/2014-21:25-059314-000-01
01-08/08/2014-21:25-053258-000-01
01-08/08/2014-21:28-018754-000-01
01-08/08/2014-21:29-049408-000-01
01-08/08/2014-21:29-049408-000-01
01-08/08/2014-21:30-014785-000-01
01-08/08/2014-21:35-060117-000-01
01-08/08/2014-21:40-000256-000-01
01-08/08/2014-21:40-000256-000-01
01-08/08/2014-21:40-000256-000-01
01-08/08/2014-21:42-048110-000-01
01-08/08/2014-21:46-055346-000-01
01-08/08/2014-21:46-051083-000-01
01-08/08/2014-21:47-008129-000-01
01-08/08/2014-21:47-008129-000-01
01-08/08/2014-21:54-002058-000-01
01-08/08/2014-21:54-050422-000-01
01-08/08/2014-21:56-013855-000-01
01-08/08/2014-21:59-052616-000-01
01-08/08/2014-22:01-006197-000-01
01-08/08/2014-22:01-060957-000-01
01-08/08/2014-22:02-031397-000-01
01-08/08/2014-22:03-054986-000-01
01-08/08/2014-22:04-056055-000-01
01-08/08/2014-22:04-045991-000-01
01-08/08/2014-22:12-064878-000-01
01-08/08/2014-22:15-032722-000-01
01-08/08/2014-22:16-063895-000-01
01-08/08/2014-22:31-058007-000-01
01-08/08/2014-22:43-017464-000-01
5/ Sample TIME-OUT Raw data saved by TimeMachine:
02-08/08/2014-00:02-043073-000-02
02-08/08/2014-00:02-001497-000-02
02-08/08/2014-00:03-053573-000-02
02-08/08/2014-00:05-052929-000-02
02-08/08/2014-00:07-035301-000-02
02-08/08/2014-00:07-035301-000-02
02-08/08/2014-00:11-041278-000-02
02-08/08/2014-00:16-001699-000-02
02-08/08/2014-00:21-023272-000-02
02-08/08/2014-00:29-055867-000-02
02-08/08/2014-00:33-063678-000-02
02-08/08/2014-00:34-003052-000-02
02-08/08/2014-00:34-010054-000-02
02-08/08/2014-00:34-063760-000-02
02-08/08/2014-00:53-011094-000-02
02-08/08/2014-00:58-058424-000-02
02-08/08/2014-01:15-055921-000-02
02-08/08/2014-01:19-055651-000-02
02-08/08/2014-06:17-026526-000-02
02-08/08/2014-06:23-050663-000-02
02-08/08/2014-06:25-053258-000-02
02-08/08/2014-06:31-018008-000-02
02-08/08/2014-06:34-002058-000-02
02-08/08/2014-06:40-050422-000-02
02-08/08/2014-06:40-059314-000-02
02-08/08/2014-06:40-059314-000-02
02-08/08/2014-06:48-048110-000-02
02-08/08/2014-06:48-060117-000-02
02-08/08/2014-06:51-052005-000-02
02-08/08/2014-06:54-058243-000-02
02-08/08/2014-06:54-049408-000-02
02-08/08/2014-06:59-023134-000-02
02-08/08/2014-07:08-056055-000-02
02-08/08/2014-07:30-013855-000-02
02-08/08/2014-07:31-060957-000-02
02-08/08/2014-07:33-054986-000-02
02-08/08/2014-07:33-006197-000-02
02-08/08/2014-07:34-034788-000-02
02-08/08/2014-07:39-063895-000-02
02-08/08/2014-07:39-029825-000-02
02-08/08/2014-07:40-058007-000-02
02-08/08/2014-07:41-031397-000-02
02-08/08/2014-07:41-064878-000-02
02-08/08/2014-07:42-045991-000-02
02-08/08/2014-07:43-031053-000-02
02-08/08/2014-07:47-002308-000-02
02-08/08/2014-07:52-032722-000-02
02-08/08/2014-08:40-008660-000-02
02-08/08/2014-11:17-013766-000-02
02-08/08/2014-11:50-018354-000-02
02-08/08/2014-12:33-056754-000-02
02-08/08/2014-13:32-050108-000-02
02-08/08/2014-13:33-052597-000-02
02-08/08/2014-14:02-023631-000-02
02-08/08/2014-14:03-032028-000-02
02-08/08/2014-14:05-015077-000-02
02-08/08/2014-14:11-056744-000-02
02-08/08/2014-14:11-040728-000-02
02-08/08/2014-14:12-020359-000-02
02-08/08/2014-14:14-027757-000-02
02-08/08/2014-14:15-049989-000-02
02-08/08/2014-14:16-062433-000-02
02-08/08/2014-14:18-000150-000-02
02-08/08/2014-14:20-052784-000-02
02-08/08/2014-14:21-003081-000-02
02-08/08/2014-14:23-041943-000-02
02-08/08/2014-14:26-002768-000-02
02-08/08/2014-14:27-055203-000-02
02-08/08/2014-14:32-059076-000-02
02-08/08/2014-14:32-062392-000-02
02-08/08/2014-14:32-052972-000-02
02-08/08/2014-14:33-007510-000-02
02-08/08/2014-14:33-045028-000-02
02-08/08/2014-14:33-034091-000-02
02-08/08/2014-14:34-025898-000-02
02-08/08/2014-14:34-063456-000-02
02-08/08/2014-14:34-043041-000-02
02-08/08/2014-14:34-034286-000-02
02-08/08/2014-14:35-034091-000-02
02-08/08/2014-14:35-059298-000-02
02-08/08/2014-14:42-063289-000-02
02-08/08/2014-14:42-056876-000-02
02-08/08/2014-14:42-052484-000-02
02-08/08/2014-14:44-008897-000-02
02-08/08/2014-14:45-005604-000-02
02-08/08/2014-14:46-002286-000-02
02-08/08/2014-14:46-063167-000-02
02-08/08/2014-14:46-063167-000-02
02-08/08/2014-14:47-004425-000-02
02-08/08/2014-14:47-052824-000-02
02-08/08/2014-14:48-003793-000-02
02-08/08/2014-14:48-042905-000-02
02-08/08/2014-14:48-057669-000-02
02-08/08/2014-14:50-057113-000-02
02-08/08/2014-14:50-057113-000-02
02-08/08/2014-14:51-000623-000-02
02-08/08/2014-14:52-051997-000-02
02-08/08/2014-14:52-054936-000-02
02-08/08/2014-14:54-006167-000-02
02-08/08/2014-14:55-008412-000-02
02-08/08/2014-14:59-005446-000-02
02-08/08/2014-15:01-064275-000-02
02-08/08/2014-15:01-050486-000-02
02-08/08/2014-15:03-043165-000-02
02-08/08/2014-15:04-063110-000-02
02-08/08/2014-15:05-000102-000-02
02-08/08/2014-15:05-006385-000-02
02-08/08/2014-15:05-053258-000-02
02-08/08/2014-15:07-000425-000-02
02-08/08/2014-15:08-048489-000-02
02-08/08/2014-15:10-033507-000-02
02-08/08/2014-15:13-030404-000-02
02-08/08/2014-15:14-058050-000-02
02-08/08/2014-15:15-055981-000-02
02-08/08/2014-15:15-008554-000-02
02-08/08/2014-15:16-054015-000-02
02-08/08/2014-15:16-005730-000-02
02-08/08/2014-15:16-057709-000-02
02-08/08/2014-15:16-058131-000-02
02-08/08/2014-15:17-041020-000-02
02-08/08/2014-15:17-001304-000-02
02-08/08/2014-15:18-049546-000-02
02-08/08/2014-15:18-051505-000-02
02-08/08/2014-15:18-041655-000-02
02-08/08/2014-15:19-061295-000-02
02-08/08/2014-15:19-001798-000-02
02-08/08/2014-15:20-001798-000-02
02-08/08/2014-15:20-054198-000-02
02-08/08/2014-15:20-034760-000-02
02-08/08/2014-15:21-014041-000-02
02-08/08/2014-15:21-048227-000-02
02-08/08/2014-15:21-055311-000-02
02-08/08/2014-15:21-059140-000-02
02-08/08/2014-15:21-021545-000-02
02-08/08/2014-15:22-004848-000-02
02-08/08/2014-15:22-002451-000-02
02-08/08/2014-15:27-023272-000-02
02-08/08/2014-15:29-063839-000-02
02-08/08/2014-15:32-053475-000-02
02-08/08/2014-15:33-028859-000-02
02-08/08/2014-15:34-050279-000-02
02-08/08/2014-15:36-003774-000-02
02-08/08/2014-15:36-025179-000-02
02-08/08/2014-15:36-032925-000-02
02-08/08/2014-15:36-032838-000-02
02-08/08/2014-15:37-000009-000-02
02-08/08/2014-15:37-000009-000-02
02-08/08/2014-15:37-000009-000-02
02-08/08/2014-15:37-047387-000-02
02-08/08/2014-15:38-052903-000-02
02-08/08/2014-15:39-063839-000-02
02-08/08/2014-15:42-063094-000-02
02-08/08/2014-15:47-033243-000-02
02-08/08/2014-15:47-033243-000-02
02-08/08/2014-15:49-007016-000-02
02-08/08/2014-15:56-064937-000-02
02-08/08/2014-15:57-063172-000-02
02-08/08/2014-15:59-059036-000-02
02-08/08/2014-16:02-031229-000-02
02-08/08/2014-16:07-038200-000-02
02-08/08/2014-16:10-056763-000-02
02-08/08/2014-16:13-045060-000-02
02-08/08/2014-16:20-018613-000-02
02-08/08/2014-16:20-018613-000-02
02-08/08/2014-16:28-014569-000-02
02-08/08/2014-16:28-053394-000-02
02-08/08/2014-16:28-054787-000-02
02-08/08/2014-16:30-032678-000-02
02-08/08/2014-16:30-050347-000-02
02-08/08/2014-16:36-038671-000-02
02-08/08/2014-16:41-031901-000-02
02-08/08/2014-16:42-027477-000-02
02-08/08/2014-16:44-051587-000-02
02-08/08/2014-16:45-056653-000-02
02-08/08/2014-16:45-056653-000-02
02-08/08/2014-16:46-061645-000-02
02-08/08/2014-16:54-058615-000-02
02-08/08/2014-16:56-051497-000-02
02-08/08/2014-16:59-019547-000-02
02-08/08/2014-17:00-061067-000-02
02-08/08/2014-17:01-038222-000-02
02-08/08/2014-17:01-047332-000-02
02-08/08/2014-17:02-064745-000-02
02-08/08/2014-17:02-060240-000-02
02-08/08/2014-17:02-060240-000-02
02-08/08/2014-17:02-053350-000-02
02-08/08/2014-17:03-014524-000-02
02-08/08/2014-17:04-038821-000-02
02-08/08/2014-17:04-057240-000-02
02-08/08/2014-17:05-052475-000-02
02-08/08/2014-17:05-057662-000-02
02-08/08/2014-17:05-065152-000-02
02-08/08/2014-17:05-003076-000-02
02-08/08/2014-17:06-061436-000-02
02-08/08/2014-17:06-061436-000-02
02-08/08/2014-17:06-050474-000-02
02-08/08/2014-17:06-061966-000-02
02-08/08/2014-17:07-011222-000-02
02-08/08/2014-17:07-011222-000-02
02-08/08/2014-17:07-033425-000-02
02-08/08/2014-17:07-056000-000-02
02-08/08/2014-17:07-056000-000-02
02-08/08/2014-17:07-056000-000-02
02-08/08/2014-17:07-061648-000-02
02-08/08/2014-17:08-045822-000-02
02-08/08/2014-17:09-050955-000-02
02-08/08/2014-17:11-004748-000-02
02-08/08/2014-17:11-061195-000-02
02-08/08/2014-17:13-046872-000-02
02-08/08/2014-17:13-046872-000-02
02-08/08/2014-17:13-046872-000-02
02-08/08/2014-17:13-059372-000-02
02-08/08/2014-17:13-058405-000-02
02-08/08/2014-17:13-040996-000-02
02-08/08/2014-17:13-040996-000-02
02-08/08/2014-17:14-013749-000-02
02-08/08/2014-17:14-039297-000-02
02-08/08/2014-17:14-055873-000-02
02-08/08/2014-17:14-051753-000-02
02-08/08/2014-17:14-045246-000-02
02-08/08/2014-17:14-059724-000-02
02-08/08/2014-17:15-063120-000-02
02-08/08/2014-17:15-063120-000-02
02-08/08/2014-17:16-057270-000-02
02-08/08/2014-17:16-052044-000-02
02-08/08/2014-17:17-053924-000-02
02-08/08/2014-17:17-023918-000-02
02-08/08/2014-17:18-005220-000-02
02-08/08/2014-17:18-060981-000-02
02-08/08/2014-17:18-045137-000-02
02-08/08/2014-17:19-027282-000-02
02-08/08/2014-17:19-054996-000-02
02-08/08/2014-17:21-047975-000-02
02-08/08/2014-17:21-047975-000-02
02-08/08/2014-17:22-047112-000-02
02-08/08/2014-17:22-054460-000-02
02-08/08/2014-17:23-055622-000-02
02-08/08/2014-17:25-051129-000-02
02-08/08/2014-17:25-016590-000-02
02-08/08/2014-17:25-048403-000-02
02-08/08/2014-17:26-048454-000-02
02-08/08/2014-17:26-063698-000-02
02-08/08/2014-17:28-017684-000-02
02-08/08/2014-17:29-010054-000-02
02-08/08/2014-17:29-010054-000-02
02-08/08/2014-17:29-002712-000-02
02-08/08/2014-17:31-017731-000-02
02-08/08/2014-17:31-017731-000-02
02-08/08/2014-17:31-064639-000-02
02-08/08/2014-17:32-050857-000-02
02-08/08/2014-17:33-051481-000-02
02-08/08/2014-17:34-058460-000-02
02-08/08/2014-17:34-063867-000-02
02-08/08/2014-17:35-047985-000-02
02-08/08/2014-17:35-042237-000-02
02-08/08/2014-17:38-022890-000-02
02-08/08/2014-17:42-045677-000-02
02-08/08/2014-17:43-041931-000-02
02-08/08/2014-17:44-004555-000-02
02-08/08/2014-17:48-052703-000-02
02-08/08/2014-17:49-048695-000-02
02-08/08/2014-17:50-055981-000-02
02-08/08/2014-17:50-055981-000-02
02-08/08/2014-17:56-035073-000-02
02-08/08/2014-17:56-065214-000-02
02-08/08/2014-17:57-029877-000-02
02-08/08/2014-17:58-039497-000-02
02-08/08/2014-17:58-039497-000-02
02-08/08/2014-17:59-046651-000-02
02-08/08/2014-17:59-046651-000-02
02-08/08/2014-17:59-001166-000-02
02-08/08/2014-17:59-059403-000-02
02-08/08/2014-18:00-049712-000-02
02-08/08/2014-18:02-016390-000-02
02-08/08/2014-18:04-060519-000-02
02-08/08/2014-18:05-052521-000-02
02-08/08/2014-18:05-063944-000-02
02-08/08/2014-18:05-054737-000-02
02-08/08/2014-18:05-003033-000-02
02-08/08/2014-18:18-049662-000-02
02-08/08/2014-18:19-010926-000-02
02-08/08/2014-18:25-048704-000-02
02-08/08/2014-18:25-050532-000-02
02-08/08/2014-18:31-008631-000-02
02-08/08/2014-18:31-057759-000-02
02-08/08/2014-18:31-055300-000-02
02-08/08/2014-18:32-020059-000-02
02-08/08/2014-18:34-028800-000-02
02-08/08/2014-18:36-057517-000-02
02-08/08/2014-18:40-006906-000-02
02-08/08/2014-18:45-003595-000-02
02-08/08/2014-18:46-059774-000-02
02-08/08/2014-18:53-060644-000-02
02-08/08/2014-18:59-007651-000-02
02-08/08/2014-19:05-001324-000-02
02-08/08/2014-19:06-049233-000-02
02-08/08/2014-19:12-025212-000-02
02-08/08/2014-19:13-005905-000-02
02-08/08/2014-19:18-005286-000-02
02-08/08/2014-19:40-045334-000-02
02-08/08/2014-19:40-005557-000-02
02-08/08/2014-19:40-003634-000-02
02-08/08/2014-19:56-027498-000-02
02-08/08/2014-20:06-060406-000-02
02-08/08/2014-20:12-014852-000-02
02-08/08/2014-20:22-005590-000-02
02-08/08/2014-20:29-026640-000-02
02-08/08/2014-20:29-054784-000-02
02-08/08/2014-20:45-014515-000-02
02-08/08/2014-20:46-064359-000-02
02-08/08/2014-20:47-007078-000-02
02-08/08/2014-20:47-062044-000-02
02-08/08/2014-20:50-050863-000-02
02-08/08/2014-20:57-049413-000-02
02-08/08/2014-21:01-019507-000-02
02-08/08/2014-21:06-015077-000-02
02-08/08/2014-21:07-032028-000-02
02-08/08/2014-21:09-023631-000-02
02-08/08/2014-21:09-041278-000-02
02-08/08/2014-21:10-053289-000-02
02-08/08/2014-21:10-049989-000-02
02-08/08/2014-21:11-034286-000-02
02-08/08/2014-21:16-048103-000-02
02-08/08/2014-21:24-013766-000-02
02-08/08/2014-21:40-000256-000-02
02-08/08/2014-21:45-064582-000-02
02-08/08/2014-21:50-050108-000-02
02-08/08/2014-21:57-048433-000-02
02-08/08/2014-22:00-030586-000-02
02-08/08/2014-22:01-046322-000-02
02-08/08/2014-22:03-029842-000-02
02-08/08/2014-22:03-029842-000-02
02-08/08/2014-22:04-034091-000-02
02-08/08/2014-22:04-027757-000-02
02-08/08/2014-22:04-045028-000-02
02-08/08/2014-22:04-007510-000-02
02-08/08/2014-22:04-056744-000-02
02-08/08/2014-22:05-025898-000-02
02-08/08/2014-22:09-024016-000-02
02-08/08/2014-22:11-059298-000-02
02-08/08/2014-22:11-048406-000-02
02-08/08/2014-22:11-021256-000-02
02-08/08/2014-22:14-008027-000-02
02-08/08/2014-22:15-000687-000-02
02-08/08/2014-22:16-064865-000-02
02-08/08/2014-22:17-018685-000-02
02-08/08/2014-22:17-018685-000-02
02-08/08/2014-22:17-036761-000-02
02-08/08/2014-22:19-046377-000-02
02-08/08/2014-22:19-033454-000-02
02-08/08/2014-22:20-005443-000-02
02-08/08/2014-22:23-052499-000-02
02-08/08/2014-22:31-058536-000-02
02-08/08/2014-22:31-041270-000-02
02-08/08/2014-22:31-060938-000-02
02-08/08/2014-22:35-007973-000-02
02-08/08/2014-22:38-063564-000-02
02-08/08/2014-22:39-056544-000-02
02-08/08/2014-22:42-064443-000-02
02-08/08/2014-22:42-015629-000-02
02-08/08/2014-22:42-032226-000-02
02-08/08/2014-22:42-042140-000-02
02-08/08/2014-22:42-060865-000-02
02-08/08/2014-22:44-061113-000-02
02-08/08/2014-22:45-004271-000-02
02-08/08/2014-22:48-062012-000-02
02-08/08/2014-22:48-062012-000-02
02-08/08/2014-22:52-055690-000-02
02-08/08/2014-22:52-051446-000-02
02-08/08/2014-22:54-059973-000-02
02-08/08/2014-22:55-037241-000-02
02-08/08/2014-22:56-034102-000-02
02-08/08/2014-22:56-054056-000-02
02-08/08/2014-22:56-026113-000-02
02-08/08/2014-22:58-049452-000-02
02-08/08/2014-22:58-031836-000-02
02-08/08/2014-22:58-031836-000-02
02-08/08/2014-22:58-031836-000-02
02-08/08/2014-22:59-029901-000-02
02-08/08/2014-22:59-055587-000-02
02-08/08/2014-22:59-054056-000-02
02-08/08/2014-22:59-058606-000-02
02-08/08/2014-22:59-055236-000-02
02-08/08/2014-23:00-010440-000-02
02-08/08/2014-23:00-054780-000-02
02-08/08/2014-23:00-054780-000-02
02-08/08/2014-23:01-023683-000-02
02-08/08/2014-23:02-041915-000-02
02-08/08/2014-23:03-023550-000-02
02-08/08/2014-23:03-019945-000-02
02-08/08/2014-23:04-005746-000-02
02-08/08/2014-23:04-007854-000-02
02-08/08/2014-23:04-007854-000-02
02-08/08/2014-23:04-051288-000-02
02-08/08/2014-23:05-049727-000-02
02-08/08/2014-23:06-041655-000-02
02-08/08/2014-23:06-051505-000-02
02-08/08/2014-23:06-063106-000-02
02-08/08/2014-23:07-057269-000-02
02-08/08/2014-23:10-057966-000-02
02-08/08/2014-23:11-009055-000-02
02-08/08/2014-23:11-055094-000-02
02-08/08/2014-23:12-045659-000-02
02-08/08/2014-23:14-058884-000-02
02-08/08/2014-23:17-054010-000-02
02-08/08/2014-23:20-012158-000-02
02-08/08/2014-23:21-010322-000-02
02-08/08/2014-23:23-042137-000-02
02-08/08/2014-23:23-014674-000-02
02-08/08/2014-23:23-046112-000-02
02-08/08/2014-23:23-058519-000-02
02-08/08/2014-23:23-004670-000-02
02-08/08/2014-23:23-042960-000-02
02-08/08/2014-23:24-052273-000-02
02-08/08/2014-23:28-002798-000-02
02-08/08/2014-23:28-032273-000-02
02-08/08/2014-23:28-033137-000-02
02-08/08/2014-23:28-033137-000-02
02-08/08/2014-23:31-043073-000-02
02-08/08/2014-23:31-001497-000-02
02-08/08/2014-23:34-064434-000-02
02-08/08/2014-23:39-041976-000-02
02-08/08/2014-23:39-001699-000-02
02-08/08/2014-23:46-008824-000-02
02-08/08/2014-23:46-048181-000-02
02-08/08/2014-23:52-063760-000-02
As per Mr. Celko recommend in way of naming table (tbl_xxxx), this is what we be teached in school, cheers.
And I'm sorry if my info provide is not clear enough for you all to testing. Please treat me like your student, cheers.
Thank you.
Similar Messages
-
Merge, Update, or Insert?
Hey all,
I am new to using Oracle and SQL database codes in general. I am wondering what kind of statement to use for the problem I am about to explain. I will probably have coding questions down the road, which I will post in the correct part of the forum, but I thought that posting this general question would be appropriate in this forum.
My problem:
I have a TMP table which contains specific columns that were taken from the source. (Source had 85 columns, this TMP table has around 20). So, now I need to insert the data from the TMP table to different table. For example, the temp table is called TMP_SUPP_MASTER. The table we are moving this information into is TBL_SUPP_MASTER. In the TMP table there are columns like ADR_ST_LN_1, ADR_ST_LN_2, ADR_ST_LN_3, ADR_ST_LN_4...but in the TBL there is just ADDR_ST. Therefore, I need to combine those 4 columns into 1.
That was one part of the problem, another part involves inserting a single value into every row under the ORG_ID column name. The ORG_ID is not part of TMP, but is in TBL.
The last part of the problem is we have a lot of SUPP_CD (supplier codes), which are the primary keys. Well the code is built to include a facility ID followed by a "root" supplier code. Each facility ID and "root" supplier code is unique, so we are keeping those codes, but also making a column that has just the "root" supplier code. There are multiple "root" supplier codes that match up, so we are creating a parent/child relationship with those codes and having a column that marks them as 'P' or 'C'. P = parent, C = child. So I need to also insert that.
On top of all that, we will have new information coming in that needs to be updated to the table (so I'm assuming it's a merge).
Can anyone point me in the right direction to figure out this problem? I would really appreciate it. I don't need any codes, but just a simple opinion.
Thank you all!991769 wrote:
Can anyone point me in the right direction to figure out this problem? I would really appreciate it. I don't need any codes, but just a simple opinion.Well, coffee is good for figuring out problems... ;-)
Performance is determined by the size of a workload and how fast it can be moved. The biggest chunk of most database workloads is I/O. I/O workloads are also slow to move.
So the basic principal for performance is to do the least amount of I/O as possible.
If you have an UPDATE using table TMP for getting the new values to update table PROD1, and you have an INSERT using table TMP for getting new data into table PROD2, this means 2 I/O workloads on TMP.
If both workloads read the entire TMP table, they are pretty much identical and results in a double workload for the same data. In this case a MERGE hitting TMP once, and then feeding updates to PROD1 and inserts to PROD2, will be a far smaller and far more effective workload.
So when tackling a problem with SQL, try and keep the I/O to only that what is necessary to achieve the goal - and guard against hitting the same rows of data with multiple passes. -
HELP!! update mid-install problem, computer wont finish booting!!
Hello all,
my girlfriends computer was installing the latest os update when it said something to the tune of "update could not be completed." Now, when I try to boot it, it never goes past the screen with the grey background with the simple apple logo and the loader graphic. HOW DO I SOLVE THIS?? I cannot figure this out and she needs this fixed asap. thanks in advance!Repairing permissions worked. This mac is my first intel and i have had soo many slashed circles come up. But basically I just inserted the install disc that came with the mac, powered off the mac. held down option, powered on. waited 10seconds then let go off option then the screen came up with the option to boot from hard drive or dvd. i clicked dvd. after a min or so you get to a screen where its says to install os x. i just went to the top of the menu bar and clicked on utilities and went into disk utility and then i clicked on the startup drive, the one with the personalname(the volume one down from the actual HD) and went repair permissions. that fixed a few things and then I went to quit and startup disc in the utilities menu and slected the internal hd in this case hard drive os 10.4.11 and clikcked restart and then restart again. It restarted, it took 2 or so minutes to load and then all is fine.
-
HELP!! update 4.2 problem
i updated to the new 4.2 and now everytime i send a text it makes a sound when it sends. i have all my sounds for text turned off. any idea how to make it stop??? so annoying!
Mine has always done this...
Try re-setting your phone and see if that fixes it. -
Rows updated and inserted by MERGE
Hi,
Is there any way I can come to know, How many rows are updated and inserted using a MERGE statement.
Thanks in advanceSomething like this ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.01
satyaki>
satyaki>
satyaki>
satyaki>desc aud_emp;
Name Null? Type
EMPNO NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
AUDIT_TMP TIMESTAMP(6)
AUDIT_IP_ADDR VARCHAR2(15)
OPR_DESC VARCHAR2(30)
USER_NM VARCHAR2(40)
REMARKS VARCHAR2(200)
satyaki>
satyaki>
satyaki>
satyaki>
satyaki>select * from aud_emp;
no rows selected
Elapsed: 00:00:00.04
satyaki>
satyaki>
satyaki>select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
9999 SATYAKI SLS 7698 02-NOV-08 55000 3455 10
7777 SOURAV SLS 14-SEP-08 45000 3400 10
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 4450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 7000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
13 rows selected.
Elapsed: 00:00:00.01
satyaki>
satyaki>select * from e_emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 3718.75 20
7782 CLARK MANAGER 7839 09-JUN-81 3062.5 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 11700 10
7 rows selected.
Elapsed: 00:00:00.07
satyaki>CREATE OR REPLACE TRIGGER trg_aud
before insert or update or delete on e_emp
for each row
declare
S_IP_ADDR varchar2(30);
str varchar2(320);
s_empno varchar2(40);
s_ename varchar2(40);
s_job varchar2(40);
s_mgr varchar2(40);
s_hrdate varchar2(40);
s_sal varchar2(40);
s_comm varchar2(40);
s_deptno varchar2(40);
begin
SELECT SYS_CONTEXT('USERENV','IP_ADDRESS')
into S_IP_ADDR
from dual;
str:= null;
if inserting then
insert into aud_emp values(:new.empno,
:new.ename,
:new.job,
:new.mgr,
:new.hiredate,
:new.sal,
:new.comm,
:new.deptno,
systimestamp,
S_IP_ADDR,
'INSERT',
USER,
NULL);
elsif updating then
if :old.empno <> :new.empno then
s_empno := 'Employee No: '||:old.empno;
elsif :old.ename <> :new.ename then
s_ename := 'Employee Name: '||:old.ename;
elsif :old.job <> :new.job then
s_job := 'Job: '||:old.job;
elsif :old.mgr <> :new.mgr then
s_mgr := 'Mgr: '||:old.mgr;
elsif :old.hiredate <> :new.hiredate then
s_hrdate := 'Hire Date: '||:old.hiredate;
elsif :old.sal <> :new.sal then
s_sal := 'Salary: '||:old.sal;
elsif :old.comm <> :new.comm then
s_comm := 'Commission: '||:old.comm;
elsif :old.deptno <> :new.deptno then
s_deptno := 'Department No: '||:old.deptno;
end if;
str:= 'Updated Records Details -> '||s_empno||' '||s_ename||' '||s_job||' '||s_mgr||' '||s_hrdate||' '||s_sal||' '||s_comm||' '||s_deptno;
insert into aud_emp values(:new.empno,
:new.ename,
:new.job,
:new.mgr,
:new.hiredate,
:new.sal,
:new.comm,
:new.deptno,
systimestamp,
S_IP_ADDR,
'UPDATE',
USER,
str);
elsif deleting then
insert into aud_emp values(:old.empno,
:old.ename,
:old.job,
:old.mgr,
:old.hiredate,
:old.sal,
:old.comm,
:old.deptno,
systimestamp,
S_IP_ADDR,
'DELETE',
USER,
'Old Records before deletion');
end if;
exception
when others then
raise_application_error(-20501,'Contact With Your Admin....');
end;
Trigger Created.
Elapsed: 00:00:00.09
satyaki>ed
Wrote file afiedt.buf
1 merge into e_emp o
2 using emp n
3 on ( o.empno = n.empno)
4 when matched then
5 update set o.ename = n.ename,
6 o.job = n.job,
7 o.mgr = n.mgr,
8 o.hiredate = n.hiredate,
9 o.sal = n.sal,
10 o.comm = n.comm,
11 o.deptno = n.deptno
12 when not matched then
13 insert( o.empno,
14 o.ename,
15 o.job,
16 o.mgr,
17 o.hiredate,
18 o.sal,
19 o.comm,
20 o.deptno)
21 values( n.empno,
22 n.ename,
23 n.job,
24 n.mgr,
25 n.hiredate,
26 n.sal,
27 n.comm,
28* n.deptno)
satyaki>/
13 rows merged.
Elapsed: 00:00:03.95
satyaki>
satyaki>commit;
Commit complete.
Elapsed: 00:00:00.07
satyaki>
satyaki>
satyaki>select * from aud_emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO AUDIT_TMP AUDIT_IP_ADDR OPR_DESC USER_NM REMARKS
7566 JONES MANAGER 7839 02-APR-81 2975 20 31-DEC-08 10.54.06.667000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details -> Salary: 3718.75
7782 CLARK MANAGER 7839 09-JUN-81 4450 10 31-DEC-08 10.54.06.686000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details -> Salary: 3062.5
7788 SCOTT ANALYST 7566 19-APR-87 3000 20 31-DEC-08 10.54.06.687000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details ->
7839 KING PRESIDENT 17-NOV-81 7000 10 31-DEC-08 10.54.06.697000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details -> Salary: 5000
7876 ADAMS CLERK 7788 23-MAY-87 1100 20 31-DEC-08 10.54.06.698000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details ->
7902 FORD ANALYST 7566 03-DEC-81 3000 20 31-DEC-08 10.54.06.699000 PM 10.23.99.77 UPDATE SCOTT Updated Records Details ->
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 31-DEC-08 10.54.06.720000 PM 10.23.99.77 INSERT SCOTT
7777 SOURAV SLS 14-SEP-08 45000 3400 10 31-DEC-08 10.54.07.059000 PM 10.23.99.77 INSERT SCOTT
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 31-DEC-08 10.54.07.060000 PM 10.23.99.77 INSERT SCOTT
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 31-DEC-08 10.54.07.060000 PM 10.23.99.77 INSERT SCOTT
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 31-DEC-08 10.54.07.061000 PM 10.23.99.77 INSERT SCOTT
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO AUDIT_TMP AUDIT_IP_ADDR OPR_DESC USER_NM REMARKS
9999 SATYAKI SLS 7698 02-NOV-08 55000 3455 10 31-DEC-08 10.54.07.061000 PM 10.23.99.77 INSERT SCOTT
7900 JAMES CLERK 7698 03-DEC-81 950 30 31-DEC-08 10.54.07.062000 PM 10.23.99.77 INSERT SCOTT
13 rows selected.
Elapsed: 00:00:00.22
satyaki>
satyaki>set lin 80Hope this will help you.
Regards.
Satyaki De. -
please help me < when update my i phone 3G < i finish update but face problem , appear me msg There is no SIM card installed in the iPhone You ar attempting to activate. Please disconnect
Sounds like your phone was hacked to use with your carrier. Updating it has relocked the phone to it's original carrier. You will not get the phone working again without a SIM from the original carrier.
-
Hello guys..!! I have got my new iphone 4 2 days ago.The same day it got a problem of auto restart in every 1, to 2 minutes. I updated and restored it many times...but of no use... can any one help me how to solve this problem..!!
Go to Settings/General/Reset - Erase all content and settings. the connecto to iTunes and restore as a New phone. Do not restore any backup. If the problem persists you have a hardware problem. Take it to Apple for exchange.
This assumes that the phone is not hacked or jailbroken. If it is you will have to go elsewhere on the internet for help. -
will apple next update to help fix the location following data problems will the ipod touch 2g be included ?
Chances are the 2g itouch will not be included in the update. Also no one yet knows if it will be fixed in the next firmware but apple has said they know of this bug.
-
I have a problem in my iphone 4 with wi-fi after update to IOS6 please can help my how can solve this problem?
Nope
One needs to press the home and sleep / wake keys together for the phone to reset
The other thing I could recommend
Let the battery run out and the phone completely "die"
It may take a day or two with it not being used
Then plug it in to charge and see if there is any change in behavior
If you cannot get this to work - you may need to bring it to an Apple store -
hi..i just bought an iphone 5 yesterday 32GB..and now when i am trying to update the software..it says the following: unable to check for update/an error occurred while cheking for a software update...please help me..is it a problem in my new iphone??or it's just an temporary error in the apple software center???
Lyndsay237 wrote:
This device does not have a sim card in it. Could this be the reason or am I missing something when I am trying to update.
Yes. You can't update or restore any GSM iPhone without a valid sim card installed in the phone. The sim card need not be activated, but it must be valid & present. If you want to update, you need to get a sim card. -
I just updated my iphone to IOS 7 and cannot get my imessage to work, it keeps saying "waiting for activation" nothing i have read online has helped me try to fix the problem. why is it doing this and how can i fix it?
Here's a good troubleshooting article about imessage "waiting for activation".
http://support.apple.com/kb/TS4268 -
i cant use the highlight, underline, or strikethrough function in a specific pdf file. The file isnt locked. I used to highlight texts from that file before the latest update. The problem occurs only with that file. Urgent need. Please help. Thanks!
Chester31,
Thank you very much for sharing your file with us! Now that we are able to reproduce the problem at our end, you may stop sharing the file on Acrobat.com.
Do you know when this problem (for not being able to add new highlight/strikeout/underline) has started? Did you update your iOS from 7.x to 8.0 recently?
We will continue investigating the problem and let you know what we find.
Thank you again for your help. -
Update/Insert Problem with Oracle Warehouse Builder
Hello,
i have update/insert problem with owb.
Situation: I have a source-table called s_account and a target table called w_account_d. In the target table are already data which was filled trough the source table inserts. Now anyone make changes on data on the target table. This changes should now give further on the source table with an update operation. But exactly here is the problem i can´t map back the data to source because that will create a loop.
My idea was to set a trigger but i can´t find this component in owb or is anywhere hidden?
Also i have already seen properties as CDC or conditonal loading in the property inspector of the table, but i have no idea how it works.
Give it other possibilities to modeling this case? or can anyone me explain how i can implement this eventually with CDC?
I look forward for your replies :)Hi
thanks for your answer. I follow your suggestion and have set the constraints of both tables into the database directly.Nevertheless it doesn´t work to begin. In the next step i found by right click on a table the listpoint "configure" - I goes to "unique key" --> creation method and set here follow options: Constraint State = ENABLE, Constraint Validation = Validate. That error message that appears before by the deployment disappears yet. Now i start the job to test if the insert/update process works right. Finally it seems to work - but not really.
My Testscenario
1. Load the data from source table about the staging area to data warehouse table: Check - it works!
2. Change one data record in source table
3. Load the source table with changed data record once again to staging area: Check - it works!
4. Load new staging area table with the changed data record to data warehouse table: Check it works! BUT, BUT i can not recognize if it is insert or update operation, then under the design window by jobs execution windows is reported "rows selected 98", Rows inserted" is empty and "rows updated" is empty. So i think works not correct, then my opinion if it works correct it should show be "rows updated" 1.
What can yet now still be wrong or forgotten? Any ideas?
*By the way think not 98 rows there is not important if you make an update or insert which performance. It is an example table the right tables have million of records.*
I look forward for your answers :) -
Syntax for Merge statement to insert into target and update source
Hello All,
I want to use Merge statement to insert records when not matched in my target and update records in source when matched. Is it possible to do using Merge statement.
create table a (aa number)
create table b (bb number)
alter table a add flg char(1)
merge b as target
using a as source
on (target.bb = source.aa)
when matched then
update set source.flg = 'Y'
WHEN NOT MATCHED THEN
insert (target.bb)
values
(source.aa)
Thanks.Hi,
I have no idea about the version of DB, else some new features with respect version can be specified - just for informaitve purpose and to post across the verison of DB in future posts.
Coming to your issue and requirement.
if you check the syntax and functionality , then its on Merge on target base only - with respect to Update (matched o columns) and insert (for unmatched columns). Source - as the term is clear. It might not work out on source table.
- Pavan Kumar N
- ORACLE OCP - 9i/10g
https://www.oracleinternals.blogspot.com -
My iphone 4 is getting stuck during gaming when sim card is inserted. Call anyone help me out to solve this problem?
That doesn't make any sense to me at all, unless the games you're trying to play have some sort of online connection/capability and you're in a weak signal area, thus the games can't make the required online connection. What happens when you turn cellular data off in settings: Settings>General>Network>Cellular Data>Off.
Maybe you are looking for
-
I don't remember the defaults for mail to have every subject line bold in my inboxes. I have checked "Rules" and I don't have anything to due with bold. Is this standard to have every subject line bold or can I somehow turn this off? It's pretty anno
-
Dear SAP Techs, I am working on SAP AFS. wanted to create Smartforms on purchase order. This purchase order will be common for US, Canada, Germany, UK and Other Asia- Pacific Countries. Should I use copy Standard Purchase Order form /smb40/mmpo_l or
-
9-slice scaling? Help!
When I open up a CS3 file with my CS5 version I get this error. "Illustrator now honers 9 -slice scaling of symbols. Any scaling done on symbol instance with 9-slice scaling option in legacy version will look different now. Do you want to retain the
-
PCMCIA card firewire work on old laptop?
Hey! I am trying to find a CD burner for my old WallStreet G3 233. I was wondering: if I were to buy a firewire PCMCIA card, would that (somehow) operate at the same speed as the SCSI port on the back of my machine? See, I doubt it will because I alr
-
Opening duplicate copies of the same File in CS4
Hi I have recently upgraded some of my customers from CS3 to CS4 and I have noticed that when I open a document that was last opened in CS3 i can open the file more than once and they get listed as tabs. If i make changes to the the first open docume