Regarding query
Dear Experts,
I have one doubt regarding below query...
I have two tables of data like below..
Table A
CustId Name CustType
1 xyz pres
2 yyy Pres
3 zzz Pres
4 RRR pres
5 kkk Pres
Table B
AFfId From_cust_Id To_cust_id Afftype
11 1 2 Hosp
12 1 3 Hosp
13 2 4 Hosp
14 2 5 Hosp
I want to generate the output in the below format...
CustId Inst1 Inst2 Inst3
1 xyz yyy zzz
2 yyy RRR KKK
Please help me on this query..
Thanks a lot in advance..
Oracle Version : 10g
Thank you.
Sunitha.
sunitha2010 wrote:
Dear Experts,
I have one doubt regarding below query...I don't see any query below
How to ask question
SQL and PL/SQL FAQ
Handle: sunitha2010
Status Level: Newbie
Registered: May 13, 2010
Total Posts: 43
Total Questions: 17 (15 unresolved)
why so MANY unanswered questions?
Similar Messages
-
Regarding Query/Where box in oracle forms
Hi,
I have a query regarding query/where box in oracle.
When I enter ":" in one of the field query box pops up and when I enter some query and press F12 to execute query.
The OK button has to be pressed twice to retrieve the result.
Can anyone please let me know why this is happening, instead of retreiving results at one go by pressing OK once.
When does query box pos up? I have to avoid hitting OK button on query box twice.
Thanks for your advice in advance.
Thanks,
KLC
Edited by: user5411765 on Nov 22, 2010 10:44 PMHi,
Were you able to get around this problem? I am facing the same and need help! :(
Regards,
Arun -
Hi,
I have a requirement to select two columns from 6 million rows which is one database, and go through the result set, take the one of the column value as the criteria and select another column from 10000 rows table.
I have used two methods to work. Both are working but they are very slow.
I am using jdbc for this.
First method:
Following is the pseudo code for the same
--Select all rows from the table 1
while (rs.next())
String column1= rs.getString(1);
String Query 2= "Select column2 from table 2 where my_field=column1";
--prepare the statement1 using query2
-- execute the statement1 and copy in to rs1
-- while (rs1.next())
do something
Second method:
In this one instead of querying the database for each row in the first resutl set, used a stored procedure which returns a ref cursor taking the array as the input string.
create or replace type mylist as table of varchar2(20);
create or replace type outlist as table of BLOB;
create or replace package my_pkg
as
type rc is ref cursor;
procedure p(myval_list in mylist, outcur OUT rc);
end;
create or replace package body my_pkg
as
PROCEDURE get_phonetype(myval_list IN imeilist,orefcur OUT rc )
AS
l_data outlist := outlist();
tmp_profile BLOB;
BEGIN
--DBMS_OUTPUT.put_line(myval_list.COUNT);
FOR i IN myval_list.FIRST .. myval_list.LAST
LOOP
BEGIN
SELECT column1 INTO tmp_profile FROM table1 WHERE
column2 IN (SELECT column2
FROM table2
WHERE (column3< myval_list(i) AND column4 > myval_list(i)));
--DBMS_OUTPUT.put_line(tmp_phone);
l_data.extend;
l_data(i) := tmp_profile;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
END;
END LOOP;
open outcur for
select * from TABLE( cast (l_data as outlist));
END;
END;
in the java program:
--Select all rows from the table 1
while (rs.next())
--loop few times to populate the column1 string arrays
OracleCallableStatement stmt1=(OracleCallableStatement)conn.prepareCall("{call p(?,?)}");
-- register the out parameter as ORACLETYPES.CURSOR
--prepare the array descriptor for the array, set the array using column1 values
-- set the first argument as array
-- retrieve the result set
--do something with the result set
} //end of while
I thought using the stored procedure would make my process faster, but the second approach deteriated the execution time.
I could not understand where I did the mistake. FOr the 200000 rows for the first table, first approach executed in 10 minutes and the second was taking more than hours.
Can some one help me in fine tuning the stored procedure or suggest an alternative best method.
Regards,
SyamSyam,
Not knowing your table data or the whole of the queries you're making, this may not be feasible. But could you write this as either a single (albeit complex) query, or perhaps a PL/SQL block that uses a temp table or two, but still does all of the processing in Oracle as queries, not loops?
From the examples you gave, it looks like putting it into one query would just involve a few table joins. But they look like you abbreviated some more complex processing... -
Regarding Query Performance.
Please tell me ..
How can i check the performance of query using index and without using index?Hi,
As deepak said, query with and without index.
to get the cost and access path of the query get explain for the query. Read the Oracle docs
[http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/ex_plan.htm]
It is common to all the version from 9i as far as I know.
do
SQL> set autotrace on
SQL> run your query
you will get the explain plan and cost information in the sql prompt if the statistis_level is set to typical or all
Regards,
Vijayaraghavan K
Edited by: Vijayaraghavan Krishnan on Jan 18, 2010 4:24 PM -
Urgent..help regarding query
can anyone tell me what this code does..
REPORT Z_SD_Q_03 MESSAGE-ID Z_SD.
PROGRAMA : Z_SD_Q_03
FECHA : 12-07-1999
AUTOR : MADASV
DESCRIPCION : Ejecutar query 03(SD)
VARIABLES
DATA: WERKS LIKE LIKP-WERKS,
NOMBRE_REPORT LIKE AQADEF-PGNAME.
RANGES
RANGES CENTRO FOR LIKP-WERKS.
CONSTANTS
CONSTANTS: QUERY LIKE AQADEF-QUNAME VALUE '03',
USERGROUP LIKE AQADEF-BGNAME VALUE 'SD'.
START-OF-SELECTION
START-OF-SELECTION.
Centro
GET PARAMETER ID 'WR1' FIELD WERKS.
CENTRO-LOW = WERKS.
CENTRO-SIGN = 'I'.
CENTRO-OPTION = 'EQ'.
APPEND CENTRO.
CALL FUNCTION 'RSAQ_EXIST_QUERY'
EXPORTING
WORKSPACE = ' '
USERGROUP = USERGROUP
QUERY = QUERY
IMPORTING
REPORTNAME = NOMBRE_REPORT
EXCEPTIONS
NO_USERGROUP = 1
NO_QUERY = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE E100 WITH QUERY SY-MANDT.
ELSE.
SUBMIT (NOMBRE_REPORT)
WITH OFICI IN CENTRO
WITH SP$00001-LOW = SY-DATUM
VIA SELECTION-SCREEN.
ENDIF.it's checking display authorization of plant WR1 for current user .
Reward if useful
Regards
ANUPAM -
Query Regarding Query Results in CMC 3.1
Hi,
I want to check what reports are scheduled in particular folder. To get this information we can use query builder by writing a query,but i don't have access to query builder.
Can we check in CMC without access to query builder?I have seen one option In CMC 'Query Results'. What exactly Query results do and how to use.Can this be use to retrieve what reports are scheduled?
Regards
RanjithHi Ranjith,
Query Results option in CMC is an application through which you could create Security Queries. It would help you identify the security setup and access being setup on the objects in your enviornment.
Regards,
Nakul Mehta -
Regarding Query and Logical database
Hi All,
I have one requirement to create a report which gives all selection fields of a query.I got the selection fields defined in the query,but some extra selection fields are coming from logical database,which query uses.These extra fields count is different for different queries using same logical data base.Please suggest me a solution.
Regards
ShibinHi Jogeswara,
Thanks for your inputs.
But my question is, how can I filter the data which is being fetched by standard logical database. I cannot go inside the std. LDB and change internal tables of it. I tried coding in extras, but I think it works only if we want to add additional fields in output.
At present, we are considering the option of creating a z LDB where we copy. std. LDB and also add the reqd. table which is not present in LDB.
Is there any other option?
Please provide your valuable inputs.
Regards,
Imran Kundan. -
Hi Friends,
Pls can any one tell me , where information about all queries will be stored in bi server?
I had found some tables which will store the query information.
RSRREPDIR - Directory of all reports
RSZCOMPDIR - Directory of Reporting Components
RSZELTDIR-Directory of the Reporting Component Elements
Apart from above tables can we get data about queries anywhere else.
Thanks & Regards,
Ramnaresh .PDear Ramnaresh,
RSZELTDIR Directory of the reporting component elements
RSZELTTXT Texts of reporting component elements
RSZELTXREF Directory of query element references
RSRREPDIR Directory of all reports (Query GENUNIID)
RSZCOMPDIR Directory of reporting components
RSZRANGE Selection specification for an element
RSZSELECT Selection properties of an element
RSZELTDIR Directory of the reporting component elements
RSZCOMPIC Assignment reuseable component <-> InfoCube
RSZELTPRIO Priorities with element collisions
RSZELTPROP Element properties (settings)
RSZELTATTR Attribute selection per dimension element
RSZCALC Definition of a formula element
RSZCEL Query Designer: Directory of Cells
RSZGLOBV Global Variables in Reporting
Hope this helps..
Best Regards,
VVenkat.. -
Hi,
I have a requirement in which i have to add 1 more column to a ALV reporte that was created based on a query (SQ01). But the problem is that the query was deleted.
Does anybody know how to rebuild the query from the program? Or could anybody tell me which would be a better solution for this?
Regards,
RobertoI think it is not possible to create a SQ01 from report. My suggestion will be alter the report as per your needs
a® -
Hi,
i am able to create image reference but not able to create image path from dam i am putting like this
map.put("type", "dam:Asset"); is this correct or is there any other way to getpath of image from dam .please let me know
code------------
Map<String, String> map = new HashMap<String, String>();
map.put("path", "/content/dam");
map.put("type", "dam:Asset");
map.put("group.p.or", "true"); // combine this group with OR
map.put("group.1_fulltext", fulltextSearchTerm);
map.put("group.1_fulltext.relPath", "jcr:content");
map.put("group.2_fulltext", fulltextSearchTerm);
map.put("group.2_fulltext.relPath", "jcr:content/@cq:tags");
log.info("======mapout======"+map);
Query query = builder.createQuery(PredicateGroup.create(map),session);
log.info("======query======"+query);
SearchResult result = query.getResult();
// log.info("======result======"+result);
// iterating over the results
for (Hit hit : result.getHits()) {
String path = hit.getPath();
// ValueMap props = hit.getProperties();
response.getWriter().write(path);
//response.getWriter().write(props);
log.info("======result======"+result);Regarding this:
map.put("group.2_fulltext.relPath", "jcr:content/@cq:tags");
Note that it's "jcr:content/metadata/@cq:tags" for assets, and note that full text searching the cq:tags property is not a good idea, since these are IDs, not the tag titles that you see in the UI and when the titles change or a tag is moved/merged, the IDs are not changed. You want to first search in the tags tree to find matching tags and then search for them, using the tagid predicate. -
Hi All,
I am developing infoset in query using sq02.
There i have added one additional field 'gross value' and table as vbak.This gross value is nothing but the total of total value of each material in each line item of sales order after adding taxes.
I need total amount by adding of all these total values of all line items.
Can you please tell me how can i achieve this.
Regards,
Ashutoshashutosh,
In Event " Record processing "
Write the below logic.
Clear : grossvalue,
v_total.
Add all line items
AT END OF sales order.
Move v_toal to gross value.
I think you might have created grossvalue in "extras " tab.
Don't forget to reward if useful... -
Regarding Query Generator One Column Extra
hi.
i have one requirement
ie.
normally
sleect ordr.cardcode from ordr
i put this query in query generator
so, the result will come like
s
y
x
p
but what i need is, i want one column extra each time the value of this column is 'co'
like
co s
co y
co x
co p
is it possible...
i need your valuable suggestions..Hi Srinivas,
Fine Srini..hope you are fine..
If you got the answer please close this thread with tag correct answer...
Regards
Ajith -
Hi All,
Please suggest me the logic to generate the report as per below
I need to display the No Of Customers based upon the sales quantity they purchased for particular period (Jan to May) in the Year range (2005 to 2006)
Its Urgent
Thanks & Regards
Veeru.Hi
Use the conditions to solve ur problem.
You can formulate conditions to make data analysis more efficient. In the results area of the query, the data is filtered according to the conditions so that only the part of the results area that you are interested in is displayed.
If you apply conditions to a query, you are not changing any numbers. Instead, you are just hiding the numbers that are not relevant for you. For this reason, conditions have no effect on the displayed values of the results rows. The results row of a query with an active condition corresponds to the results row of a query without this condition (see Ranked List Condition: Top 5 Products).
You can define multiple conditions for a query. Conditions are evaluated independently of each other. In doing so, the results quantity for the evaluation sequence is independent. The result is the intersection of the individual conditions. Multiple conditions are linked logically with AND. A characteristic value is only displayed when it fulfills all (active) conditions of the query (see Linking Two Conditions: Bottom 2 Sales and Invoiced Quantity > 100,000,000). -
Regarding query mointor in 3.5
can anyone tell me ,without seeing Business Explorer,how can i find whether Exceptions and Conditions are there on Query in RSRT
Hi,
i tried in techincal information..but no information regarding this is present.... -
Help regarding Query Browser in Xcelsius
Till now I have been practicing dashboards using spreadsheet as Data Source. But here our consultants have used the BEx query as the data source, which I could n't practice as because i do not have login id and password which is required to "Add Query' in the Xcelsius. Please find the below attached image file and please help in making understand what exactly have they done using the 'Query Browser'.
Would be more thankful, if anyone can make me understand the Concepts of 'Result Objects', Filters and Prompts.
The Drill Down of the First Query i.e.HC_FTE_HC_A_Payscaletype
--Regards
RanendraHi Ranendra,
The only difference is till now u r working on offline data and with these Query Browser you have started working with live data.
Even though you get this live data you have to work on excel as u must dump the data to excelsheet.
Now we discuss the use of Query Browser:
Query browser is a new option we have in current version of Dashboard, we use this to connect
to
1) BeX queries through BICS connection
2) Unx universes which are created in IDT.
Your requirement falls under 1st category
There are few steps which you have to consider before going to result set designing, filters and prompts.
First we have to establish a connection which acts as an interface betwen your BeX query and dashboard and we do that by creating a BICS connection in the IDT.
Just create a BICS connection and this should be exported to repositiry.
Only after this you can access the connection through Query Browser in dashboards.
Now coming to result sets, these are actually your Query. Here you drag the desired dimension objects and measure objects.
Filters: If you want restrict your data, then we use filter. Drag the object in the filter pane.
Prompt: If you want user to make the selection of the parameter then u declare a prompt.
For indetail information about the other properties please go through the Suman description.
Regards,
Anjani Kumar C.A.
Maybe you are looking for
-
How do I cancel iCloud in iPhone that I already sold to someone. The phone was busted so I sold it and I had no way to get on it
-
Crosstab with char values doesn't work
I am using Template Builder for Word 5.6.2 to create a crosstab report. I need to create a crosstab table that has char values in the cells not numbers as is expected by the wizard. Because the sum command expectes a number it displays the NaN not a
-
ALE problem when delete GL Account
Dear Expert, I have create ALE with 2 client in my system. When I try to create GL account in sender system, that GL account also created in receiver system. When I tried to delete it from sender system, that GL account still exist in receiver system
-
Aggregate with multiple members of attribute
Hello, I want to create a calculated member where I have to sum if the attribute values are A OR B OR C only. Like sum(xyz) if attribute values=a or b or c. How do I this in MDX calculated measure? I tried doing this but I get NULL AGGREGATE(([REV].[
-
is there anyway to download only the SAP Library for SAP 4.6c? or is it available in PDF Format? for example SAP Help for MM?