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.
Similar Messages
-
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. -
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 -
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. -
Merge update insert into with exception
I m opening a new thread for the same question i had posted earlier....
create Table test(
col1 varchar2(200),
col2 varchar2(200),
col3 varchar2(200),
id varchar2(200),
job_id varchar2(10)
create Table test1(
col1 varchar2(200),
col2 varchar2(200),
col3 varchar2(200),
id varchar2(200),
job_id varchar2(10)
create Table test2(
col1 varchar2(200),
col2 varchar2(200),
col3 varchar2(200),
id varchar2(200),
job_id varchar2(10)
create Table err_tbl(
col1 varchar2(200),
col2 varchar2(200),
col3 varchar2(200),
id varchar2(200),
job_id varchar2(10)
===============================================================
merge into test t
using (select distinct col1, col2, col3,id, job_id
from test1
where job_id = curr_job_id -- cur_job_id is variable which is declared in the procedure to sysdate
union
select distinct col1, col2, col3,id, job_id
from test2
where job_id = curr_job_id --cur_job_id is variable which is declared in the procedure to sysdate
) ss
on (t.id = ss.id
AND t.job_id = ss.job_id)
when matched then update
set t.col1 = ss.col1,
t.col2 = ss.col2,
t.col3 = ss.col3
when not matched then insert into
( t.col1,
t.col2,
t.col3,
t.id,
t.job_id
)Values
( ss.col1,
ss.col2,
ss.col3,
ss.id,
ss.jobid,
exception
when others then
insert into err_tbl (
col1,
col2,
col3,
id,
job_id )
values ( ss.col1,
ss.col2,
ss.col3,
ss.id,
ss.jobid,
Above, all i m trying to do is Updating or inserting into TEST table, and if there is any Duplicate records or any bad records then making use of exception i m INSERTING into ERR_TBL
i get error with the merge insert update code ....
The error i get is --- "ss.col1" column is not allowed here
Any idea guys ????
Hey one more quick question ....Can we use exception in merge insert update block ???user642297 wrote:
I m opening a new thread for the same question i had posted earlier....
Any idea guys ????
Hey one more quick question ....Can we use exception in merge insert update block ???Did you learn nothing nothing from [Your other thread|http://forums.oracle.com/forums/thread.jspa?messageID=3810396�]
(Maybe that's why you never bothered to close it)
It looks like you did learn something, since you ended up saying
Thanks alex...i think i got the answer.....so i cannot use exception handler in merge statement...
Thank you so much!!!What beats me is that yu post the exact same question again, when you already got the answer
?:|
Peter -
How to use the mirrored and log shipped secondary database for update or insert operations
Hi,
I am doing a DR Test where I need to test the mirrored and log shipped secondary database but without stopping the mirroring or log shipping procedures. Is there a way to get the data out of mirrored and log shipped database to another database for update
or insert operations?
Database snapshot can be used only for mirrored database but updates cannot be done. Also the secondary database of log shipping cannot used for database snapshot. Any ideas of how this can be implemented?
Thanks,
PreethaHmm in this case I think you need Merge Replication otherwise it breaks down the purpose of DR...again in that case..
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 -
Hi everybody...
MERGE statement without UPDATE or INSERT clause is possible or not
I want to select from one table and update in another table. So i dont want insert statement and i want to do it in single query....possible solutions are requested.
Thanks in advance
palHi..
Thanks for ur reply. For MERGE statement, we have to give UPDATE and INSERT clause. this MERGE statement works without INSERT or UPDATE clause.
Why i am asking is, I want to select how many rows (count(*)) from table1 and based on this count, i have to update in table2
Both tables r different and for select and for update where clauses are different. Both tables r totally different.
I want to do it in single query, so i asked this is possible with MERGE statement without INSERT clause.
Thanks for ur reply -
How to update and insert the records without using Table_comparison and Map_operation?
Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE
-
We have a stored procedure that merges/updates a subset of data from one table into another for a particular identier. For example, the data from table 1 with a PNOTE value of 991 is being merged with data from table 2 with a PNOTE value of 650. How do I verify the data from table 1 was merged with the data from table 2? I can't do a count because some records are inserted and others updated. I need to grab the data from the first subset and make sure it ended up in the second subset. Any help would be greatly appreciated.
I was able to find the solution. You have to query table 1 based on PNOTE value and then very that record set doesn't exist in table 2 using the primary keys.
This takes the subset from table 1 and verifies it doesn't exist in the updated subset in table 2.
select t1.* from table1 t1 where pnote = 650 and not exists
(select t2.* from table2 t2 where pnote = 991 and
t1.pk1 = t2.pk1 and
t1.pk2 = t2.pk2)
If the records were merged correctly the record set should be empty. -
Creating process for multiple Date fields for update or insert in APEX
hello there,
could someone please help me?
i have a form on Apex based on view that is based on three tables and updating and inserting ok using trigger instead of.
i have a problem now as in my form i have around 75 fileds (items) incuding 30 or more date fields which could be populated or left blank or update later.
so for each date field i have two boxs; one for date, input as dd/mm/yyyy (text field) and second for time, input as 23:45. All dates will be insert or update manually by user. so as i mentioned not all date fields could be poulated at one stage.
so i have created some process and validations and all of them work fine but i came accross if date left blank then (:) giving me problem so i have done following further process for each date field. In real table all the date fields have data type date.
declare
v_my_var date; -- for first date field
str_dy VARCHAR2(10);
dt_indx date;
str_tm VARCHAR2(20);
tm_indx date;
begin
str_dy := :p4_first_date
str_tm := str_dy||' '||substr(:p8_first_date_hh,1,2)||':'||substr(:p8_first_date_HH,4,2);
dt_indx := to_date(str_tm,'DD/MM/YYYY HH24:MI');
IF str_dy is not null then
v_my_var :=dt_indx;
ELSE
v_my_var := NULL;
END IF;
update table 1 set my_date = v_my_var where d_id= :p4_d_id;
end;
above code work fine but one date field of course therefore i have to do same code for each date field with changes and initialise variable again and again for each field.
so i like to ask is there any easy way that is more professional. i was thinking about the procedure and using collection or similar but honestly not much experience on that so could some one please help me?
I will be very thankful.
KRgdsHi,
You can do the needful by re-using the code if you can give the item names as P8_DATE1, P8_DATE_hh1, P8_DATE2, P8_DATEhh2 etc..So your item name just differs by a sequence.
Now you write function which will return desired date value taking above items as input. Pass item names to this function, get session state using APEX_UTIL.GET_SESSION_STATE('item_name') API.
Now modify you code as
FOR i IN 1..30
LOOP
v_date_array[i] = f_get_date('P8_DATE'||i, 'P8_DATEhh'||i);
END LOOP;
....Now you have all date valus in array. Just write one update as follows
UPDATE TABLE1
SET date1 = my_date_array[1], date2 = my_date_array[2]..
WHERE ....Hope it helps :)
Cheers,
Hari -
Creation of a Single button for both Update and Insert
Hi,
I want to create a button which performs both Insert and Update function. As of now i have 2 seperate buttons. Can I combine them in to one by writing a procedure which checks for the data in the database...If the record exists, then it should update the record, if not it should insert...Please guide me
Regards,
PaHi,
If I am inserting in to the table a new record, how do I check for that column in the table...
It should work this way..
I have a list of users in a page, if I click on any user name, it will redirect me to another screen which will allow me to create a record for the selected user name. I want to check the selected user name in the table. If it is already existing then need to update, else insert.
Regards,
Pa -
Using an on update or insert trigger on a SAP table
Hi all,
A question for you regarding using a database trigger in and SAP system.
We are needing to export data for our datawarehouse. Currently we export all the data. That data is getting quite large tho and time is becoming an issue.
One suggestion has been to add a custome field to an existing SAP table to hold a flag to indicate the record has changed but not been extracted. Thenput a trigger on the table in question so that the new field is updated upon update or insert of the record. Then when the extract runs, it will only extract those records with the flag set, then reset the flag.
we are using ERP 6 and SQL Server 2005 (or soon to as we will be upgrading next month).
Any suggestions regarding triggers? Or other options for flagging changed records in large table so we don't have to extract all records every time?
Thanks
Laurie
Edited by: Laurie McGinley on Oct 27, 2008 10:51 PMHi Laurie,
just really shouldn't consider to put triggers into your application.
The problem here is the very nature of triggers to do things 'in the background'.
If you have problems due to the trigger, you won't see it anywhere in the SAP environment.
In a while you probably forget about the trigger at all and then nobody can see, what is happening to the database, just because something is changed "in the background".
Besides that you don't get support for this from SAP, you will make your life a lot harder.
Tabledefinitions may change - your trigger might break.
Put application logic where it belongs - to the application layer!
regards,
Lars -
Hi All,
I am uploading data from a txt file into itab_infile and wants to update the table Zppprice based on itab_infile. It the record is existing it has to update and when it is a new record it has to insert the record. And I need to capture how many records havebeen updated and inserted.
Please help me.
Thanks,
Veni.
REPORT ZSD_PRICEPROTEC NO STANDARD PAGE HEADING
LINE-SIZE 132
LINE-COUNT 60.
TABLES: KNA1,ZPPPRICE.
TYPES: BEGIN OF type_infile,
KUNNR(10) TYPE c, "Customer Number
MATNR(18) TYPE c, "Material Number
CRDATE(10) TYPE c, "Creation Date
EFDATE(10) TYPE c, "Effective date
SPRICE(15) TYPE c, "Old Price
EPRICE(15) TYPE c, "New Price
EOHQTY(09) TYPE c, "Estimated Quantity
AOHQTY(09) TYPE c. "Actual Quantity
TYPES: END OF type_infile.
* Internal tables
DATA: itab_infile TYPE STANDARD TABLE OF type_infile with header line.
* Work areas
DATA: wa_infile TYPE type_infile.
* Global variables.
DATA: gc_tcode LIKE sy-tcode VALUE 'VA01'. "Transaction code
SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK one.
START-OF-SELECTION.
PERFORM upload_text_file.
*& Form UPLOAD_TEXT_FILE
FORM upload_text_file.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = itab_infile
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE e208(00) WITH 'Error in loading text file'.
ENDIF.
ENDFORM. " UPLOAD_TEXT_FILEHi Veni,
Simple thing ,you can use MODIFY Command,it works both insert as well update.
check the documentation.
see the below program and i am getting data from XLS file and i am updating to Ztable( same as ur case ).
Program : ZLWMI151_UPLOAD(Data load to ZBATCH_CROSS_REF Table)
Type : Upload program
Author : Seshu Maramreddy
Date : 05/16/2005
Transport : DV3K919574
Transaction: None
Description: This program will get the data from XLS File
and it upload to ZBATCH_CROSS_REF Table
REPORT ZLWMI151_UPLOAD no standard page heading
line-size 100 line-count 60.
*tables : zbatch_cross_ref.
data : begin of t_text occurs 0,
werks(4) type c,
cmatnr(15) type c,
srlno(12) type n,
matnr(7) type n,
charg(10) type n,
end of t_text.
data: begin of t_zbatch occurs 0,
werks like zbatch_cross_ref-werks,
cmatnr like zbatch_cross_ref-cmatnr,
srlno like zbatch_cross_ref-srlno,
matnr like zbatch_cross_ref-matnr,
charg like zbatch_cross_ref-charg,
end of t_zbatch.
data : g_repid like sy-repid,
g_line like sy-index,
g_line1 like sy-index,
$v_start_col type i value '1',
$v_start_row type i value '2',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
data: itab like alsmex_tabline occurs 0 with header line.
data : t_final like zbatch_cross_ref occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Uploading the data into Internal Table
perform upload_data.
perform modify_table.
top-of-page.
CALL FUNCTION 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form upload_data
text
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append t_text.
clear t_text.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
t_text-werks = itab-value.
when '0002'.
t_text-cmatnr = itab-value.
when '0003'.
t_text-srlno = itab-value.
when '0004'.
t_text-matnr = itab-value.
when '0005'.
t_text-charg = itab-value.
endcase.
endloop.
endif.
append t_text.
ENDFORM. " upload_data
*& Form modify_table
Modify the table ZBATCH_CROSS_REF
FORM modify_table.
loop at t_text.
t_final-werks = t_text-werks.
t_final-cmatnr = t_text-cmatnr.
t_final-srlno = t_text-srlno.
t_final-matnr = t_text-matnr.
t_final-charg = t_text-charg.
t_final-erdat = sy-datum.
t_final-erzet = sy-uzeit.
t_final-ernam = sy-uname.
t_final-rstat = 'U'.
append t_final.
clear t_final.
endloop.
delete t_final where werks = ''.
describe table t_final lines g_line.
sort t_final by werks cmatnr srlno.
Deleting the Duplicate Records
perform select_data.
describe table t_final lines g_line1.
modify zbatch_cross_ref from table t_final.
if sy-subrc ne 0.
write:/ 'Updation failed'.
else.
Skip 1.
Write:/12 'Updation has been Completed Sucessfully'.
skip 1.
Write:/12 'Records in file ',42 g_line .
write:/12 'Updated records in Table',42 g_line1.
endif.
delete from zbatch_cross_ref where werks = ''.
ENDFORM. " modify_table
*& Form select_data
Deleting the duplicate records
FORM select_data.
select werks
cmatnr
srlno from zbatch_cross_ref
into table t_zbatch for all entries in t_final
where werks = t_final-werks
and cmatnr = t_final-cmatnr
and srlno = t_final-srlno.
sort t_zbatch by werks cmatnr srlno.
loop at t_zbatch.
read table t_final with key werks = t_zbatch-werks
cmatnr = t_zbatch-cmatnr
srlno = t_zbatch-srlno.
if sy-subrc eq 0.
delete table t_final .
endif.
clear: t_zbatch,
t_final.
endloop.
ENDFORM. " select_data
Thanks
Seshu -
Combo box list update or insert restriction
Dear all,
I have a list item which type is combo box.
it shows the Departments list from the department table at run time.
i populate at through a procedure at runtime.
problem
the user could update the list by writing something into it.
i want to force the user to just select a value from the list, not update or insert.
i change the properties of the list item which prevent insertion or updation,
but it disable the selection from the list as well.
how to prevent the user to write something in the combo box list while giving him the
selection authority using the combo box list item?
Thanks and Regardsthank you dear,
but i want to use the combo box instead.
for popup list there is a problem of the null value,
you must assign a value to the popup list and set its required property to true for doing so.
and the combo box do not need this. and my desired functionality require it.
Edited by: Muhammad on Feb 28, 2010 3:10 AM
Edited by: Muhammad on Feb 28, 2010 3:21 AM -
Use of the "updlock" hint with update and insert statements
I have inherited some stored procedures and am trying to figure out why the developers decided to use the "updlock" hint on many of the update and insert statements. I have looked around everywhere and have found only one explanation of why "update...with
(updlock)" can be useful, namely when a table has no clustered index:
http://www.sqlnotes.info/2012/10/10/update-with-updlock/ I have found nothing yet that mentions why "insert into...with (updlock)" might be used. I understand why the hint
might be useful on select statements in some cases, but if all of the tables have clustered indexes, is there any good reason to use it on update and insert statements?
Thanks,
Ron
Ron RiceThis form of deadlock error can occur on a table which has a clustered index.
If you are doing updates on a table which has a clustered index and that table also has a nonclustered index and the nonclustered index is used to find the row to update you can see this type of deadlock. For example create a table with a clustered
primary key index and a nonclustered index by running
Create Table Foo(PK int primary key identity, OtherKey varchar(10), OtherData int);
go
Insert Foo Default Values;
go 10000
Update Foo Set OtherKey = 'C' + Cast(PK As varchar(10))
Create Unique Index FooIdx On Foo(OtherKey);
That creates a table with 10000 rows, a clustered index and a nonclustered index. Then run
Begin Transaction
Update Foo Set OtherData = 1 Where OtherKey = 'C5'
That will use the FooIdx index to find the row that needs to be updated. It will get a U lock on the index row in the FooIdx index, then an X lock on the row in the clustered index, update that row, then free the U lock on FooIdx, but keep the X lock
on the row in the clustered index. (There is other locking going on, but to simplify things, I'm only showing the locks that lead to the deadlock).
Then in another window, run
Begin Transaction
Update Foo Set OtherData = 2 Where OtherKey = 'C5'
This will get a U lock on the index row in the FooIdx index, then try to get an X lock on the row in the clustered index. But that row is already exclusively locked, so this second window will wait holding a U lock on FooIdx row and is waiting for
an X lock on the clustered index row.
Now go back to the first window and run
Update Foo Set OtherData = 3 Where OtherKey = 'C5'
This will once again try to get the U lock on the FooIdx row, but it is blocked by the U lock the second window holds. Of course the second window is blocked by the X lock on the clustered index row and you have a deadlock.
All that said, I certainly do not routinely code my updates with UPDLOCK. I try to design databases and write code so that deadlocks will be rare without holding excessive locks. The more locks you hold and the longer you hold them, the more
blocking you will get and the slower your system will run. So I write code that if a deadlock exception occurs, it is properly handled. Then if too many deadlocks occur, that is the time to go back to the code to see what changes are needed to
decrease the number of deadlocks (one way to do that may be to get locks earlier and/or hold them longer.
But I wouldn't worry much about this form of deadlock. It is, in my experience, vary rare. I don't recall ever seeing it in a production environment.
Tom
Maybe you are looking for
-
My iPod Touch 4g not visible in Windows or iTunes
My iPod Touch 4th generation is not visible in Windows or iTunes. It also doesn't seem to want to charge. I've tried the Troubleshooting Assistant but nothing happened. Any ideas? It was working fine last night, and this morning started acting wonky.
-
Blue screen of death......Help Please
The beginning of this month I built me a new gaming rig and installed Win 7 HP. Everything was running fine until the 18th. I was simply browsing the internet and all of a sudden my computer froze for a second then went to the BSOD. I saw at the bott
-
G3 won't boot after Software Update
Thanks to XPostFacto, I've been successfully running Tiger 10.4.8 on my old beige G3, with the OS installed in the first 8 Gb partition. Works great. To get more room for virtual memory and the system, I successfully installed 10.4 from the CD onto t
-
Getting NULL with function in the select Query
Hi all, SELECT ,a.TRANSACTIONAL_CURR_CODE --,gl.CONVERSION_RATE ,get_rate(a.transactional_curr_code,NVL(gsob.attribute1,gsob.currency_code),a.conversion_type_code,TRUNC(a.ordered_date)) CONVERSION_RATE FROM oe_order_headers_all a,
-
What is an rpd file and webcat file?
I find the reference to RPD file and web cat file almost everywhere. However, I have not been able to find: 1. the contents of the file 2. How it is created 3. Who creates it and How it can be viewed/modified? Please let me know the same for the webc