How to achieve the following logic
I have a target and a source table.
CREATE TABLE scd_tgt(
col1 VARCHAR2(10) not null,
col2 VARCHAR2(10) not null,
start_date DATE not null,
end_date DATEnot null
INSERT INTO scd_tgt VALUES('100','AKS','1-JAN-2010','9-SEP-9999');
INSERT INTO scd_tgt VALUES('101','Singh','1-JAN-2010','9-SEP-9999');
CREATE TABLE scd_src(
col1 VARCHAR2(10) not null,
col2 VARCHAR2(10) not null
INSERT INTO scd_src VALUES('99','Kumar');
INSERT INTO scd_src VALUES('100','Abhijit');
INSERT INTO scd_src VALUES('101','Singh');
Now, I have to perform update/insert data in scd_tgt using source data in scd_src based on the following rules:
1) INSERT any records from the SOURCE that aren't already in the TARGET, based on a col1.
2) If the TARGET has a record present in SOURCE (based on col1) and col2 of TARGET does not match with col2 of SOURCE then UPDATE the end_date to SYSDATE - 1. Proceed to Step 3.
3) INSERT the record from #2 into TARGET. Set start_Date as SYSDATE and end_date as '9-sep-9999'
Can this be achieved using MERGE? I am using 10.2g
After executing the steps scd_tgt should have the following data
99 Kumar 18-JUN-10 09-SEP-99
100 AKS 01-JAN-10 17-JUN-10
100 Abhijit 18-JUN-10 09-SEP-99
101 Singh 01-JAN-10 09-SEP-99
Hi,
With a merge it's not possible if you want to to update and insert (or insert/update) at the same time within the same condition (when matched or when not matched parts of the stement), what's authorizzed with a merge is:
an update + a delete in the "when matched" clause
an insert in the "when not matched" clause
So one solution could be that you use two differents DML op:
UPDATE scd_tgt
SET end_date = TRUNC(SYSDATE)
- 1
WHERE col1 IN(SELECT col1
FROM scd_src)
INSERT INTO scd_tgt
SELECT col1,
col2,
TRUNC(SYSDATE),
TO_DATE('09-sep-9999', 'dd-mon-yyyy')
FROM scd_srcIf the number of rows generally updated by the 1st statement is low (comparing to the volume of the scd_tgt table) an index on col1 in(scd_tgt table) would probably be benifical...
If you never delete from scd_tgt and if the performance goal is qiete important, then consider an /*+ APPEND */ hint with the insert ..
(depends on how many rows are inserted each time this code is ran).
As often this is not the only one solution but this the most simple one
-> In development always remind this addage: the most is simple the code is the better is (for everyone!) ..
Similar Messages
-
How to achieve the mapping logic - to validate incoming empty string
Dear all,
I have the following structure
i have written a udf to validate the field externalid.Hi,
If at sender side you are connecting to webservice/PROXY then you can limit by creating data type as below.
ID occurrence(1..1) min length(1)
Other than those you can check as below
ID --> mapwithdefault-->equals()-->Not-->map ID value to target field
constant(empty)/
Regards
Venkat -
To achieve the following custom template
Hi all,
I am trying to achieve the following layout for my word report with substantial amount of accompanying images. Pardon me that my enquiry looks like a book. ;-]
1.
- I need a LANDSCAPE orientation with two vertical columns. The columns are of different width, LEFT column takes 3 quarter of page; RIGHT column 1 quarter of page. I wish for this setting to run through out the whole document. [I know how to do this.]
- However, i only intend the LEFT/ 3 quarter column to carry the BODY TEXT, leaving the RIGHT/1 quarter column to carry accompanying IMAGES (they relate to body text next to them, and should MOVE with the body text). Read on and you will know why INLINE in INSPECTOR does not work.
- This means, all my RIGHT column through out the doc is only to be filled with images ONLY IF required by the body text next to them. If there is NO accompanying IMAGE on a page, the RIGHT column is intended to be EMPTY.
- To achieve the above, i tried [BREAK COLUMN]. If i understand correctly, it means after my body text fill up the LEFT column on each page, this setting help me to SKIP the NEXT column, which is always the right column. Correct me if i am wrong because in fact i dont quite get the DIFFERENCES of LAYOUT BREAK, SECTION BREAK, COLUMN BREAK etc.
- But the complicacy came in when my right column is intended for images. The [column break] will push my image to the next column. Or sometimes, to my confusion, it jumble up the whole thing into a mess.
2.
- I then tried an ALTERNATIVE setting. Instead of the above setting, could the following alternative be easier: that i set the right MARGIN to be taking up 1 quarter of the page width, hence leaving the body text to occupy 3 quarter of page.
- I then, drag drop image along the 1 quarter MARGIN? But aren't margin created to be EMPTY ZONE? I have tried dropping images in the margin area and it works, but i am afraid in the end teh whole doc will jumbled up? The images jumps to a random chaos because nothing is supposed to occupy MARGIN?
- In all, i need the body text to flow continuously ONLY on the LEFT column of all pages. And inserted images on right column should move with body text. The above two solutions does not seem correct. And i skim thru the ready-made templates Mac offers, none of them seem to fit either.
What is the best way to do this?
_YI think the second solution, with the graphics displayed in the margin, will work better. This way you don't have to keep track of column breaks. The graphics are not actually IN the margin, they are just displaying there. Every graphic is 'anchored' to some point in the text. If it is an 'in-line' graphic the graphic will move along with the anchor point just like a character of text. If it is a 'floating' graphic, it is supposed to keep its relative position on the page regardless of whether the text moves or not.
If your graphics move or jump when you insert a graphic with the the column format, it is probably because you are inserting the column break BEFORE its anchor position. If you turn on "Show Invisibles" you can more easily track where your paragraphs and anchors are.
BTW, the differences among the 'BREAKS' are these:
Layout Break - starts a new SECTION on the same page. It is known in other applications as a Continuous Section Break
Section Break - starts a new SECTION on a new page.
Column Break - ends the current column and starts a new column.
The difference between a new SECTION and a PAGE or COLUMN is that a Section can contain different headers, footers, columns and other layout options than the previous or subsequent sections. A new Page or Column uses the same layout settings as the current Page or Column.
As for why your graphics jump around - I notice many complaints here about graphics moving about whether they are place in-line or as floating objects. I don't use them often enough to offer a solution, but someone else may.
Good luck,
Terry -
How to get the current logical system?
Dear Abapers:
I can't find the logical system value from the table SYST, pls tell me how to get the current logical system name, Thanks!Hi,
Check with the table T000, the Logical system field name is LOGSYS.
Regards
Thiru -
After the new project by importing PPT release, how to achieve the release of the demo mode SWF, but not now only Click to continue?
Note:Captivate 5.5
Thks通过导入PPT新建的项目发布后,如何实现发布演示模式的SWF(自动播放),而不是交互模式的SWF(只能点击才能继续)?
-
How to achieve the results by Query ??
Hello Guys,
I have couple tables which I need to join to get the result....This is what is in the tables...
CList Table
CID, Name
A, ABC
B,CDE
C,JFK
JList Table
JID, Name
1, Something
2, Another
3, Else
4, Should be something
JOb_2_Courses
JobID, CourseID
1,A
1,B
2,C
Employee Table
EID, Job_ID
1A, 1
2A,1
3B,1
2C,2
23D,3
CStatus Table
StatusID, Desc
1,Completed
2,Pending Approval
3,Declined
4,Scheduled
5,Register
Now user can only register the course which are related with their job....NO course else.....
When they register it is moved to temp_course_registration and then once completed to COURSE_HISTORY
For Example : So Employee : 1A will see two courses to register A and B...
Say he registers A....it makes an entry in temp_course_registration table with the course id, employeeid and date....
With further steps once that status is updated to '1'.....the course is deleted from temp_course_registration and is moved to course_history........
Now to show to the user...I need to include all my tables in the query and on the basis of status, show necessary things to the user....
Output :
Course_ID, Status.............
Say if they completed the course will come from course_history, if in the process will come from temp_course_registration.....if nothing is in the tables for the specific employee...this means status is '5' and they need to register everything...
Can someone let me know, how to achieve the results....
Thanks,
HarsimratHello
I'm off home now so I can't look at the query, but for future reference, if you want to improve your chances of getting help, you need to provide simple create table statements, and test data to go with it. I've done that with what you provided and hopefully someone else will be able to help. Also, you were asked if you could provide this in your other thread...
CREATE TABLE CList(CID varchar2(1), Name varchar2(3))
insert into clist values('A', 'ABC');
insert into clist values('B','CDE');
insert into clist values('C','JFK');
CREATE TABLE JList(JID number, Name varchar2(30))
insert into jlist values(1, 'Something');
insert into jlist values(2, 'Another');
insert into jlist values(3, 'Else');
insert into jlist values(4, 'Should be something');
CREATE TABLE JOb_2_Courses(JobID number, CourseID varchar2(1))
insert into job_2_courses VALUES(1,'A');
insert into job_2_courses VALUES(1,'B');
insert into job_2_courses VALUES(2,'C');
CREATE TABLE Employee (EID varchar2(3), Job_ID number)
INSERT INTO employee VALUES('1A', 1);
INSERT INTO employee VALUES('2A',1);
INSERT INTO employee VALUES('3B',1);
INSERT INTO employee VALUES('2C',2);
INSERT INTO employee VALUES('23D',3);
CREATE TABLE CStatus(StatusID number, Descr varchar2(30))
insert into cstatus values(1,'Completed');
insert into cstatus values(2,'Pending Approval');
insert into cstatus values(3,'Declined');
insert into cstatus values(4,'Scheduled');
insert into cstatus values(5,'Register');HTH
David -
Script:how to solve the following
Hi to all,
Can u please tell me how to solve the following:
Created standard texts, styles, character strings and called them in layout sets copied the standard layout set from client '000' further modified the layout according to requirements.
Thanks in advance.
Regards
MonalisaSTATUS in USER_OBJECTS
"OBJECT_NAME"
"SUBOBJECT_NAME"
"OBJECT_ID"
"DATA_OBJECT_ID"
"OBJECT_TYPE"
"CREATED"
"LAST_DDL_TIME"
"TIMESTAMP"
"STATUS"
"TEMPORARY"
"GENERATED"
"SECONDARY"
"NAMESPACE"
"EDITION_NAME"
"CUSTOMERS"
70645
70645
"TABLE"
03-AUG-13
03-AUG-13
"2013-08-03:17:59:09"
"VALID"
"N"
"N"
"N"
1
"CUSTOMERS_PK"
70646
70646
"INDEX"
03-AUG-13
03-AUG-13
"2013-08-03:17:59:09"
"VALID"
"N"
"N"
"N"
4
"DEPARTMENTS_PK"
70656
70656
"INDEX"
03-AUG-13
03-AUG-13
"2013-08-03:18:32:32"
"VALID"
"N"
"N"
"N"
4
"EMPLOYEES"
70657
70657
"TABLE"
03-AUG-13
03-AUG-13
"2013-08-03:18:32:57"
"VALID"
"N"
"N"
"N"
1
"DEPARTMENTS"
70655
70655
"TABLE"
03-AUG-13
03-AUG-13
"2013-08-03:18:32:32"
"VALID"
"N"
"N"
"N"
1
"EMPLOYEES_PK"
70658
70658
"INDEX"
03-AUG-13
03-AUG-13
"2013-08-03:18:32:57"
"VALID"
"N"
"N"
"N"
4
"SUPPLIERS"
70659
70659
"TABLE"
03-AUG-13
03-AUG-13
"2013-08-03:20:25:41"
"VALID"
"N"
"N"
"N"
1
"SUPPLIERS_PK"
70660
70660
"INDEX"
03-AUG-13
03-AUG-13
"2013-08-03:20:25:41"
"VALID"
"N"
"N"
"N"
4
"PRODUCTS"
70661
70661
"TABLE"
03-AUG-13
03-AUG-13
"2013-08-03:20:28:32"
"VALID"
"N"
"N"
"N"
1
"PRODUCTS_PK"
70662
70662
"INDEX"
03-AUG-13
03-AUG-13
"2013-08-03:20:28:32"
"VALID"
"N"
"N"
"N"
4
"PERSONS_PK"
70687
70687
"INDEX"
10-AUG-13
10-AUG-13
"2013-08-10:22:37:34"
"VALID"
"N"
"N"
"N"
4
"PERSONS"
70686
70686
"TABLE"
10-AUG-13
10-AUG-13
"2013-08-10:22:37:34"
"VALID"
"N"
"N"
"N"
1
"APEX_SYS_PCK"
70776
0
"PACKAGE"
13-AUG-13
15-AUG-13
"2013-08-15:19:56:47"
"INVALID"
"N"
"N"
"N"
1
"GET_LOGIN_CREDENTIALS"
70775
0
"PROCEDURE"
13-AUG-13
13-AUG-13
"2013-08-13:22:26:49"
"INVALID"
"N"
"N"
"N"
1
"APEX_SYS_PCK"
70792
0
"PACKAGE BODY"
15-AUG-13
15-AUG-13
"2013-08-15:19:56:47"
"INVALID"
"N"
"N"
"N"
2
"EMP_MAINT"
70802
0
"PACKAGE"
15-AUG-13
15-AUG-13
"2013-08-15:19:54:39"
"INVALID"
"N"
"N"
"N"
1 -
How to achieve the project is obligatory entry when creating transport requ
Hello
How to achieve the project is obligatory entry when creating transport requestIn T-code SE03, under Administration -> Display/Change Request Attributes
Select "SAP_CTS_PROJECT" and hit the change button and then change the value of "Default for All Clients" to Mandatory
Hope this helps.
Thanks,
Naveed -
How to achieve the best quality when doing a narration?
Hello,
I'm trying to figure out how to achieve the best possible narration in a documentary I'm doing using the FCP voice over tool, a USB mic, and Final Cut Studio's audio filters. Am I on the right track? How do I clean up an average voice over narration? Do I need additional equipment? Any advice would be appreciated.
Thanks,
JordanThe best thing you can do is to record it properly in the first place - if you want it to sound good. The environment you record in is VERY important as is the choice of mic you use ... most of the consumer USB mics aren't all that great in terms of quality.
Record in an acoustically flat room with good sound dampening. Even a clothes closet will do in a pinch. Record through a mixer so you can monitor the VO artist as they record. I've found it better to record to tape (camera or VTR) with a pro mic than to use FCP's voice over tool.
-DH -
How to achieve the fatest Digital IO write speed?
How fast can I write to a digital IO port?How to achieve the fatest write speed? For test purpose, after config port, using DIO Port write.vi in a whileLoop by 6024E board,repeatly write1-2(01 and 10bin), i can only get a speed about 10kHz,i.e. every 106 us write a byte, can that be faster? how? software solution and hardware solution? Thanks!
Hey Yfayne,
It is very hard to say how fast you can write the digital lines on an E-Series device, because it is completely software and computer dependent. The exact same DAQ device with the exact same code will execute completely different on a 233MHz machine when compared to a 2.4GHz machine, because it depends on how fast the computer can execute the loop. If your program slows down to perform another task like opening another program or surfing the web it will slow the rate the computer can execute the loop and mess up the timing.
In addition, the digital lines on the E-Series use the DAQ-STC chip that was never designed for high speed. If you need a high speed hardware time device I would suggest using the PCI-6533 or PCI-6534. The devices were desig
ned for high speed digital applications and can easily exceed the 10 kHz rate consistently.
Here are a few links that you will find useful.
http://zone.ni.com/devzone/conceptd.nsf/webmain/467ed254f3a30b1286256a6f00720951
http://sine.ni.com/apps/we/nioc.vp?cid=1104〈=US
I hope this helps out.
Joshua P.
Application Engineering
National Instruments -
How to achieve the from and to date range in report builder 3.
I AM TRYING TO CREATE ONE REPORT FROM REPORT BUILDER 3.
WHERE I AM UNABLE TO DEFINE THE DATE RANGE.
HOW TO ACHIEVE THE DATE RANGE IN REPORT BUILDER.
NEED FROM DATE AND TO DATE FILTER IN REPORT BUILDER FOR PK DATE.Hi Ganesh,
According to your description, you create a report in Report Builder 3.0, and create two parameters FromDate and EndDate, now you want to use the parameters in your MDX query, right?
If in this case, here is a sample query for your reference.
select
{[Measures].[Internet Sales Amount]
} on columns,
{[Date].[Date].members} on rows
from(
select
STRTOMEMBER("[Date].[Date].&["+@StartDate+"]"):STRTOMEMBER("[Date].[Date].&["+@EndDate+"]")
) on columns
from [Adventure Works]
Reference:STRTOMEMBER
Regards,
Charlie Liao
TechNet Community Support -
How to identify the follow up relationship between two service ticket
Hi Folks,
How to identify the follow up relationship between two service ticket ?
Please help me on this...
Regards,
Shashi K, ReddyHi Pepe !
Thank you for the answer, but I dont find this structure ET_DOC_FLOW.....
Please let me know is that structure is correct ......
Regards,
Shashi K, Reddy
shashikumarreddy at gmail dot com -
Please help me.. how to rewrite the following java- for loop code in ada
int i, j, n = 100;
for (i = 0, j = 17; i < n; i++, j-- )
sum += i * j + 3;how to rewrite the following java- for loop code in ada
You should have a programming manual for Ada first. If you mean it the other way round, I think you subject line confused me. -
How to make the following settings in KM-Repositories?
Hello,
in our Enterprise Portal, we use one KM-repository for several usergroups, that contains documents. One usergroup is the administrator group, which edits the files etc. and all other groups should only be able to read the documents.
For both grupus, we use the Layout "Tree List Preview Explorer".
I'd like to make the following restrictions in the indicated layout:
1. Because we have deactivated the Portal Favorites for all users, the link "Add to Portal Favorites" should not be showed. How can I delete this menu item for all users in the menu bar "Folder" and in the right click mouse-menu? I already have deactivated the "Entry Point Provider for Favorites" but the link is indicated nevertheless.
2. I want to deactivate the menu bar "Folder" for all only-read user groups, so that it isn't longer indicated in the repository. Only for the administrator group, the menu bar "folder" should be indicated.
3. How can I deactivate the symbol to the "Context Menu" to the right of the folder-links for all users apart from the administrator group?
4. How can I blind out the columns "Rating" and "Annotations" for all users?
I hope you can help me,
AlexandraHi Alexandra,
first, welcome on SDN! About your question:
> we use the Layout "Tree List Preview Explorer".
I cannot find this, not on SP2 P32 (KM) nor on SP12 P1 (KM). Do you mean "ConsumerTreeListPreview"?! Or did you create some own named LayoutSet?
> the link "Add to Portal Favorites" should not be showed
1.) For the folder: Choose the corresponding CollectionRenderer (Consumer Menu). Choose the command group (ConsumerMenuGroup). Look out for the corresponding group (ConsumerFolderGroup), search for this, edit it, delete create_favorite_nodialog.
2.) For the items: Choose the corresponding resource renderer (ConsumerResourceRenderer). Choose the command group (DefaultResourceCommandGroup). Look out for the corresponding group (ResourceUserRelatedActionsGroup), search for this, edit it, delete create_favorite_nodialog.
> I want to deactivate the menu bar "Folder"
> for all only-read user groups
Right-dependent commands are not supported by standard means. You could implement your own command (a copy of com.sapportals.wcm.rendering.uicommand.UIGroupCommand) and implement the logic there. Or you could call the navigation iView through a proxy iView which sets the layoutset dynamically and provide two different layout sets (that's the way I would implement such a feature).
> How can I deactivate the symbol to the "Context Menu"
> to the right of the folder-links for all users apart
> from the administrator group?
See my last paragraph for the question how to differentiate.
To delete this, edit the ConsumerResourceRenderer and set Command Display to "off".
> How can I blind out the columns "Rating"
> and "Annotations" for all users?
Edit the ConsumerCollectionListRenderer and set Displayed Properties to "rnd:icon,rnd:displayname(contentLink)+rnd:action,contentlength,modified" (this is the setting of the base renderer ConsumerCollectionRenderer without the properties you want to remove).
ATTENTION: I explained all the settings on the original objects. I definitely suggest first to copy original objects (e.g. by an "Advanced Copy" of the corresponding LayoutSet) and then to modify these copies.
Hope it helps
Detlev
PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance! -
How to achieve the "High Octane Stack" guitar tone?
How can I achieve the "High Octane Stack" sound shown on the Logic Express 'Plug-Ins and Sounds' page? ( http://www.apple.com/logicexpress/plug-ins.html - Listed under Metal Stacks)
I've been trying for days and can't get anything remotely close.
I'm running directly into a Presonus Firebox which is connected to my Mac via Firewire.Hi
The sound is generated using a channel strip like this
The Amp Designer is set:
The EQ is set to Vintage within AmpDesigner
The EQ Plugin is set:
The Noisegate is:
(hmmm problem with uploading one more pic, I'll do it in another post)
CCT
Maybe you are looking for
-
Animated Gif's - Applying Clone Stamp to all layers
I have some animated gif's and I want to clone a section of all layers that compose it. I have PS2 and PS4. PS2 allows me to open and sample all layers of the GIF but wont let me apply the clone to more than one layer at a time, PS4 wont let me open
-
HTTP 500 server error as follows: org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated. An error occurred at line: 2 in the jsp file: /listStore.jsp *line#2 is the usebean statement in the j
-
Dear All, We are in a process installing sap clustered system for 640 basis release o win 2k3 with Oracle 10.2.0.4.0 However i have followed this steps as below.. Install windows on NODE-A & NODE- B, Update windows, Install required hotfixes which co
-
On button click of Infopath forms select multi select list box values...
Hi, We have multi select list box on one of the info path forms. We have placed on button on this form. If user clicks on this button we want to select some of the values in Multi select list box (check box). Is it possible if yes how can we achieve
-
Quotations PCUI - Send Attachements with the Quotation-Smarforms
Hi Experts, I've got a question concerning smartforms and attachments in the PCUI - Environment. We've created a smartform in the quotation application and we starting sending this smarftorm with actions, that means if the Quotation is ready to send,