Stuck on "Add Query"
Hi Gurus,
Just Installed Dashboard Builder and tried the query builder, however after login in on our network to select a universe it get stuck on "Add Query" panel where you cant do anything (nothing happens when clicking 'back' and 'next') you can only close the window by clicking the close button.
is this a know issue? are there any other who encountered this problem?
my version below
Version: 6.0.0.0
Build: 14,0,2,364
Appreciate your kind response.
Thanks and Best Regards,
John
Hi, I have the same problem but in my case appears a new window with the following error:
Error de procesamiento de solicitud. (XLS 000009) [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
I've already included this: "C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win64_x64" in the PATH enviroment variable, but the problem persists.
Any help, please?
My version of Excel is 2007 and my SO: Windows 7
Thank you
Hi all! Just to say that I've resolved the problem adding an ODBC System DNS, instead of User DNS.
Edited by: Estibalitz de la Cal on Jan 18, 2012 2:24 PM
Similar Messages
-
How to use Add Query Criteria for the MySQL data Base in Netbeans ?
How to use Add Query Criteria for the MySQL data Base in Netbeans Visual web pack.
When the Query Criteria is add like
SELECT ALL counselors.counselors_id, counselors.first_name, counselors.telephone,counselors.email
FROM counselors WHERE counselors.counselors_id = ?
when i run this Query in the Query Window
i get a error message Box saying
Query Processing Error Parameter metadata not available for the given statement
if i run the Query with out Query Criteria its working fine.*I am glad I am not the only one who have this problem. Part of issue has been described as above, there are something more in my case.
Whenever I try to call ****_tabRowSet.setObject(1, userDropList.getSeleted()); I got error message as shown below:*
The Java codes are:
public void dropDown1_processValueChange(ValueChangeEvent event) {
Object s = this.dropDown1.getSelected();
try {
this.User_tabDataProvider1.setCursorRow(this.User_tabDataProvider1.findFirst("User_Tab.User_ID", s));
this.getSessionBean1().getTrip_tabRowSet1().setObject(1, s);
this.Trip_tabDataProvider1.refresh();
} catch (Exception e) {
this.log("Error: ", e);
this.error("Error: Cannot select user"+e.getMessage());
SQL statement for Trip_tabRowSet:
SELECT ALL Trip_Tab.Trip_Date,
Trip_Tab.User_ID,
Trip_Tab.Destination
FROM Trip_Tab
WHERE Trip_Tab.User_ID = ?
Error messages are shown below:
phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@5abf3f) threw exception: com.sun.rave.web.ui.appbase.ApplicationException: java.sql.SQLException: No value specified for parameter 1 java.sql.SQLException: No value specified for parameter 1
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.cleanup(ViewHandlerImpl.java:559)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.afterPhase(ViewHandlerImpl.java:435)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:274)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
tandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.sql.SQLException: No value specified for parameter 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1674)
at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1622)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1332)
at com.sun.sql.rowset.internal.CachedRowSetXReader.readData(CachedRowSetXReader.java:193)
at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:979)
at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:1439)
at com.sun.data.provider.impl.CachedRowSetDataProvider.checkExecute(CachedRowSetDataProvider.java:1274)
at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorRow(CachedRowSetDataProvider.java:335)
at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorIndex(CachedRowSetDataProvider.java:306)
at com.sun.data.provider.impl.CachedRowSetDataProvider.getRowCount(CachedRowSetDataProvider.java:639)
at com.sun.webui.jsf.component.TableRowGroup.getRowKeys(TableRowGroup.java:1236)
at com.sun.webui.jsf.component.TableRowGroup.getFilteredRowKeys(TableRowGroup.java:820)
at com.sun.webui.jsf.component.TableRowGroup.getRowCount(TableRowGroup.java:1179)
at com.sun.webui.jsf.component.Table.getRowCount(Table.java:831)
at com.sun.webui.jsf.renderkit.html.TableRenderer.renderTitle(TableRenderer.java:420)
at com.sun.webui.jsf.renderkit.html.TableRenderer.encodeBegin(TableRenderer.java:143)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:810)
at com.sun.webui.jsf.component.Table.encodeBegin(Table.java:1280)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:881)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:182)
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:133)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Also when I tried to update my MYSQL connector / J driver to version 5.1.5 from 5.0.5 (NB 5.5.1) and 5.0.7 (NB 6.1), I could not get it work (looooong time to search some JDBC classes and with no response in the end) on both of my Netbean 5.5.1(on PC) and Netbean 6.1(on laptop) IDEs.
Could anybody look into this issue.
Many thanks
Edited by: linqing on Nov 22, 2007 4:48 AM -
i have stuck in this query. it is giving compile error that v_customerloop invalid identifier. this does not make sense because if i comment the sql, it runs fine and i can actually see the count in the dbms output. i tried commenting out some of the where clauses but cannot pinpoint where i am making a mistake.
can some one see if i am doing something out of ordinary.
declare
-- Local variables here
o_errorcode NUMBER;
o_errortext VARCHAR2(1000);
o_LoopId NUMBER;
i_CustomerLoop Kroner.Pkgsldcommon.T_CUSTOMERLOOPTYPE;
To_CustomerLoop Kroner.Pkgsldcommon.T_CUSTOMERLOOPTYPE;
v_sql VARCHAR2(3000);
v_CustomerLoop Kroner.t_CustomerLoopElement := Kroner.t_CustomerLoopElement();
begin
i_CustomerLoop(1).Cable := '138-2';
i_CustomerLoop(1).coup := '501';
i_CustomerLoop(1).TermSysID := 1178050;
i_CustomerLoop(1).CentralOfficeName := 'TOROON45';
i_CustomerLoop(2).Cable := '138-2';
i_CustomerLoop(2).coup := '503';
i_CustomerLoop(2).TermSysID := 1178052;
i_CustomerLoop(2).CentralOfficeName := 'TOROON45';
FOR i IN 1..i_CustomerLoop.COUNT -- Create a instance of Kroner.o_CustomerLoopElement
LOOP
v_CustomerLoop.Extend();
v_CustomerLoop(i) := Kroner.o_CustomerLoopElement(co_clli => i_CustomerLoop(i).CentralOfficeName,
cable => i_CustomerLoop(i).Cable,
coup => i_CustomerLoop(i).coup,
termsysid => i_CustomerLoop(i).TermSysID,
landing_number => i
END LOOP;
dbms_output.put_line('v_CustomerLoop length' || v_CustomerLoop.Count);
v_sql:= 'select loop_f1.loopid
from nrms_interface.wdn_landing seg_f1, nrms_interface.wdn_loop_landing_association assoc_f1, nrms_interface.wdn_potential_loop_makeup loop_f1,
nrms_interface.wdn_landing seg_fx, nrms_interface.wdn_loop_landing_association assoc_fx,
table(cast( v_CustomerLoop as Kroner.t_CustomerLoopElement)) input_loop
where loop_f1.CO_CLLI = v_CustomerLoop(1).co_clli
and loop_f1.LOOPID = assoc_f1.LOOPID
and assoc_f1.landing_NUMBER = v_CustomerLoop(1).landing_number
and assoc_f1.landing_ID = seg_f1.landing_ID
and seg_f1.CABLE = v_CustomerLoop(1).cable
and (seg_f1.low_coup <= v_CustomerLoop(1).coup and seg_f1.high_coup >= v_CustomerLoop(1).coup)
and seg_f1.TERMSYSID = v_CustomerLoop(1).termsysid
and assoc_f1.landing_number = 1
and loop_f1.loopid = assoc_fx.loopid
and assoc_fx.landing_ID = seg_fx.landing_id
and assoc_fx.landing_number = input_loop.landing_number
and seg_fx.CABLE = input_loop.cable
and (seg_fx.low_coup <= input_loop.coup and seg_fx.high_coup >= input_loop.coup)
and seg_fx.termsysid = input_loop.termsysid
group by loop_f1.loopid
having max(assoc_fx.landing_NUMBER) = :noOflandings
and count(case when assoc_fx.landing_number = input_loop.landing_number then 1 else 0 end) = :noOflandings';
EXECUTE IMMEDIATE v_sql INTO o_LoopId
USING v_CustomerLoop.count,v_CustomerLoop.count;Hi,
I don't know much about object types, but I think that the error is due to the usage of v_CustomerLoop variable in a different context.
Imagine that using the EXECUTE IMMEDIATE you spawn a different process that communicates with the caller using prameters (USING) and return values (INTO).
In this case, the variable is not visible by the new environement (it is not the same behaviour of nesting a BEGIN/END block in a procedure and referencing a parent variable)
Hope this helps
Max -
Add query to Main menu in SAP 2007
Hi all!
Can i add query to main menu in SAP 2007. Now, i only add done query to My menu.
Thank you!Hi Tien,
You cannot add the Query to the main menu.you can try the other way round. Paste the query in the crystal report and then check the report is comming OK. Then add it to the main menu via crystal Reports.
Regards,
Raj -
Add Query Reports to My Cockpit
Hello Experts,
Is it possible to add query reports to My Cockpit in SAP 8.81 under the Common Functions window? If so, how? Currently these reports reside under the My Menu tab which is not enabled when My Cockpit is active. If this not possible I would need to convert those report to Crystal Reports which will take some time.here is a sample dashboard for b1.
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e0bd3605-e1ad-2d10-488d-f2e4fede1d46 -
BO4 - Dashboards - not able to add query
Hi,
Getting message below when add component to dashboard ad try and add query.
Have never used dashboards before and have a few .unx universes.
Using bo4 sp08.
Have read the note checked out the url and added it as an alias to the server.xml on the actual server but still same error.
I've changed the port number under which the web services run from 6405 to the one Tomcat uses but not sure if this is best practice and now runs.
No firewall issues as same domain so not sure why doesn't work on 6405
Any thoughts.
ThanksHi,
Manged to get it to work.
We chnaged the url in cmc/applications/web services to remove th 6405 port number as we are using tomcat and the 6405 refers to the web application container service which isn't running.
Thanks -
please need help here
im trying to use the "add query" in the query browser- (in dashboard -)
and when i do that its ask to connect to bo4///
i insert the connection data- and start to run with the query
the problem is that it dont show me anything in the first step/"select a universe"
despit the fact that i build universe in bo/
please help me to understant what i was doing wrong/???????????and what i need to fix
yossiHi Yossi,
In BI4.0, there are now two separate tools for creating universes. The "Universe Design Tool" is the old "Designer" tool. This tool can only create universes in the old format, which will end in .unv.
The second (new) tool is called the "Information Design Tool" (IDT). This tool can only create universes in the new format, which will end in unx.
So, you cannot create a universe using the "Universe Design Tool" that can be used in a query in Dashboard Design.
The IDT manual is here: http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_info_design_tool_en.pdf
You can create new folders for universes in the CMC, by clicking on Universes in the Organize column. Note that unx and unv universes have different icons, and unx universes will show the extension unx.
Hope this helps!
DG -
Detail differentiation between add query,combined query and sub query
HI
I would like to know the detail differentiation between add query,combined query and sub query with universe
correct me if I a wrong
Add query : adding of different query from different universe and also with in same universe.
Combined query : combining query using operators(Union,intersection,minus)with in same universe.
Sub query :getting results from the sub query and the result serves as the data for main query within same universe.Hi,
I would advise you to check the product documentation under http://help.sap.com/
regards
Steph -
I do not see the Add Query Criteria
Hi, this is CarloSilva, from Brazil. I do not see Add Query Criteria. If I double -click objRowSet, I open Query Editor and see the table. I can add and delete tables. I can run query, too. But I do not see the Design Grid in query editor. Are there some aditional setting for my Java Studio Creator?
Please, help meHi Carlo,
On opening the Query editor window you should be able to see 4 different areas. In the first one you will see the tables, the second one will show the list of columns, the third one has the SQL statement and finally the output window in which you can see the results of your query on running.
You can see 3 sets of up and down arrows on the left side of these areas. If you are not able to see any one of the above then click on the down arrow key and the corresponding area should become visible. If the whole centre area gets covered with one particular area then click on the up arrow and click on a different down arrow.
Hope this helps you.
Cheers :-)
Creator Team -
Add Query Task Excepcion OSM 7.0.3
Hello,
I am creating a new project in the version 7.0.3 of OSM but when I go to the permissions tab of the order and add a role, if I want to associate a query task for this role, gives the following exception.
"Sequence Model Orchestration Error - Detail from ncaOsmQueryTask Order query task is not defined in ProjectOrder workspace."
When I open a project created in version 7.0.2 of OSM with this same functionality throws no exception when compiling.
But if this project will add another query task immediately throws the error when compiling.
If anyone knows a similar case can help me I would appreciate your input.
regardsHi Andres,
We tried the same procedure at our end with 7.0.3 and it worked well. The question that comes to my mind is what version of Design Studio are you using? I would suggest you to use DS 3.1.3.1 and above.
Thanks,
Deep -
Hi!
I created query in Bex Query Designer.
I have to add this query to a Role Menu(query is implemented in BEx Web, I don't want to use WAD, Analyzer or Report Designer)
which option i have to select in PFCG?
Thanks in advanceHi,
In the Query Designer tool bar, you will see Create, Open, save, save as, delete and Publlish Icon.Next to the publish Icon, you will see downward arrow. If you click that, then it will show Publish in Role, Publish in portal/.If you click 'publish In Portal' then it will show you roles available and choose the role and save it.
Or else you can even do in PFCG.
Assign Points if this solves your problem.
Regards,
PNK -
Add Query Error in Sap Dashboard
Dear All,
I have downloaded the trail version of SAP Dashboard.I would like to add a query and create a dashboard.But it is not accepting the authentication details.
Kindly Suggest.
Does Trial version support creating of demos from Query.
Thanks,
MerleHi Merle,
Have tried to login with the same credentials either with CMC or BI Launchpad ?.
Have you checked the server information in the host entries ?
Please refer the below link for better understanding:
Creating BO Dashboard from BEx Queries
Kindly let me know for any support.
--SumanT -
Add Query Print Layout at the User Menu
Hi,
I want to add a specific Query Print Layout in the user Menu.
Is there any option?
Thanks in advanceHi......
I Dont think its possible in QPLD to give authorization for a Particular Query Print Layout.
I'm not sure whether its possible in case of Crystal Report or not.....
Regards,
Rahul -
Calendar stuck on add event screen.
I was trying to add an event in my calendar and now the calendar is stuck on the add event screen. Went to I-Tunes and restored my phone, but calendar still remains on the add event screen. How do I fix this?
Thank you for your response. No, that is not the same screen. I know which screen you are talking about. The screen I am having trouble with does not respond to anything I do. It is just a calendar showing me two or three dates with blank event squares. I try to tap the dates, but nothing happens. I have tapped on the few squares to no avail. When I go back to my home screen and select Calendar again I continue to get the same screen. I was very frustrated and waited for my grandson to check it out and of course it went right to the screen to add events. Since then, I have had it happen again many times, but if I just give up for 30 minutes or so, it seems to reset itself. I do not like this 7.0.4 format! This has not been my only problem. I would welcome any other suggestions.
-
Stuck on sql query to find parent records that have the same child records
Oracle 10gR2 Enterprise Edition.
Hi,
I'm trying to write some logic to look for records in a parent table, which have the exact same values in a child table.
This is part of a bigger query, but I'm stuck on this part for now, so I've mocked up some simplified tables below to capture the core of the
problem I'm stuck on.
Let say I've got a parent table Manager, a child table Employee and there's a many to many relationship between them.
The aptly named Join_Table handles the relationship between them. So one manager can manage many employees, one employee can be managed by
many managers.
I've a feeling this is stupidly easy, but I seem to be suffering from a bad bout of brain freeze today!
-- parent table
CREATE TABLE manager (
id number primary key,
name varchar2(100));
-- child table
CREATE TABLE employee (
id number primary key,
name varchar2(100));
-- link table
CREATE TABLE join_table (
manager_id NUMBER,
employee_id NUMBER,
CONSTRAINT join_table_pk PRIMARY KEY (manager_id, employee_id),
CONSTRAINT manager_fk FOREIGN KEY (manager_id) REFERENCES manager(id),
CONSTRAINT employee_fk FOREIGN KEY (employee_id) REFERENCES employee(id)
-- Insert some managers
INSERT INTO manager (id, name) VALUES (1, 'John');
INSERT INTO manager (id, name) VALUES (2, 'Bob');
INSERT INTO manager (id, name) VALUES (3, 'Mary');
INSERT INTO manager (id, name) VALUES (4, 'Sue');
INSERT INTO manager (id, name) VALUES (5, 'Alan');
INSERT INTO manager (id, name) VALUES (6, 'Mike');
-- Insert some employees
INSERT INTO employee (id, name) VALUES (101, 'Paul');
INSERT INTO employee (id, name) VALUES (102, 'Simon');
INSERT INTO employee (id, name) VALUES (103, 'Ken');
INSERT INTO employee (id, name) VALUES (104, 'Kevin');
INSERT INTO employee (id, name) VALUES (105, 'Jack');
INSERT INTO employee (id, name) VALUES (106, 'Jennifer');
INSERT INTO employee (id, name) VALUES (107, 'Tim');
-- Insert the links
-- John manages Paul, Simon, Ken
INSERT INTO join_table (manager_id, employee_id) VALUES (1, 101);
INSERT INTO join_table (manager_id, employee_id) VALUES (1, 102);
INSERT INTO join_table (manager_id, employee_id) VALUES (1, 103);
-- Bob manages Paul, Simon, Kevin, Jack
INSERT INTO join_table (manager_id, employee_id) VALUES (2, 101);
INSERT INTO join_table (manager_id, employee_id) VALUES (2, 102);
INSERT INTO join_table (manager_id, employee_id) VALUES (2, 104);
INSERT INTO join_table (manager_id, employee_id) VALUES (2, 105);
-- Mary manages Jennifer, Tim
INSERT INTO join_table (manager_id, employee_id) VALUES (3, 106);
INSERT INTO join_table (manager_id, employee_id) VALUES (3, 107);
-- Sue manages Jennifer, Tim
INSERT INTO join_table (manager_id, employee_id) VALUES (4, 106);
INSERT INTO join_table (manager_id, employee_id) VALUES (4, 107);
-- Alan manages Paul, Simon, Ken, Jennifer, Tim
INSERT INTO join_table (manager_id, employee_id) VALUES (5, 101);
INSERT INTO join_table (manager_id, employee_id) VALUES (5, 102);
INSERT INTO join_table (manager_id, employee_id) VALUES (5, 103);
INSERT INTO join_table (manager_id, employee_id) VALUES (5, 106);
INSERT INTO join_table (manager_id, employee_id) VALUES (5, 107);
-- Mike manages Paul, Simon, Ken
INSERT INTO join_table (manager_id, employee_id) VALUES (6, 101);
INSERT INTO join_table (manager_id, employee_id) VALUES (6, 102);
INSERT INTO join_table (manager_id, employee_id) VALUES (6, 103);
-- For sanity
CREATE UNIQUE INDEX employee_name_uidx ON employee(name);So if I'm querying for manager John, I want to find the other managers who manage the exact same list of employees.
Answer should be Mike.
If I'm querying for manager Mary, answer should be Sue.
This query will give me the list of managers who manage some of the same employees as John, but not the exact same employees...
SELECT DISTINCT m.name AS manager
FROM manager m, join_table jt, employee e
WHERE m.id = jt.manager_id
AND jt.employee_id = e.id
AND e.id IN (
SELECT e.id
FROM manager m, join_table jt, employee e
WHERE m.id = jt.manager_id
AND jt.employee_id = e.id
AND m.name = 'John')
ORDER BY 1;I thought about using set operations to find managers whose list of employees minus my employees is null and where my employees minus their list of employees is null. But surely there's a simpler more elegant way.
Any ideas?
Btw, I need to run this as a batch job against tables with >20 million rows so query efficiency is key.What about...
WITH manager_list AS
SELECT name,
LTRIM(MAX(SYS_CONNECT_BY_PATH(id,','))
KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
FROM (SELECT m.name,
e.id,
ROW_NUMBER() OVER (PARTITION BY m.name ORDER BY e.id) AS curr,
ROW_NUMBER() OVER (PARTITION BY m.name ORDER BY e.id) -1 AS prev
FROM manager m,
join_table jt,
employee e
WHERE m.id = jt.manager_id
AND jt.employee_id = e.id
AND m.name = :P_MANAGER)
GROUP BY name
CONNECT BY prev = PRIOR curr AND name = PRIOR name
START WITH curr = 1
), all_list AS
SELECT name,
LTRIM(MAX(SYS_CONNECT_BY_PATH(id,','))
KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
FROM (SELECT m.name,
e.id,
ROW_NUMBER() OVER (PARTITION BY m.name ORDER BY e.id) AS curr,
ROW_NUMBER() OVER (PARTITION BY m.name ORDER BY e.id) -1 AS prev
FROM manager m,
join_table jt,
employee e
WHERE m.id = jt.manager_id
AND jt.employee_id = e.id)
GROUP BY name
CONNECT BY prev = PRIOR curr AND name = PRIOR name
START WITH curr = 1
SELECT a.*
FROM manager_list m,
all_list a
WHERE m.employees = a.employeesWould be easier in 11g, but I don't have an installation here so this is based on 10g.
Cheers
Ben
Maybe you are looking for
-
Best practice for performing spell check in ADF
Hi, I would like to know if there is a way to perform spell check in ADF. What is the best way to do? Does ADF have some type functionality for that or do I need to have an external library for that? Any help will be appreciated. thank you in advance
-
How can B2B identify Trade partner if Host`s Channel is Generic HTTP-1.0
I have error: B2B-50547 (Agreement not found for trading partners: FromTP null, ToTP MyCompany with document type B2B Process-1.0-INBOUND.) Where i need to use Name of Trade Partner in my POST request? I tried to use Generic Identifier with value - I
-
Trigerring workflow through status management
Hi Abappers, I am new to workflow, can any body tell me how to trigger a workflow using. 1. Change Management Document 2. Status Management. Regards, Narendiran Rathinavelu.
-
Help witht the following download
What do I need to download to do the following: To view the full contents of this document, you need a later version of the PDF viewer. You can upgrade to the latest version of Adobe Reader from www.adobe.com/products/acrobat/readstep2.html For furth
-
Show username and date on results slide
Hi, Is it possible in captivate that a user can enter the user name and date in the beginning of the project which later can be displayed on results slide