How to construct such SELECT
I simplify my problem as much as it is possible.
I have two tables TABLE1 and TABLE2. In both table key look:
key1 key2.
I have also an internal table INT_TABLE2 which is of type of TABLE2 which have some entries.
I want to select from TABLE1 all not existing pairs (TABLE1.key1 = TABLE2.key1 AND TABLE1.key2 = TABLE2.key2) for all entries in INT_TABLE2.
I tried
SELECT T2~key1
INTO CORRESPONDING FIELDS OF TABLE et_not_pairs
FOR ALL ENTRIES IN INT_TABLE2
FROM ( TABLE1 AS T1 OUTER JOIN TABLE2 AS T2
ON T1~KEY1 = T2~KEY1 AND
T1~KEY2 = T2~KEY2 )
WHERE T2~KEY1 = INT_TALBE2-KEY1 AND
T2~KEY2 = INT_TALBE2-KEY2.
but without effect (error)
Hi!
Always check, is the internal table empty or not, because with an empty internal table, SAP will read ALL entries from T1 and T2, and this will cause bad performance, and/or abap dump (due to the long runtime).
IF NOT INT_TABLE2 IS INITIAL.
SELECT T2~key1
INTO CORRESPONDING FIELDS OF TABLE et_not_pairs
FROM TABLE1 AS T1 OUTER JOIN TABLE2 AS T2
ON T1~KEY1 = T2~KEY1 AND
T1~KEY2 = T2~KEY2
FOR ALL ENTRIES IN INT_TABLE2
WHERE T2~KEY1 = INT_TABLE2-KEY1 AND
T2~KEY2 = INT_TABLE2-KEY2.
ENDIF.
Regards
Tamá
Similar Messages
-
Tricky SELECT : Any idea how to construct this?
Hi guys,
It's me again with another very (tricky) statement.
Imagine the following scenario:
DROP TABLE persons;
CREATE TABLE persons
person_id NUMBER(10),
person_name VARCHAR2(100)
INSERT INTO persons(person_id, person_name)
SELECT 1, 'User 1' FROM dual UNION ALL
SELECT 2, 'User 2' FROM dual UNION ALL
SELECT 3, 'User 3' FROM dual UNION ALL
SELECT 4, 'User 4' FROM dual UNION ALL
SELECT 5, 'User 5' FROM dual;
DROP TABLE departments;
CREATE TABLE departments
dpt_id NUMBER(10) UNIQUE,
dpt_name VARCHAR2(100),
dpt_parent_id NUMBER(10)
INSERT INTO departments VALUES(1, 'Company', null);
INSERT INTO departments VALUES(2, 'HR', 1);
INSERT INTO departments VALUES(66, 'Recruitment', 2);
INSERT INTO departments VALUES(33, 'Logistics', 2);
INSERT INTO departments VALUES(39, 'Fleet management', 33);
INSERT INTO departments VALUES(3, 'SALES', 1);
INSERT INTO departments VALUES(31, 'Local Sales', 3);
INSERT INTO departments VALUES(60, 'European Sales', 3);
INSERT INTO departments VALUES(61, 'Germany', 60);
INSERT INTO departments VALUES(62, 'France', 60);
INSERT INTO departments VALUES(620, 'Paris', 62);
INSERT INTO departments VALUES(621, 'Marseilles', 62);
INSERT INTO departments VALUES(38, 'American Sales', 3);
INSERT INTO departments VALUES(34, 'Asian Sales', 3);
INSERT INTO departments VALUES(4, 'IT', 1);
INSERT INTO departments VALUES(222, 'Helpdesk', 4);
INSERT INTO departments VALUES(223, 'French Speaking', 222);
INSERT INTO departments VALUES(224, 'Another level', 223);
INSERT INTO departments VALUES(5, 'LEGAL', 1);
INSERT INTO departments VALUES(-10, ' !! VIP DEPARTMENT !! ', 1);
INSERT INTO departments VALUES(9999, 'VIP 01', -10);
INSERT INTO departments VALUES(9998, 'Politicians', 9999);
INSERT INTO departments VALUES(9997, 'Singers', 9999);
INSERT INTO departments VALUES(9996, 'Korean Singers', 9997);
INSERT INTO departments VALUES(6325, 'VIP 02', -10);
INSERT INTO departments VALUES(6311, 'Steering Bord', 6325);
INSERT INTO departments VALUES(6310, 'Another high level group', 6325);
DROP TABLE assignments;
CREATE TABLE assignments
person_id NUMBER(10),
dpt_id NUMBER(10),
job_code VARCHAR2(10)
INSERT INTO assignments(person_id, dpt_id, job_code) VALUES(1, 66, 'MAIN');
INSERT INTO assignments(person_id, dpt_id, job_code) VALUES(2, 39, 'OTHER');
INSERT INTO assignments(person_id, dpt_id, job_code) VALUES(3, 38, 'MAIN');
INSERT INTO assignments(person_id, dpt_id, job_code) VALUES(3, 9996, 'CODE');
INSERT INTO assignments(person_id, dpt_id, job_code) VALUES(4, 66, 'CODE');
INSERT INTO assignments(person_id, dpt_id, job_code) VALUES(4, 620, 'MAIN');
INSERT INTO assignments(person_id, dpt_id, job_code) VALUES(4, 6311, 'OTHER');
INSERT INTO assignments(person_id, dpt_id, job_code) VALUES(5, 66, 'CODE');
INSERT INTO assignments(person_id, dpt_id, job_code) VALUES(5, 620, 'OTHER');
COMMIT;These tables are quite obvious to understand. But here is a small explanation:
I have a first PERSONS table. THis table contains a list of person (id and name).
I have a second table with DEPARTMENTS. It contains a hierarchical organisation structure.
I have a third table with assignment. One person can have many assignments. Each are on a different department and they have a code...
What I would like to do is to write a SELECT with this logic:
- When a person has one assignments, the SELECT should return it. Whatever the job_code is.
- When a person has more than one assignments then :
- If he has an assignments in a VIP group (an ancestor organisation with id -10), then I should select only this kind of assignments and the main ones (job_code = MAIN).
- If he has no assignments in a VIP group, I should return them all.
In my scenario: I should have:
SELECT person_id, dpt_id, job_code
FROM assignments
1, 66, 'MAIN' -- one assignments only
2, 39, 'OTHER' -- one assignments only
3, 38, 'MAIN' -- this kind of job should always be returned
3, 9996, 'CODE' -- is in a vip group
4, 620, 'MAIN' --this kind of job should always be returned
4, 6311, 'OTHER' -- vip group
5, 66, 'CODE' -- not in a vip group
5, 620, 'OTHER' -- no vip groupAny idea on how I can construct my SELECT?? Im using Oracle 10g.
Thanks in advanceHi,
Here's one way:
WITH vip_departments AS
SELECT dpt_id
FROM departments
START WITH dpt_id = -10
CONNECT BY dpt_parent_id = PRIOR dpt_id
, assignments_plus AS
SELECT a.*
, DENSE_RANK () OVER ( PARTITION BY person_id
ORDER BY NVL2 (v.dpt_id, 10, 20)
) AS rnk
FROM assignments a
LEFT OUTER JOIN vip_departments v ON a.dpt_id = v.dpt_id
SELECT person_id, dpt_id, job_code
FROM assignments_plus
WHERE rnk = 1
OR job_code = 'MAIN'
;NVL2 (v.dpt_id, 10, 20) returns 1 if an individual row is in the vip group, and 20 if it is not. If a row is to be chosen in the end, then this value must be the lowest value returned for any row with the same person_id. That's what DENSE_RANK is doing; it returns 1 for all the rows with the lowest value.
Edited by: Frank Kulash on Apr 6, 2012 6:56 AM -
How Do I Drag Select Multiple Comments or Annotations in Adobe Acrobat Pro 9
How Do I Drag Select Multiple Comments or Annotations in Adobe Acrobat Pro 9
Hello Sara,
Yes, command+click will work to select multiple comments. However, I'm working with some PDFs that have a substantial number of comments and this is taking quite some time to select them all. Additionally, it is tricky to click some of them, and if I mis-click, all the selection work is undone and everything becomes deselected. I'd like to know if there is a simpler way to select many multiple comments, such as a simple drag selection in Adobe Acrobat Pro 9. -
How to create Dynamic Selection List containg file names of a directory?
Hi,
I need a Selection List with a Dynamic List of Values containing all file names of a particular directory (can change through the time).
Basically, I need an Iterator over all file names in a directory, which could be used for Selection List in a JSF form.
This iterator has nothing to do with a database, but should get the names directly from the file system (java.io.File).
Can anybody tell me how to create such an iterator/selection list?
I am working with JDeveloper 10.1.3.2, JSF and Business Services.
Thank you,
IgorCreate a class like this:
package list;
import java.io.File;
public class fileList {
public fileList() {
public String[] listFiles(){
File dir = new File("c:/temp");
String[] files = dir.list();
for (int i = 0; i < files.length; i++) {
System.out.println(files);
return files;
Right click to create a data control from it.
Then you can drag the return value of the listFiles method to a page and drop as a table for example.
Also note that the Content Repository data control in 10.1.3.2 has the file system as a possible data source. -
How to mofidy the selection text for a report
Dears,
Do you know how to modify a selection text in the selection screen of a standard report, such as changing "Storage Location" in the selection screen of report MB5B to "storage Loc"?
one of a way to realize it is to modify the text of relevant data element.
except modifying the data element directly, It seems that use SE63 could do it, but I forgot how to use it.
Thanks all for your reply.
ZhongkaiHi Liu,
Check this link for translations thru SE63:
http://help.sap.com/saphelp_sm310/helpdata/en/b4/54601d77f38e429ffad9e3e11c1b25/content.htm
Hope this helps you.
Regards,
Chandra Sekhar -
How to construct Work center Hirerchy in Production Planning.
Hi Experts,
How to construct Work center Hirerchy in Production Planning.
Thanks in advance.Amit,
I guess you must have overlooked the rules of engagement for this forum. It is customary for questioners to first perform basic research before posting any questions.
First, search in the forums (search box in the upper right of this page). FYI The question you raised has been covered dozens of times.
Next, check online help. This help is generic, and not generally specific to a particular industry:
http://help.sap.com
Work Center Hierarchy:
http://help.sap.com/saphelp_erp60_sp/helpdata/en/b1/c037ae439a11d189410000e829fbbd/frameset.htm
Next, look for generic solutions solutions in Best Practices. Basic index at
http://help.sap.com/saap/sap_bp/BL_IN/html/Content_Library_BL_EN_IN.htm
Next look for industry specific solutions in Best Practices:
http://help.sap.com/content/bestpractices/industry/index.htm
If you are experiencing a problem, or you believe that SAP is not working per the online help, you can then search OSS notes.
http://service.sap.com/notes
Next search in one of the standard online search engines (such as Google).
Only after you have performed all of these tasks, and studied all of the online help that is supplied for free by SAP, should you then consider posting a question to these forums.
If you are unwilling or unable to perform such research, then you should probably engage a consultant to assist you. All consultants use searches to assist them in designing and executing solutions. If you intend to one day become a consultant, you would be wise to cultivate this skill.
Best Regards & Good luck,
DB49 -
TreeByNestingTableColumn - how to set lead selection?
Hallo Guys!
I am using TreeByNestingTableColumn in my project. I am searching for a way to select a certain context element inside of the tree shown in such a table. I actually know that setLeadSelection doesnt work properly in such a case.
Ive already read this very helpful blog /people/valery.silaev/blog/2005/06/20/master-of-columns-part-ii searching for a solution, but its seemed not to be there.
Valery had shown how to read the selected context element recursively, but there is nothing about to how to set the needed lead selection for a certain one.
In my scenario, I am loading the whole table (10-15 elements) with only two levels of hierarchy. After the user clicks on a button I have to reload this table but keep the selection of the previously selected element.
The try using getTreeSelection didnt succeed either.
Any ideas?
Many Thanks
Dimitri
Edited by: Dmytro Lubenskyy on Apr 1, 2008 3:44 PMHi,
You can use the following methods to set the selection.
IWDNodeElement nodeElement = wdContext.nodeOrders().getElementAt(2);
wdContext.nodeOrders().setTreeSelection(nodeElement);
Regards
Ayyapparaj -
How to save the selected rows from Advance table into database
Hi
I have requirement like..
In custom page , Manager Search the Candidates and selects the candidate ROWS from advance table.
The reqt is how to save the selected multiple rows into the database.hi Reetesh,
In Custom page
Supoose the Recruiter Search is for Position Finance Mangager , it retrieves 100 rows , out of which Recruiter select 10 rows .
So in Such scenario how to save this 10 rows against Recruiter
, i mean , Is i need to create custom table, to save Recruiter , these selected 10 rows.
I hope u understand my question -
How do I easily select a group of emails in Apple Mail if I want to delete them? In other words, what do I select if I mark the first and last email to delete everything in between? Thanks.
I have this same issue. I have over 100 email addresses that I need to add to a group. The issue is not making the group, it's getting the email addresses from Mail to Contacts.
Dragging the email addresses does nothing. You can copy the addresses, but there's nowhere to put them. You can make a VCF for an email address, but then you have to find all of them to add them to the group. How do you automate this?!
I'm astounded that there's so little support for such a common issue for which people have been asking for years. -
How to write such procedure?
I have a DML trigger on a table. whenever there is a change to the table, the old records will be written to another backup table created before. I want to implement this for many tables in the database. Basically, I want a procedure that takes table name as an input and creats a backup table and a trigger for the input table.
How to write such procedure?
thanks....a simple block to get you started...not tested:
declare
t varchar2(64) := 'my_table'; --your table name as a parameter
begin
execute immediate 'create table ' || t || '_bck as select * from user_tables where 1 = 0';
-- thinking you'd create the trigger on your base table, not the backup
execute immediate 'create trigger ' || t || '_dml_trigger before delete or insert or update on ' || t || ' referencing...you get the point
end;Hope this helps. If you're not the DBA you may want to discuss this train of thought with him/her.
Cheers. -
How to construct TaskCompletionXML and feed it back to workflow?
I have a workflow process running on a remote server, and it has created
a task for me to complete, now, how to construct the TaskResponseXML?
should I use a TaskMessage Object? then what data should i fill into it?
I have written in the business data, but it seems that's not enough,
there must be some extra data I should write in, what are they?
It's great if you can give sample code. thx alot:)This is the way how I achieved it.
In the Worker control interface,
* @jc:task-complete enabled="true"
* @jc:select task-id="{taskId}"
* @jc:task-update response="{document}"
public void completeTask(String taskId, WhateverXMLDocument document);
The WhateverXMLDocument is defined by yourself. And the the @jc:task-update
response="{document}" will forward the document to the onTaskCompleted()
event callback handler of your task control.
Bob Li
Senior Consultant
[email protected]
"mogleo" <[email protected]> wrote in message
news:[email protected]..
I have a workflow process running on a remote server, and it has created
a task for me to complete, now, how to construct the TaskResponseXML?
should I use a TaskMessage Object? then what data should i fill into it?
I have written in the business data, but it seems that's not enough,
there must be some extra data I should write in, what are they?
It's great if you can give sample code. thx alot:) -
How do I highlight selected text in the Pages, Keynotes?
How do I highlight selected text in the Pages, Keynotes?
To answer your question foor your iOS Device using Pages or Keynote for iOS: You can't highlight as you might in many note taking apps for iPad, etc.
The best you can do at this point is to change the selected text's color by selecting the text > Style Menu (wrench) > Tap on the Font > Tap on the Color Box to reveal choices.
If you would like to join the chorus of folks wishing such a feature were in Pages and Keynote, you can leave feedback for the people at Apple:
http://www.apple.com/feedback/ -
How can give only select privilge to user
hi all
how can give only select privilge to user
"connect" have many sytem privilge such as
alter session,
create cluster,
create database link,
create sequence,
create session,
create synonyms
create table,
create view,
"resource" have many sytem privilge such as
create cluster,
create indextype,
create operator,
create procedure,
create sequence,
create table,
create trigger,
create type
i want give only select privige to userafzal wrote:
hi all
how can give only select privilge to user
"connect" have many sytem privilge such as
alter session,
create cluster,
create database link,
create sequence,
create session,
create synonyms
create table,
create view,
"resource" have many sytem privilge such as
create cluster,
create indextype,
create operator,
create procedure,
create sequence,
create table,
create trigger,
create type
i want give only select privige to userFirst of all, SELECT privilege is OBJECT type of privilege. It is not a SYSTEM privilege.
Some of the examples for granting this priv I have mentioned below:
Examples
Suppose you own emp table. Now you want to grant select privilege on this table to other user “SAMI”.
grant select on emp to sami;Suppose you want to grant select privilege on emp to all other users of the database. Then
grant select on emp to public; -
How to construct a shortcut to a topic for distribution?
RH10, WebHelp Pro
I find that if I "copy shortcut" of a topic in the browser (IE), the resulting shortcut looks like this:
http://server.server/context/directory/server/general/projects/Myproject/Myproject.htm#top icname.htm
When I then use this URL on our intranet, it does find the correct topic, however the Window is not correct. Specifically, it is using the correct skin but it displays buttons in the toolbar that are NOT selected in the window properties. For example, I do not have "Glossary" selected, but it gives me the glassary button anyway.
However if the help system is opened via the standard URL which opens the first topic, the window is properly configured, and I assume this is because the string that opens the help system includes the name of the Window.
Is there a way to insert the Window name in a copied topic shortcut so that if a user enters a topic directly (without opening the helpfile using the standard URL) they will see the correctly confugured toolbar?
Thank you.Willam, thank you.
Is this method available if I am not using application-based CSH?
We publish via WebHelp Pro but there is no associated application CSH. The users access the WebHelp content directly through the browser (IE) rather than through a program interface.
Most users, most of the time, will access the WebHelp by opening the default landing page and then use hyperlinks or the TOC from there to locate a particular topic page. However, as an alternative we often want to provide a direct link to a page that may be 2, or three levels down the tree.
If we give them just the URL for that page, they get the page without the navigation pane. Our preference is that the navigation pane (and the Search buttons, etc.) always open together with the page.
In the RH9 documentation I have not found any guidance on how to construct a URL that activates the frameset except by going in via the default start page.
Mike -
Itunes match how do you to select multiple songs or do you click each one
In ITunes match how do you to select multiple songs to download to pc or do you have to click each one.
First make sure you have the current version of iTunes, which is actually 10.5.1. I had to manually download it from apples website, for some reason, it wouldnt auto-update.
http://www.apple.com/itunes/download/
Once that is complete, go to the iTunes store. In the Quick Links secion to the right, you should see iTunes Match. This will prompt you to activate your subscription to iTunes match. After that it should ask you to add your computer and once youve done that, it should begin the process of scanning your library and adding it to the cloud
Alternatively, once you activate your subscription, you can also go to the Store dropdown menu in iTunes and select Turn On iTunes Match.
Maybe you are looking for
-
Log in Screen hangs while trying to install upgrade download of elements 13
I downloaded the update of Premier elements 13, tried to run the install. I first get a message that says my machine needs to be restarted and I'm given the option to quit or ignore. I restarted multiple times and still get that message. I click
-
my family shares one apple id among 4 devices. how do i make it IMPPOSSIBLE for my children (i pad mini and i pod touch 5) to view my contacts and texts while still sharing my apps? please help. been working on this for hours.
-
BAPI_GOODSMVT_CREATE for Processing a Goods Reciept for a Delivery
We have a requirement to use the Goods Movement Create BAPI to create Goods Reciepts for deliveries since it mimics MIGO. Problem is that we cannot get this BAPI working to Goods Reciept our Deliveries... Has anyone used it for Deliveries? What data
-
Aperture 3 Importing Folders as Projects is taking days to complete
Hello, I acquired Aperture 3 a week ago and decided to give it a try. I've been using Lightroom since version 1. All my photos are in NEF (Nikon RAW) format and stored on an External HD. I used the A3 option FILE > IMPORT > FOLDERS AS PROJECTS comman
-
How to add web page in office button of ms office 2007 using c#?
I want to add web page in office button in ms office 2007 using c#. How to add it? ribbon menu button should be in office button. when i click menu the web page should display in menu itself. tell me the solution.