Query of Query Performance
I'm wondering if anyone has done some good performance tests with Q of Qs? I mainly have used them for relatively small data sets since cfmx first came out, as I remember some of my first experiences with it handling large amounts of data being pretty underwhelming. It would just really start to drag when it had to handle data sets of more than a few hundred records. Has that improved in more recent releases? I would assume its at least better than that, but how much? I am looking at doing an application where I have a large data set that is used continually throughout the application but with a lot of different filters and I was thinking of using a cached query and then Q of Qs to pull the various records I need but was concerned that it couldn't handle large data sets well (say 5-10K records). Has anyone done this kind of thing and could comment on performance ?
John P
Hi John,
In QOQ, Since the recordsets persist in memory, the performance really depends upon the configuration of your computer in where CF is running..
In the most recent releases, MX7 had undergone many enhancements, you can find more information here, (Under "ColdFusion MX 7 Enhancements" section).
http://www.adobe.com/support/documentation/en/coldfusion/mx7/releasenotes.html#whatsnew
http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/86
Where as in ColdFusion 9, check out the "Built-in ORM" feature, which has many nice features.
http://www.adobe.com/devnet/coldfusion/articles/coldfusion9_orm_05.html
HTH
Similar Messages
-
Can u any imrove this query for maximum performance
select g_com_bu_entity bunt_entity
, g_com_rep_cd srep_cd
, effdt from_dt
, eff_status
, g_com_role role
, g_com_pgm prgm
, g_com_district district
, g_com_draw_status draw_status
, decode(g_com_primary_pgm, 'Y',1, 0) pri_prgm_flag
FROM ps_g_com_assign_vw@commissions c1
WHERE effdt =
(SELECT MAX (effdt)
FROM ps_g_com_assign_vw@commissions c2
WHERE c1.g_com_bu_entity = c2.g_com_bu_entity
AND c1.g_com_rep_cd = c2.g_com_rep_cd);
can anyone make it as regular query for maximum performance
Thanks,
SreekanthHi Sreekant,
Try this: If it helps
select g_com_bu_entity bunt_entity
, g_com_rep_cd srep_cd
, effdt from_dt
, eff_status
, g_com_role role
, g_com_pgm prgm
, g_com_district district
, g_com_draw_status draw_status
, decode(g_com_primary_pgm, 'Y',1, 0) pri_prgm_flag
FROM ps_g_com_assign_vw@commissions c1,
(SELECT MAX (effdt) effdt_max
FROM ps_g_com_assign_vw@commissions c2
WHERE c1.g_com_bu_entity = c2.g_com_bu_entity
AND c1.g_com_rep_cd = c2.g_com_rep_cd) t2
WHERE effdt = t2.effdt_max; -
Please help to modifiy this query for better performance
Please help to rewrite this query for better performance. This is taking long time to execute.
Table t_t_bil_bil_cycle_change contains 1200000 rows and table t_acctnumberTab countains 200000 rows.
I have created index on ACCOUNT_ID
Query is shown below
update rbabu.t_t_bil_bil_cycle_change a
set account_number =
( select distinct b.account_number
from rbabu.t_acctnumberTab b
where a.account_id = b.account_id
Table structure is shown below
SQL> DESC t_acctnumberTab;
Name Type Nullable Default Comments
ACCOUNT_ID NUMBER(10)
ACCOUNT_NUMBER VARCHAR2(24)
SQL> DESC t_t_bil_bil_cycle_change;
Name Type Nullable Default Comments
ACCOUNT_ID NUMBER(10)
ACCOUNT_NUMBER VARCHAR2(24) YIshan's solution is good. I would avoid updating rows which already have the right value - it's a waste of time.
You should have a UNIQUE or PRIMARY KEY constraint on t_acctnumberTab.account_id
merge rbabu.t_t_bil_bil_cycle_change a
using
( select distinct account_number, account_id
from rbabu.t_acctnumberTab
) t
on ( a.account_id = b.account_id
and decode(a.account_number, b.account_number, 0, 1) = 1
when matched then
update set a.account_number = b.account_number -
Help to rewirte query for best performance
Hi All,
can you kindly help me to rewirte the below mentioned query for best performance. this is taking more than 20 min in our production server.
SELECT cp.name,mis.secondary_type U_NAME,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-161,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-154,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-154,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-147,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-147,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-140,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-140,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-133,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-133,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-126,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-126,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-119,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-119,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-112,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-112,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-105,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-105,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-98,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-98,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-91,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-91,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-84,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-84,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-77,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-77,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-70,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-70,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-63,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-63,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-56,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-56,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-49,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-49,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-42,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-42,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-35,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-35,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-28,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-28,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-21,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-21,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-14,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage,
count(CASE WHEN (mis.start_time between To_DATE(to_char(next_day (sysdate-14,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-7,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))THEN mis.event_audit_id END) Usage
FROM mis_event_audit mis,USER u,com_pros cp where
mis.user_id=u.email_address and u.cp_id=cp.cp_id
and (mis.start_time between To_DATE(to_char(next_day (sysdate-161,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy') and To_DATE(to_char(next_day (sysdate-7,'monday'),'MM/DD/YYYY'),'mm/dd/yyyy'))
GROUP BY cp.name, mis.secondary_type;
Thanks,
krishHi, Krish,
Something like this will probably be faster, because it cuts out most of the function calls:
WITH got_cnt AS
SELECT cp.name
, mis.secondary_type AS u_name
, COUNT (mis.event_audit_id) AS cnt
, ( TRUNC (mis.start_time, 'IW')
- TRUNC (SYSDATE, 'IW')
) / 7 AS week_num
FROM mis_event_audit mis
JOIN user_table u ON mis.user_id = u.email_address -- USER is not a good table name
JOIN com_pros cp ON u.cp_id = cp.cp_id
WHERE mis.start_time >= TRUNC (SYSDATE, 'IW') - 161
AND mis.start_time < TRUNC (SYSDATE, 'IW')
GROUP BY cp.name
, mis.secondary_type
, TRUNC (mis.start_time, 'IW')
SELECT name
, secondary_type
, SUM (CASE WHEN week_num = 22 THEN cnt END) AS week_23
, SUM (CASE WHEN week_num = 21 THEN cnt END) AS week_22
, SUM (CASE WHEN week_num = 20 THEN cnt END) AS week_21
, SUM (CASE WHEN week_num = 0 THEN cnt END) AS week_1
FROM got_cnt
GROUP BY name
, secondary_type
;TRUNC (d, 'IW') is midnight on the last Monday before or equal to the DATE d. It does not depend on you NLS settings.
Whenever you're tempted to write an exprssion as complicated as
, COUNT ( CASE
WHEN ( mis.start_time BETWEEN TO_DATE ( TO_CHAR ( NEXT_DAY ( SYSDATE - 161
, 'monday'
, 'MM/DD/YYYY'
, 'MM/DD/YYYY'
AND TO_DATE ( TO_CHAR ( NEXT_DAY ( SYSDATE - 154
,'monday'
, 'MM/DD/YYYY'
, 'MM/DD/YYYY'
THEN mis.event_audit_id
END
) AS usageseek alternate ways. Oracle provides several handy functions, especially for manipulating DATEs. In particular "TO_DATE (TO_CHAR ...)" is almost never needed; think very carefully before doing a round-trip conversion like that.
Besides being more efficient, this will be easier to debug and maintain.
If you're using Oracle 11.1 (or higher), then you can also use SELECT ... PIVOT in the main query, but I doubt that will be any faster, and it might not be any simpler.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Simplify the problem as much as possible. For example, instead of posting a problem that covers the last 23 weeks, pretend that you're only interested in the last 3 weeks. You'll get a solution that's easy to adapt to any number of weeks.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002}
For performance problems, there's another page of the forum FAQ {message:id=9360003}, but, before you start that process, let's get a cleaner query, without so many functions.
Edited by: Frank Kulash on Oct 2, 2012 11:50 AM
Changed week_num to be non-negative -
I'm creating an image gallery. My database has about 1000
records with 10 column.
Now I'm realising there's a lot of trips to the database.
Would it be better that when I init my app I store the "get all"
query and query that from that point? Or is the difference in
performance of querying a query as a oppose to a database not worth
it?
If you say I should query the query, how many records would
be too much to hold in memory.
Thanksquote:
Originally posted by:
dandev
I'm creating an image gallery. My database has about 1000
records with 10 column.
Now I'm realising there's a lot of trips to the database.
Would it be better that when I init my app I store the "get all"
query and query that from that point? Or is the difference in
performance of querying a query as a oppose to a database not worth
it?
If you say I should query the query, how many records would
be too much to hold in memory.
Thanks
It would be better to just select the records you need. -
Single query for querying three tables
Hi All,
We are trying to construct a sql query(a single query), which can perform the below functionality.
Assume, that there are three tables,
TABLE1: 3 Columns
1) ID -> PRIMARY KEY
2) TYPE -> Allows only values 'A' or 'B'
3) REF_ID(this can refer to TABLE2(ID) or TABLE3(ID)).
TABLE2: 2 Columns
1) ID -> PRIMARY KEY
2) DETAILS -> Any normal text
TABLE3: 2 Columns
1) ID -> PRIMARY KEY
2) DETAILS -> Any normal text
We need to come up with a query that, given TABLE1's(ID), we need to fetch the corresponding record in TABLE1, and we need to fetch the corresponding record from TABLE2 or TABLE3, depending on the below conditions.
If the TYPE for the TABLE1's(ID) is 'A'
Then get the details from TABLE2's by mapping TABLE1.REF_ID = TABLE2.ID
If the TYPE for the TABLE1's(ID) is 'B'
Then get the details from TABLE3's by mapping TABLE1.REF_ID = TABLE3.ID
We need to accomplish all these tasks in a single query.
Thanks for your kindly help,
SreenivasanSQL> select * from test_qry1;
ID T REF_ID
1 A 100
2 A 200
3 B 300
SQL> select * from test_qry2;
ID DETAILS
100 Human Resources
200 It Services
300 Relationships
SQL> select * from test_qry3;
ID DETAILS
100 Human Beings
200 Conference
300 Used things
SQL> SELECT t1.ID,
DECODE(t1.type,'A',( SELECT t2.details FROM test_qry2 t2 WHERE t1.ref_id = t2.id
'B',( SELECT t3.details FROM test_qry3 t3 WHERE t1.ref_id = t3.id
) details
FROM test_qry1 t1;
ID DETAILS
1 Human Resource
2 It Services
3 Used things
Try with this query.
Thanks,
Vissu...... -
Query of query - running slower on 64 bit CF than 32 bit CF
Greetings...
I am seeing behavior where pages that use query-of-query run slower on 64-bit Coldfusion 9.01 than on 32-bit Coldfusion 9.01.
My server specs are : dual processer virtual machine, 4 GIG ram, Windows 2008 Datacenter Server r2 64-bit, Coldfusion 9.01. Note that the coldfusion is literally "straight out of the box", and is using all default settings - the only thing I configured in CF is a single datasource.
The script I am using to benchmark this runs a query that returns 20,000 rows with fields id, firstname, lastname, email, city, datecreated. I then loop through all 20,000 records, and for each record, I do a query-of-query (on the same master query) to find any other record where the lastname matches that of the record I'm currently on. Note that I'm only interested in using this process for comparative benchmarking purposes, and I know that the process could be written more efficiently.
Here are my observed execution times for both 64-bit and 32-bit Coldfusion (in seconds) on the same machine.
64 bit CF 9.01: 63,49,52,52,52,48,50,49,54 (avg=52 seconds)
32 bit CF 9.01: 47,45,43,43,45,41,44,42,46 (avg=44 seconds)
It appears from this that 64-bit CF performs worse than 32-bit CF when doing query-of-query operations. Has anyone made similar observations, and is there any way I can tune the environment to improve 64 bit performance?
Thanks for any help you can provide!
By the way, here's the code that is generating these results:
<!--- Allrecs query returns 20000 rows --->
<CFQUERY NAME="ALLRECS" DATASOURCE="MyDsn">
SELECT * FROM MyTBL
</CFQUERY>
<CFLOOP QUERY="ALLRECS">
<CFQUERY NAME="SAMELASTNAME" DBTYPE="QUERY">
SELECT * FROM ALLRECS
WHERE LN=<CFQUERYPARAM VALUE="#ALLRECS.LN#" CFSQLTYPE="CF_SQL_VARCHAR">
AND ID<><CFQUERYPARAM VALUE="#AllRecs.ID#" CFSQLTYPE="CF_SQL_INTEGER">
</CFQUERY>
<CFIF SameLastName.RecordCount GT 20>
#AllRecs.LN#, #AllRecs.FN# : #SameLastName.RecordCount# other records with same lastname<BR>
</CFIF>
</CFLOOP>BoBear2681 wrote:
..follow-up: ..Thanks for the follow-up. I'll be interested to hear the progress (or otherwise, as the case may be).
As an aside. I got sick of trying to deal with Clip because it could only handle very small Clip sizes. AFAIR it was 1 second of 44.1 KHz stereo. From that point, I developed BigClip.
Unfortunately BigClip as it stands is even less able to fulfil your functional requirement than Clip, in that only one BigClip can be playing at a time. Further, it can be blocked by other sound applications (e.g. VLC Media Player, Flash in a web page..) or vice-versa. -
Error while accessing Query using Query Analyzer
dear experts...
while accesiing the query using query analayzer...
we are getting below error...
What has happened?
URL http://xxx.xxx.xxx.xx:XXXX/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex call was terminated because the corresponding service is not available.
Note
The termination occurred in system BI1 with error code 404 and for the reason Not found.
The selected virtual host was 0 .
What can I do?
Please select a valid URL.
If you do not yet have a user ID, contact your system administrator.
ErrorCode:ICF-NF-http-c:001-u:ANAND-l:E-i:PSRCCPRDA003_BI1_00-v:0-s:404-r:Notfound
HTTP 404 - Not found
Your SAP Internet Communication Framework Team
thanks for helping me...
anandHi friends,,
instead of getting the link like
http://128.222.125.57:9000/sap/bw/bex?cmd=ldoc&infocube=ZMC_SRH1&query=AGINGV21A&sap-language=EN(working link)
am getting below link...which is getting an error....
http://128.222.125.57:9000/sap/bw/://:/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?QUERY=AGINGV21A
above marked is the unwanted thing so how can i change my link in query designer???
please suggest me firneds -
Unable to create new query using query manager
Hi friends,
I have been trying to create a query using query manager for couple of hours but still not able to.I am following the instructions given in oracle Peopletools 8.52 : Peoplesoft query
Chapter - creating new queries.
Below are the steps I am going through to create new query:
Step - I open the component Reporting Tools-> Query->Query Manager , I don't get the tabbed pages one for search an existing query and another for create new query.
Please follow this link to see how the page is displayed in first step:
http://uploadpic.org/v.php?img=EvMvVAXX1E
Step 2 - When I click on create new query link, I am redirected to a page where it asks for record name to add in the query. But, even this page is not displayed as how it supposed to be
http://uploadpic.org/v.php?img=GzHh3f6krU
Step 3 - Following the above step, when I click on Person record to add into my query I am asked to select the fields that I want to display in the output.
But I somehow do not get the proper tabbed pages where individual pages are there to add the attributes to complete the query like adding multiple records, fields, query, expressions, prompt...etc
http://uploadpic.org/v.php?img=Wbbla3Q3jE
I am neither able to select multiple records in my query nor able to customize my query to get the desired results.
Below is the query that I want to create using query manager:
SELECT P.EMPLID,P.BIRTHDATE, N.NAME, A.ADDRESS1, A.ADDRESS2, A.CITY
FROM PS_PERSON P, PS_NAMES N, PS_ADDRESSES A
WHERE P.EMPLID = N.EMPLID AND
N.EMPLID = A.EMPLID AND
P.BIRTHDATE BETWEEN to_date('1990/1/1','yyyy/mm/dd') and to_date('1991/1/1','yyyy/mm/dd');Hi,
As I cannot access your screenshot by the blocking of company firewall rules.
I'm guessing currently you are using PT 8.52.00 version, correct?
This should be a bug, that you need to apply the 8.52.0X patch, not sure which patch fix this, you can apply the latest one to solve this issue for no tab page of query manager. (PT 8.52.06)
Hope this helps.
Thanks,
Saxon SI -
Using NVL in Query of Query resulting in error
I'm still using CF8 and Oracle 11G back-end.
When I use NVL in the query of query I got error....Can't I use NVL to check on null value? Please help
Here is my codes:
<cfquery name="GetC2" datasource="#Trim(application.OracDSN)#">
SELECT CamID2, rel2_2,p_ln2,p_fn2,ins,l_year
FROM prt_temp
WHERE Ins = 'CC'
AND l_year = '1481'
AND NVL(Child_LN2,' ') <> ' '
AND NVL(Child_FN2,' ') <> ' '
</cfquery>
<cfif GetC2.Recordcount NEQ 0>
<cfquery name="CheckRel2C2" dbtype="QUERY">
SELECT CamID2, rel2_2
FROM GetC2
WHERE NVL(Rel2_2,' ') <> ' '
AND NVL(p_ln2,' ') = ' '
AND NVL(p_fn2,' ') = ' '
AND Ins = 'CC'
AND l_year = '1481'
</cfquery>
</cfif>
The error:
Error Executing Database Query.
Query Of Queries syntax error.
Encountered "NVL ( Rel2_2 ,. Incorrect conditional expression, Expected one of [like|null|between|in|comparison] condition,NVL is an Oracle function, and is not available in ColdFusion Query of Query. If you are trying to check for null values, then use IS NULL or IS NOT NULL. So
WHERE NVL(Rel2_2,' ') <> ' '
AND NVL(p_ln2,' ') = ' '
AND NVL(p_fn2,' ') = ' '
becomes
WHERE Rel2_2 IS NOT NULL
AND p_ln2 IS NULL
AND p_fn2 IS NULL
-Carl V. -
How to extract the Physical Query(database Query)
Hi ,
How to extract the Physical Query(database Query) from obiee which was fired in obiee
Regards
RangaHi Ranganath,
Have a look the following links.
Setting Logging level:
http://gerardnico.com/wiki/dat/obiee/loglevel
How to see physical query:
http://gerardnico.com/wiki/dat/obiee/manage_session_log
If you are new to OBIEE, spend some hours on the following blog to learn from basics to advanced level.
http://gerardnico.com/wiki/
http://obiee101.blogspot.com/
http://www.rittmanmead.com/blog/
Hope it helps you.
Regards,
Kalyan Chukkapalli
http://123obi.com -
Hey All
How I can run query from Query Manager from addon level?
regards
Krzysztof SalaHi Krzysztof,
There is no object in the SDK to access and execute the queries programmatically so you have to use the UI to simulate the user opening and selecting the query (ie activate the menu object for the query you want to run, populate any parameters then click on the OK button to execute the query). It's a bit of a messy solution but it can work ok.
The alternative is to execute your query from within your add-on and display the results in a new form. This form can just have a matrix and an OK button so it's very easy to create (via Screenpainter or at runtime).
Hope this helps,
Owen -
Please suggest a select query / sub query with out using any subprograms or
source table: Three columns ORIGIN, DESTINATION,MILES
Origin Destination Miles
Sydney Melbourne 1000
Perth Adelaide 3000
Canberra Melbounre 700
Melbourne Sydney 1000
Brisbane Sydney 1000
Perth Darwin 4000
Sydney Brisbane 1000
out put :Three columns ORIGIN, DESTINATION,MILES
Duplicate routes are to be ignored so the output is
Origin Destination Miles
Sydney Melbourne 1000
Perth Adelaide 3000
Canberra Melbounre 700
Brisbane Sydney 1000
Perth Darwin 4000
Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.Hi,
user9368047 wrote:
... Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.Why? If the most efficient way to get the results you want involves using a function, why wouldn't you use it?
Here's one way, without any functions:
SELECT a.*
FROM source_table a
LEFT OUTER JOIN source_table b ON a.origin = b.destination
AND a.destination = b.origin
AND a.miles = b.miles
WHERE b.origin > a.origin -- Not b.origin > b.origin
OR b.origin IS NULL
;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test this.
Edited by: Frank Kulash on Nov 6, 2012 7:39 PM
Corrected WHERE clause after MLVrown (below) -
What is wrong with this query of query... Basically it seems like the "IF" logic in the select statement isn't looking at the current results, but instead the first line of the AllCategories() query. Any ideas would be much appreciated.
<cffunction name="getCategoryDetail" returntype="query" >
<cfargument name="CategoryID" default="">
<cfset AllCategories = Application.Celerant.QueriesCached.getAllCategories()>
<cfquery name="CategoryDetail" dbtype="query" >
SELECT
<cfif AllCategories.typ eq 'EMPTY'>
'DEPT' as ThisLevel,
AllCategories.Dept as ThisName
<cfelseif AllCategories.subtyp_1 eq 'EMPTY'>
'TYP' as ThisLevel,
AllCategories.typ as ThisName
<cfelseif AllCategories.subtyp_2 eq 'EMPTY'>
'SUBTYP_1' as ThisLevel,
AllCategories.subtyp_1 as ThisName
<cfelseif AllCategories.subtyp_3 eq 'EMPTY'>
'SUBTYP_2' as ThisLevel,
AllCategories.subtyp_1 as ThisName
<cfelse>
'SUBTYP_3' as ThisLevel,
AllCategories.subtyp_1 as ThisName
</cfif>
FROM
AllCategories
WHERE
AllCategories.web_taxonomy_id = #arguments.CategoryID#
</cfquery>
<cfreturn CategoryDetail>
</cffunction>Basically it
seems like the "IF" logic in the select statement isn't
looking at the current results, but instead the first line
of the AllCategories() query.
That is exactly what is happening. The IF is not evaluated within the QoQ. It is evaluated once, before the QoQ executes, using the values in the first record of the query.
QoQ are very limited. AFAIK they and do not support that kind of logic. So you must loop through the query, one row at a time, and calculate the desired values. -
Query of query with left outer join
Hi,
I cannot use joins in query of query, I try the old method using the ( + ) but no luck "Query Of Queries syntax error. Encountered ( + )."
Here is an example of my query code:
select p.part_id, s.supplier_name, s.second_name
from part p, supplier s
where p.supplier_id = s.supplier_id ( + )
and p.second_id = s.second_id ( + );
PART SUPPLIER_NAME SECOND_NAME
P1 Supplier#1 A
P2 Supplier#2
P3
P4
How can I do the same in query of query syntax?
Thanks!I found a solution:
http://www.bealearts.co.uk/blog/2007/06/20/how-to-do-an-outer-join-in-query-of-queries/
I am not sure about my second condition. i create the join query for the empty columns.
select part.part_id, supplier.supplier_name, supplier.second_name
from part, supplier
where part.supplier_id = supplier.supplier_id
and supplier.second_id is null
union
select part.part_id, supplier.supplier_name, supplier.second_name
from part, supplier
where part.supplier_id = supplier.supplier_id
and part.second_id = supplier.second_id
union
select part.part_id, joinQuery.supplier_name, joinQuery.second_name
from part, joinQuery
where part.supplier_id not in (#ValueList(supplier.supplier_id)#)
Can anyone check and let me know if this is correct?
My final result have one less row from parts table.
Thanks -
How to implement enter-query , execute-query in Apex Forms
Hi,
I am new to Oracle Application Express. I want to know what is the equivalent of ENTER-QUERY and EXECUTE-QUERY features of Oracle Forms in Oracle APEX? I saw a lot of documentation, but everywhere I found that APEX forms only have 3 database actions, (1) INSERT (2) UPDATE & (3) DELETE.
Does anybody know how we can do QUERY in APEX Forms? (like we do in Oracle Developer Forms).
Thanks in advance.Oracle APEX is a web/ stateless environment. So you do not have the same functionality/ features as in a Oracle Forms environment which is session/state oriented.
You can however achieve functionality similar to Enter Query / Execute Query through other means.
The easiest is to use the Forms with Report wizard. It creates 2 pages, the first one is a report and the other a Form. Clicking on the Report rows takes you to the Form page in Edit mode where as the the Create button takes you to the Form in Insert mode.
If you want to have the enter-query / execute query on a single page it will require significant effort and skills. Try it when you have acquired some more skills in Apex.
In APEX , like any other web application, you have to think in the web paradigm and not client-server. Even Forms 11g is essentially client-server like and is session oriented through the forms applet.
Regards,
Maybe you are looking for
-
How do i download my files from an external hard drive to my new macbook pro
how do i dowload my files from my external hard drive onto my new macbook pro?
-
Can i install wow on an external hard drive?
Can i install wow on an external hard drive and play it off that, cause im runing out of space on my computer.
-
Acrobat 9.4 takes 10 seconds for every action
I'm new to the Mac platform, recently bought a 27" iMac running Snow Leopard 10.6.4. (2.8 GHz i%, 4GB 1333 MHz DDR3) I've had CS5 running quite happily for a few weeks, including Acrobat 9.4. Over the last few days Acrobat started this odd behaviour
-
The Apple sales rep told me I could use Airplay Mirroring between my iPad2 and AppleTV 2 via bluetooth and I didn't need wifi. Is that true?
-
If you uninstall iTunes, does your library disappear?
I keep on getting the Error 7 (Windows error 14001). I've done everything I could find, except for uninstall iTunes. The reason being, I'm scared that if if I delete iTunes I'll lose all my songs. Is that what happens?