query returns too many results
I have this query that returns records 118 900 when I try to addor oth_tchname_ssn like '% % 123456789 '.
at the end of the query.
When I take off the or oth_tchname_ssn like '% % 123456789' returned 32 records, which seems all right.
Any ideas as to where my cfquery statement is false?
Thank you
Emmanuel
This was solved by the addition of parent tags.
Tags: ColdFusion
Similar Questions
-
HP laptop: enter the model number and get a "game too many results.
My HP laptop dies after 6 weeks. When I contact support, he asks the model number. I enter: say "15-ay041wm" is what the box and laptop. I get a reply that says.
"Sorry, too many results match your search for 15-1y041wm.
"So I try HP Notebook, I get the same mesaage above, except with the HP laptop ' instead of '15-ay041wm.
Because no matter where I'm going, he wants the model number and I give, I can't help. No cat, no nothing.
So someone can tell me how to get support?
If HP is unable to handle the number of model of it's own computers, so I'm not very confident.
Here are the free support number to call in the USA/Canada... 1 800-474-6836.
Now here's another question, you can report to HP on if you want...
You must stay online and listen to the automated assistant trying to talk to you to talk to a representative... visit the HP website... go to this support forum (which has no official presence in HP), etc.
After a minute or two, the Assistant to say, if you can't get online, will stay on the line to speak to a customer services representative.
This is when you will have the opportunity to speak with a support person and report the problem to open a pension case.
-
10.1.3.4.2 - Multi Select guest - research shows too many results
Hello
Someone sees a situation...
When you use a multiple selection of dash prompt, the prompt has the following clause to return only the code with the status of N = select ID from table where status in (' ' n ') and it works fine
but in the guest even if we use the code names of search for example Contains "XXX", it will return all codes regardless of status, though even she must return only status = N codes,.
any ideas...
Thank you
Hello
I assume you are using the available inside the Multi selection prompt search filter?
If this is the case, then this is how OBIEE multi select work. When you apply the search condition in mutiselect, it generates a new query with the condition provided in exculdes and the search filter no matter what external sql filter.
If you want to keep the filter at the prompt, use condition you be the guest (fx). It will be useful.
See you soon
HN
-
Add contact based on the username: too many results!
Someone gave me their exact Skype username. Now, I want to add this contact.
When I go to add contact and enter the user name, I get a long list of search results. The results do not show user names, but rather their real names. How can I know who is the person with the username? Is there a way to check the user name?
If you are looking for using the exact name of Skype, then as a general rule, the first result displayed should match this user. However, you can always check it out by clicking on the display of the results and see the selection profile. You are looking for which is shown as the Skype name.
-
I am writing a script to get all virtual machines in a set of clusters and data warehouses that they are on the amount of the freespace datastore. For some reason, it's getting ALL the VMs on data warehouses.
$ServerName = "servername."$report = @)$cl_filter_pattern = "* PCI.$digits = 2SE connect-VIServer $ServerNameforeach ($cluster Get-cluster | where {$_ .name - like $cl_filter_pattern}) {}Get-VMHost-location $cluster | Get-Datastore. %{$vms = $cluster | Get - VM{foreach ($vm to $vms)$info = "" | Select the center of data, Cluster, data store, VM, capacity, put in service, available, PercFree$info. Datacenter = $_. Data Center$info. Cluster = $cluster. Name$info. Data store = $_. Name$info. VM = $vm. Name$info. Capacity = [math]: Round($_.capacityMB/1024,2)$info. Put into service = [math]: Round (($_.)) ExtensionData.Summary.Capacity - $_. ExtensionData.Summary.FreeSpace + $_. ExtensionData.Summary.Uncommitted)/1GB,2)$info. Available = [math]: round ($info. Capacity - $info. Put into service, 2)$info. PercFree = [math]: round (100 * $_.) FreeSpaceMB / $_. CapacityMB, $digits)$report += $info}}}$report | Export-Csv "C:\datastore-vms.csv" - NoTypeInformation - UseCultureDisconnect-VIServer $ServerName - confirm: $falseWhere I'm going wrong?
I have rearranged the curls a bit, and I use a hash table as a list of choices for data warehouses.
That avoids making several cmdets of Get_View for the same data store.
I use the list of datastoreId for each virtual computer.
Let me know if it produces a better result?
$ServerName = "servername" $report = @() $cl_filter_pattern = "**PCI" $digits = 2 Connect-VIServer $ServerName foreach($cluster in Get-Cluster | where {$_.name -like $cl_filter_pattern}){ $dsTab = @{} Get-VMHost -Location $cluster | Get-Datastore | where {$_.ExtensionData.Summary.MultipleHostAccess} | %{ $dsTab.Add($_.Id,$_) } foreach ($vm in Get-VM -Location $cluster){ $vm.DatastoreIdList | %{ $ds = $dsTab[$_] $info = "" | select DataCenter, Cluster, Datastore, VM, Capacity, Provisioned, Available, PercFree $info.Datacenter = $ds.Datacenter.Name $info.Cluster = $cluster.Name $info.Datastore = $ds.Name $info.VM = $vm.Name $info.Capacity = [math]::Round($ds.capacityMB/1024,$digits) $info.Provisioned = [math]::Round(($ds.ExtensionData.Summary.Capacity - $ds.ExtensionData.Summary.FreeSpace + $ds.ExtensionData.Summary.Uncommitted)/1GB,$digits) $info.Available = [math]::Round($info.Capacity - $info.Provisioned,$digits) $info.PercFree = [math]::Round(100 * $ds.FreeSpaceMB/$ds.CapacityMB,$digits) $report += $info } } } $report | Export-Csv "C:\datastore-vms.csv" -NoTypeInformation -UseCulture Disconnect-VIServer $ServerName -Confirm:$false
-
Join provided they produce too many results
Hello
I am making a simple inner join on the two tables, and the result set is hugh! I don't understand why the number of results is so great.
Table 1 contains lines of 2932 (table is called to load)
Table 2 of the 271 lines (table is called element)
The code I use to join the table is:
The result set has 200040 lines! I understand that this is a kind of Cartesian join, but shouldn't the join condition, reduce the number of lines.select count(*) from load inner join item on item.item_id= substr(old_system_id, instr(old_system_id,'-',1,3)+1, 1);
If you join a single digit, there is no way those columns may be unique within your two tables so of course that you're going to get a vector product, if it is not not a full product cartersian.
SQL> select * from t1; C1 C -------------------- - 1 a 1 b 1 c 2 d SQL> select * from t2; C1 C -------------------- - 2 w 1 x 1 y 1 z SQL> select * 2 from t1 3 join t2 on (t1.c1 = t2.c1); C1 C C1 C -------------------- - -------------------- - 2 d 2 w 1 c 1 x 1 b 1 x 1 a 1 x 1 c 1 y 1 b 1 y 1 a 1 y 1 c 1 z 1 b 1 z 1 a 1 z 10 rows selected.
Note that the join for '2' has worked correctly, but '1' gives a great product. know exactly what it is supposed to do.
-
Export of custom object return too many Records
Hello
I have setup an object export custom which seems to be a poor handling of the options on the page and pageSize. The answer seems to be including all records on the page 1 last page I asked. For example, when I GET this URI:
https://secure.Eloqua.com/API/bulk/1.0/customObject/9/export/23data? page = 5& pageSize = 100
I get this response:
{'total':123456789 "pageSize":100 'page':5 'values': [{"CustomerId": 1}, {"CustomerId": 2}...]} {[{"CustomerId": 499}]}
Instead of getting 100 records, I'll be back 499.
It's a bug that has been fixed and goes off with the next major release.
-
too many return values for a single node
I have a table with two columns
the table structure
----------------------
string school_name type
xmltype obj_xml
Row1
----------
abc_school,
< student >
< student >
< id > 101 / < ID >
< teacher > CBA < / teacher >
< / student >
< student >
< id > 102 / < ID >
XYZ < teacher > < / teacher >
ONP < teacher > < / teacher >
RSM < teacher > < / teacher >
< / student >
< / students >
row2
-----------
def_school,
< student >
< student >
< id > 301 / < ID >
pqr < teacher > < / teacher >
< / student >
< student >
< id > 302 / < ID >
XYZ < teacher > < / teacher >
< / student >
< / students >
is it possible to display data in the format using a query oracle below.
---------------------------------------------------------------------------------------------------
teacher id school_name
--------------------- ------- ------------
abc_school 101 abc
abc_school 102 xyz
abc_school 102 onp
RSM abc_school 102
I used the slot request, throwing an error - too many return values for a single node
SELECT school_name, teacher
ExtractValue (value (x), ' / / key ') like student_id
extractValue (value (x), ' / / value ') AS teacher
SCHOOL t,.
TABLE)
XMLSequence (extract (obj_xml, ' / students/pupils '))
) x
Please post How can I modify this query, the teacher tags may vary for each student
Published by: user7955917 on May 8, 2012 04:00As mentioned in your other thread today, it would be helpful if you could post your exact version of db.
Samples of work would be appreciated too, the XML data, you gave are not correct.I would do it with two XMLTables, like this:
SQL> SELECT school_name 2 , x1.id 3 , x2.teacher 4 FROM school t 5 , XMLTable('/students/student' 6 passing t.obj_xml 7 columns id number path 'id' 8 , teachers xmltype path 'teacher' 9 ) x1 10 , XMLTable('/teacher' 11 passing x1.teachers 12 columns teacher varchar2(30) path '.' 13 ) x2 14 ; SCHOOL_NAME ID TEACHER ------------------------------ ---------- ------------------------------ abc_school 101 abc abc_school 102 xyz abc_school 102 onp abc_school 102 rsm def_school 301 pqr def_school 302 xyz 6 rows selected
-
SYS_REFCURSOR: Variables of the game results or the query return types do not match
Hello
I have 2 snippets below, it codes marked 'Test 1' does not work, it gives the error message, see the code below. Why it gives an error? The second code succeeds and works according to the needs.
Test1 in brief:
Call proc P3
Proc calls P3 P1
Test 2 in brief:
Call func P2,
Proc calls P2 P1.
---
1. test 1, it breaks down:
2. test cycle 2, he succeeds:create or replace procedure P1 ( i_name IN VARCHAR2, o_cur out SYS_REFCURSOR ) is v_cur SYS_REFCURSOR; begin open o_cur for select i_name from dual; end P1; / create or replace function P2 ( i_name IN VARCHAR2 ) return SYS_REFCURSOR is v_cur SYS_REFCURSOR; begin p1( i_name, v_cur); return v_cur; end P2; / create or replace procedure P3 ( i_name IN VARCHAR2, o_cur out SYS_REFCURSOR ) is v_cur SYS_REFCURSOR; begin p1( i_name, o_cur); end P3; / declare v_name varchar2(100) := 'test1'; v_cur SYS_REFCURSOR; v_fetch_var varchar2(100); begin P3(v_name, v_cur); --v_cur := P2(v_name); if v_cur%ISOPEN then dbms_output.put_line('v_cur%ISOPEN=true'); else dbms_output.put_line('v_cur%ISOPEN=false'); end if; -- loop fetch v_cur into v_fetch_var; exit when v_cur%notfound; dbms_output.put_line('v_fetch_var='||v_fetch_var); end loop; end; /* Output: v_cur%ISOPEN=true ORA-06504: PL/SQL: Return types of Result Set variables or query do not match ORA-06512: at line 16 */
Published by: CharlesRoos on February 8, 2010 05:06create or replace procedure P1 ( i_name IN VARCHAR2, o_cur out SYS_REFCURSOR ) is v_cur SYS_REFCURSOR; begin open o_cur for select i_name from dual; end P1; / create or replace function P2 ( i_name IN VARCHAR2 ) return SYS_REFCURSOR is v_cur SYS_REFCURSOR; begin p1( i_name, v_cur); return v_cur; end P2; / create or replace procedure P3 ( i_name IN VARCHAR2, o_cur out SYS_REFCURSOR ) is v_cur SYS_REFCURSOR; begin p1( i_name, o_cur); end P3; / declare v_name varchar2(100) := 'test1'; v_cur SYS_REFCURSOR; v_fetch_var varchar2(100); begin --P3(v_name, v_cur); v_cur := P2(v_name); if v_cur%ISOPEN then dbms_output.put_line('v_cur%ISOPEN=true'); else dbms_output.put_line('v_cur%ISOPEN=false'); end if; -- loop fetch v_cur into v_fetch_var; exit when v_cur%notfound; dbms_output.put_line('v_fetch_var='||v_fetch_var); end loop; end; /* Output: PROCEDURE P1 compiled FUNCTION P2 compiled PROCEDURE P3 compiled anonymous block completed v_cur%ISOPEN=true v_fetch_var=test1 */
CharlesRoos wrote:
Thenn should be documentation that says "recovery of the data type that sys_refcursor fails if you pass by reference too often."
I can't really work on what your nested code is supposed to do, but in a simple example, this statement is false.
SQL> create or replace procedure p1 (l_c out sys_refcursor) 2 is 3 begin 4 open l_c for select dummy from dual; 5 end; 6 / Procedure created. SQL> create or replace procedure p2 (l_c out sys_refcursor) 2 is 3 begin 4 p1 (l_c); 5 end; 6 / Procedure created. SQL> var c refcursor SQL> exec p2 (:c) PL/SQL procedure successfully completed. SQL> print c D - X SQL> create or replace procedure p3 (l_c out sys_refcursor) 2 is 3 begin 4 p2 (l_c); 5 end; 6 / Procedure created. SQL> exec p3 (:c) PL/SQL procedure successfully completed. SQL> print c D - X SQL>
However, I would say from a Ref Cursor once between PL/SQL procedures is already too.
Re: Extract of the cursor variable
And there is documentation saying that.
http://download.Oracle.com/docs/CD/E11882_01/AppDev.112/e10472/static.htm#CIHCJBJJ
Purpose of cursor Variables
Variable cursor allows you to pass between PL/SQL stored subprograms and their clientssets of query results. This is possible because the PL/SQL and its clients share a pointer to the work area where the result set is stored.
-
Parameter query returns no results
Hello
I need a parameter query to return all customers for the locality.
The name of the locality is given as a parameter.
The problem with me is that the query is not even a single line when it should return at least fifty!. Locality is not unique, and there are a lot of consumers with the same value for the LOCALITY. The query I use is given below:
SELECT ROWID, of GEOM FROM NOT_MY_CONSUMERS WHERE'= a ' and LOCALITY =: var1;
When I try to use an ObjectID as parameter the result is returned property. ObjectID is unique for each line and thus a single row is returned
in the result.
Is it not possible to use the parameter query for non-unique settings?
Help, please!
I'm stuck with my project.
Thank you very much!!
Neha
Published by: Neha39 on March 16, 2012 04:53
Published by: Neha39 on March 16, 2012 05:15As your column data type, please use this one:
SELECT ROWID, of GEOM FROM NOT_MY_CONSUMERS WHERE'= a ' and trim (TOWN) =: var1;
-
query returns different results depends on the length of the day
Hello!
I have a query:
This query returns different results in the morning (09:00) and afternoon (16:00) on the same database for the same input data (I have prepared a script to test).INSERT /*+ APPEND */ INTO pwa_process ( id, id_session, id_customer, s2k_account, service_seq_num, msisdn, id_tariff, contract_end_date, last_contract_date, next_available_contract_date, tariff_name, description, description_long, imei_old, activation_date, id_customer_number, arpu, value0, value1, value2, value3, value4, value5, id_pricing_plan) WITH msisdns AS (SELECT msisdn ms FROM customer_number cn JOIN customer_s2kaccount cs ON cn.s2k_account = cs.s2k_account AND cs.id_customer = v_customerId) SELECT seq_pwa_process.NEXTVAL, v_sessionId, customer_s2kaccount.id_customer, customer_s2kaccount.s2k_account, customer_number.service_seq_num, msisdn.msisdn, tariff.id, NVL(CASE WHEN date_contract_end IS NULL AND le_contract_end_date IS NOT NULL OR (date_contract_end < le_contract_end_date) THEN le_contract_end_date ELSE NVL(date_contract_end, ADD_MONTHS(customer_number.date_start, customer_number.ada_availability)) END, TO_DATE('01.01.1970', 'DD.MM.YYYY')) contract_end_date, CASE WHEN NOT customer_number.date_first_activation IS NULL AND customer_number.date_first_activation > (CASE WHEN ada_priority = 1 THEN ada_date_pwa WHEN ada_priority <> 1 AND (date_pwa IS NULL AND exchange_date IS NOT NULL OR date_pwa < exchange_date) THEN exchange_date ELSE date_pwa END) THEN customer_number.date_first_activation ELSE (CASE WHEN ada_priority = 1 THEN ada_date_pwa WHEN ada_priority <> 1 AND (date_pwa IS NULL AND exchange_date IS NOT NULL OR date_pwa < exchange_date) THEN exchange_date ELSE date_pwa END) END last_contract_date, ADD_MONTHS(CASE WHEN NOT customer_number.date_first_activation IS NULL AND customer_number.date_first_activation > NVL( (CASE WHEN ada_priority = 1 THEN ada_date_pwa WHEN ada_priority <> 1 AND (date_pwa IS NULL AND exchange_date IS NOT NULL OR date_pwa < exchange_date) THEN exchange_date ELSE date_pwa END) , NVL(customer_number.date_first_activation, NVL(customer_number.date_start, customer_number.date_effective))) THEN customer_number.date_first_activation ELSE NVL( (CASE WHEN ada_priority = 1 THEN ada_date_pwa WHEN ada_priority <> 1 AND (date_pwa IS NULL AND exchange_date IS NOT NULL OR date_pwa < exchange_date) THEN exchange_date ELSE date_pwa END) , NVL(customer_number.date_first_activation, NVL(customer_number.date_start, customer_number.date_effective))) END, customer_number.ada_availability - DECODE(NVL(customer_number.current_contract_type, 0), 2, DECODE(customer_number.reduced_contract_used, 0, NVL(customer_number.el_contract_calculated_reduc,0), 0), 0)) next_available_contract_date, tariff.name_ada, DECODE(msisdn_group.def_column, 0, msisdn.value0, 1, msisdn.value1, 2, msisdn.value2, 3, msisdn.value3, 4, msisdn.value4, 5, msisdn.value5, msisdn.value0), msisdn.value0 || ';' || NVL(msisdn.value1, '') || ';' || NVL(msisdn.value2,'') || ';' || NVL(msisdn.value3,'') || ';' || NVL(msisdn.value4, '') || ';' || NVL(msisdn.value5, ''), customer_number.imei, NVL(customer_number.date_first_activation, NVL(customer_number.date_start, customer_number.date_effective)) date_start, customer_number.id, NVL(s2kaccount.arpu1,0), msisdn.value0, msisdn.value1, msisdn.value2, msisdn.value3, msisdn.value4, msisdn.value5, customer_number.id_pricing_plan FROM customer_s2kaccount JOIN customer_number ON customer_number.s2k_account = customer_s2kaccount.s2k_account AND customer_number.service_state = 'AB' JOIN msisdn ON msisdn.msisdn = customer_number.msisdn JOIN TABLE(CAST(v_tmp_table AS ADA.NUMBER_TABLE)) ids ON ids.column_value = msisdn.id JOIN msisdn_group ON msisdn_group.id = msisdn.id_msisdn_group JOIN pricing_plan ON pricing_plan.id = customer_number.id_pricing_plan AND pricing_plan.is_for_pwa = 1 JOIN tariff ON tariff.name = pricing_plan.id JOIN s2kaccount ON s2kaccount.s2k_account = customer_number.s2k_account LEFT JOIN (SELECT msisdn, exchange_date, ADD_MONTHS(exchange_date, MAX(prolongation)) le_contract_end_date FROM loyalty_exchange a, msisdns WHERE a.msisdn = msisdns.ms AND exchange_date >= ALL (SELECT exchange_date FROM loyalty_exchange b WHERE b.msisdn = a.msisdn) GROUP BY msisdn, exchange_date) le ON le.msisdn = customer_number.msisdn WHERE customer_s2kaccount.id_customer = v_customerId;
Oracle 9.2.0.6 @solaris
I checked the query plans, but they look the same in the morning and the afternoon. I don't know where to look for a problem/bug.
Please help me with suggestions. is in bug with join ansi? or a left outer join?
Published by: batonoff on February 16, 2009 16:56
Published by: batonoff on February 16, 2009 16:58
Published by: batonoff on February 16, 2009 17:00I recommend you post your declaration in the {} code tags (without the spaces) so that we can actually read.
You are absolutely positive that nothing has changed on the data between when you run in the morning and in the afternoon?
-
Scalability problems - too many Active Sessions?
Hello
I'm having a problem with an app that I built for one of the College campus, that I work. The application is a queue system where there are stations for students to access your room, admin stations where staff can see these students and "call", and displays outside every office employee that shows the student who was called. There are about 20 of the latter type of billboards. I have the following code in my footer to query the DB for most recent students called for a specific room:
The process of OnDemand, F_NEXT_STUDENT executes the query and returns the result:<script type="text/javascript"> <!-- var refresh_region = function( workstation_in, div_in ) { $.get( 'wwv_flow.show', {"p_request" : 'APPLICATION_PROCESS=F_NEXT_STUDENT', "p_flow_id" : $v('pFlowId'), //app id "p_flow_step_id" : $v('pFlowStepId'), //page id "p_instance" : $v('pInstance'), //session id "x01" : workstation_in }, function(data) { $(div_in).html(data); } ); setTimeout(function() { refresh_region( workstation_in, div_in ) }, 5000); } refresh_region( '&P7_WORKSTATION_IN.', '#next_student_div' ); //--> </script>
However, when all these display panels is turned on (and I use the code as follows in the other pages for similar purposes) the application become slow and eventually unresponsive. As a first step, we have the application running a box with Oracle XE. Finally, we have migrated to a full blown installation 11g with APEX listener and GlassFish. My DBA said everything looks ok on the side of the DB, so I tried to dig into other areas to see where the bottleneck can be. After inspecting the report of Active Sessions in the APEX, I noticed that there are a ton of connections being generated (> 30 000). This is not a good thing for me and I try to understand what I am doing wrong.select a.FIRST_NAME || ' ' || a.LAST_NAME into full_name from ONESTOP_QUEUE a where a.WORKSTATION_ID_CALLED = in_workstation_id and a.STATUS = 'CALLED' and a.QUEUE_ID = ( select min( c.QUEUE_ID ) from ONESTOP_QUEUE c where c.WORKSTATION_ID_CALLED = in_workstation_id and c.STATUS = 'CALLED');
At first I used $. post() instead of $. get (). I was also using setInterval() instead of a setTimeout() loop. However, none of these changes really seem to help the situation. I am at a loss to know how else to improve the performance of this application. Any suggestions on what I can try?
Most of the features of the app is on apex.oracle.com
WORKSPACE: SCCC_TEST
USER/PASS: TEST/test
Direct URL to the page (I spend worksation ID): http://apex.oracle.com/pls/apex/f?p=65890:7:0:P7_WORKSTATION_IN:ADMISSIONS_1
Thanks in advance for any help.Hello
are you sure that each AJAX request generates a new APEX session? Because it is based on your downloaded app all right. You can check that by running the following query. It will also show you how long it took APEX to meet your demand for AJAX (elapsed_time). I think that the elapsed time will be the key to find out why your application becomes unresponsive if too many customers are returning. The goal should be that the AJAX request ends as soon as possible. For example 1 sec would be for many, because if you have 20 parallel AJAX requests at the same time, this could have an impact on your DB. You can share your average time?
select apex_session_id, to_char(view_date, 'DD.MM.YYYY HH24:MI:SS') as view_date, elapsed_time, application_info from apex_workspace_activity_log where application_id = 65890 and page_id = 7 and view_date >= sysdate - 0.1 order by 1, 2, 3
I don't know how much data is stored in the ONESTOP_QUEUE table, but it may be useful to adjust your statement used in F_NEXT_STUDENT. On apex.oracle.com, the plan of the explain output shows at least he uses twice a scan interval on index ONESTOP_QUEUE_IDX. For inside MIN instruction it is well, but the external SQL should just do a search PK using QUEUE_ID. This is why I would like to delete
a.WORKSTATION_ID_CALLED = in_workstation_id and a.STATUS = 'CALLED'
to force the index seek PK using QUEUE_iD.
I also suggest that you make your JavaScript code on the page 5 and 7 more transparent. He is currently hiding in the region or footer HTML. I would say to move JS code in the attributes of the page 'Function and Global Variable declaration' and ' run when Page Loads. BTW, there is no need to use $(document) .ready in "Run when the Page loads", because internally, we already use $(document) .ready.
Or instead of using your own JavaScript code you can download the plugin http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-plug-ins-182042.html#dynamic "Timer" and use rather dynamic actions. On page 5 you can use the action "Refresh" to update your classic report and on page 7 you can use an action to "Set the value" to run your query. I think it would make your page easy to read for others.
Concerning
Patrick
-----------
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
A function in a subquery is call too many times.
Hi all
I am struggling to understand why a function in a subquery is called too many times.
Let me explain with an example:
I do not understand why Oracle calls my 28 times function in this example, 4 times should be sufficient.create or replace function all_emp (v_deptno in number) return varchar2 as v_all_emp varchar2(2000); begin dbms_output.put_line ('function called'); for i in (select * from emp where deptno = v_deptno) loop v_all_emp := v_all_emp || i.ename || '; '; end loop; return v_all_emp; end; / -- running just the subquery, calls the function all_emp only 4 times (once for each row in table dept) select d.deptno, d.dname, all_emp(d.deptno) f_all_emp from dept d; -- running the whole query, using regexp to split the value of f_all_emp into separate fields, causes that function all_emp is called 28 times, thus 6 times for each row!! select tmp.*, regexp_substr(f_all_emp,'[^;]*',1,1) emp1, regexp_substr(f_all_emp,'[^;]*',1,3) emp2, regexp_substr(f_all_emp,'[^;]*',1,5) emp3, regexp_substr(f_all_emp,'[^;]*',1,7) emp4, regexp_substr(f_all_emp,'[^;]*',1,9) emp5, regexp_substr(f_all_emp,'[^;]*',1,11) emp6 from (select d.deptno, d.dname, all_emp(d.deptno) f_all_emp from dept d) tmp ;
Is there a way to force that the subquery is materialized first?
A reminder of the facts:
Above function / request is of course a simple example.
In fact, I have a rather complex function, integrating in a subquery.
The subquery is already slow (2 min) to run, but when I want to share the result of the function in several areas (about 20) it's over an hour due to above described behavior.Optimizer merges online view and the query results in:
select d.deptno, d.dname, all_emp(d.deptno) f_all_emp regexp_substr(all_emp(d.deptno),'[^;]*',1,1) emp1, regexp_substr(all_emp(d.deptno),'[^;]*',1,3) emp2, regexp_substr(all_emp(d.deptno),'[^;]*',1,5) emp3, regexp_substr(all_emp(d.deptno),'[^;]*',1,7) emp4, regexp_substr(all_emp(d.deptno),'[^;]*',1,9) emp5, regexp_substr(all_emp(d.deptno),'[^;]*',1,11) emp6 from dept d /
That's why function is called 28 times. Seen go explain plan:
SQL> explain plan for 2 select tmp.*, 3 regexp_substr(f_all_emp,'[^;]*',1,1) emp1, 4 regexp_substr(f_all_emp,'[^;]*',1,3) emp2, 5 regexp_substr(f_all_emp,'[^;]*',1,5) emp3, 6 regexp_substr(f_all_emp,'[^;]*',1,7) emp4, 7 regexp_substr(f_all_emp,'[^;]*',1,9) emp5, 8 regexp_substr(f_all_emp,'[^;]*',1,11) emp6 9 from ( 10 select d.deptno, 11 d.dname, 12 all_emp(d.deptno) f_all_emp 13 from dept d 14 ) tmp 15 / Explained. SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT -------------------------------------------------------------------------- Plan hash value: 3383998547 -------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 4 | 52 | 3 (0)| 00:00:01 | | 1 | TABLE ACCESS FULL| DEPT | 4 | 52 | 3 (0)| 00:00:01 | -------------------------------------------------------------------------- 8 rows selected. SQL>
If we use the NO_MERGE indicator:
SQL> select /*+ NO_MERGE(tmp) */ 2 tmp.*, 3 regexp_substr(f_all_emp,'[^;]*',1,1) emp1, 4 regexp_substr(f_all_emp,'[^;]*',1,3) emp2, 5 regexp_substr(f_all_emp,'[^;]*',1,5) emp3, 6 regexp_substr(f_all_emp,'[^;]*',1,7) emp4, 7 regexp_substr(f_all_emp,'[^;]*',1,9) emp5, 8 regexp_substr(f_all_emp,'[^;]*',1,11) emp6 9 from ( 10 select d.deptno, 11 d.dname, 12 all_emp(d.deptno) f_all_emp 13 from dept d 14 ) tmp 15 / DEPTNO DNAME F_ALL_EMP EMP1 EMP2 EMP3 EMP4 EMP5 EMP6 ---------- -------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- 10 ACCOUNTING CLARK; KIN CLARK KING MILLER G; MILLER; 20 RESEARCH SMITH; JON SMITH JONES SCOTT ADAMS FORD ES; SCOTT; ADAMS; FO RD; 30 SALES ALLEN; WAR ALLEN WARD MARTIN BLAKE TURNER JAMES D; MARTIN; DEPTNO DNAME F_ALL_EMP EMP1 EMP2 EMP3 EMP4 EMP5 EMP6 ---------- -------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- BLAKE; TU RNER; JAME S; 40 OPERATIONS function called function called function called function called function called function called SQL> explain plan for 2 select /*+ NO_MERGE(tmp) */ 3 tmp.*, 4 regexp_substr(f_all_emp,'[^;]*',1,1) emp1, 5 regexp_substr(f_all_emp,'[^;]*',1,3) emp2, 6 regexp_substr(f_all_emp,'[^;]*',1,5) emp3, 7 regexp_substr(f_all_emp,'[^;]*',1,7) emp4, 8 regexp_substr(f_all_emp,'[^;]*',1,9) emp5, 9 regexp_substr(f_all_emp,'[^;]*',1,11) emp6 10 from ( 11 select d.deptno, 12 d.dname, 13 all_emp(d.deptno) f_all_emp 14 from dept d 15 ) tmp 16 / Explained. SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------ Plan hash value: 2317111044 --------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 4 | 8096 | 3 (0)| 00:00:01 | | 1 | VIEW | | 4 | 8096 | 3 (0)| 00:00:01 | | 2 | TABLE ACCESS FULL| DEPT | 4 | 52 | 3 (0)| 00:00:01 | --------------------------------------------------------------------------- 9 rows selected. SQL>
Not sure why the function is executed once 6 and not 4. What we really want, is to materialize reviews online:
SQL> with tmp as ( 2 select /*+ materialize */ 3 d.deptno, 4 d.dname, 5 all_emp(d.deptno) f_all_emp 6 from dept d 7 ) 8 select tmp.*, 9 regexp_substr(f_all_emp,'[^;]*',1,1) emp1, 10 regexp_substr(f_all_emp,'[^;]*',1,3) emp2, 11 regexp_substr(f_all_emp,'[^;]*',1,5) emp3, 12 regexp_substr(f_all_emp,'[^;]*',1,7) emp4, 13 regexp_substr(f_all_emp,'[^;]*',1,9) emp5, 14 regexp_substr(f_all_emp,'[^;]*',1,11) emp6 15 from tmp 16 / DEPTNO DNAME F_ALL_EMP EMP1 EMP2 EMP3 EMP4 EMP5 EMP6 ---------- -------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- 10 ACCOUNTING CLARK; KIN CLARK KING MILLER G; MILLER; 20 RESEARCH SMITH; JON SMITH JONES SCOTT ADAMS FORD ES; SCOTT; ADAMS; FO RD; 30 SALES ALLEN; WAR ALLEN WARD MARTIN BLAKE TURNER JAMES D; MARTIN; DEPTNO DNAME F_ALL_EMP EMP1 EMP2 EMP3 EMP4 EMP5 EMP6 ---------- -------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- BLAKE; TU RNER; JAME S; 40 OPERATIONS function called function called function called function called SQL> explain plan for 2 with tmp as ( 3 select /*+ materialize */ 4 d.deptno, 5 d.dname, 6 all_emp(d.deptno) f_all_emp 7 from dept d 8 ) 9 select tmp.*, 10 regexp_substr(f_all_emp,'[^;]*',1,1) emp1, 11 regexp_substr(f_all_emp,'[^;]*',1,3) emp2, 12 regexp_substr(f_all_emp,'[^;]*',1,5) emp3, 13 regexp_substr(f_all_emp,'[^;]*',1,7) emp4, 14 regexp_substr(f_all_emp,'[^;]*',1,9) emp5, 15 regexp_substr(f_all_emp,'[^;]*',1,11) emp6 16 from tmp 17 / Explained. SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT ----------------------------------------------------------------------------------------------------------------------- Plan hash value: 634594723 --------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | --------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 4 | 8096 | 5 (0)| 00:00:01 | | 1 | TEMP TABLE TRANSFORMATION | | | | | | | 2 | LOAD AS SELECT | | | | | | | 3 | TABLE ACCESS FULL | DEPT | 4 | 52 | 3 (0)| 00:00:01 | | 4 | VIEW | | 4 | 8096 | 2 (0)| 00:00:01 | | 5 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6603_20255AE | 4 | 52 | 2 (0)| 00:00:01 | PLAN_TABLE_OUTPUT ----------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------- 12 rows selected. SQL>
However, suspicion of MATERIALIZATION is a hint of undocumented.
SY.
-
Error message "too many redirects."
I am running Windows 7, using the Chrome browser and have My Yahoo set as my homepage on my desk. I can't access my Yahoo I get the error page "Web page a redirect loop" with message void "too many redirects." I followed the instructions and deleted cookies, third-party cookies accepted and tried different browsers. I can't access my Yahoo on other devices.
Hello Janet,.
Thanks for posting your query in Microsoft Community.
Let me ask you;
- The issue is specific to Google Chrome browser?
- Are you facing any issues with Internet Explorer?
If the problem is specific to Google Chrome, I recommend posting your query in the support forum of Google Chrome for the best possible response to your query.
If you are having problems with Internet Explorer as well, please come back with answers to the following questions;
- What is the version of Internet Explorer do you use?
- What security software is installed on the computer?
- When was the last time it was working fine?
- Remember to no particular change in the computer before the show?
If you are faced with questions as well using Internet Explorer, you can try the following methods and let us know the result.
Method 1: I recommend that you clear your browser cache and temporary internet files to ensure that they are not causing your problem. Please delete your browser cookies by following the instructions.
Open Internet Explorer, click the Start button. In the search box, and then type Internet Explorerin the list of results, click on Internet Explorer.
- Select Tools (via the gear icon) > Security > delete history....
Be sure to uncheck the favorite preserve Web site data and check the Temporary Internet files and Cookies , and then click Remove.
Once it has cleared your cache and cookies successfully, you will receive a confirmation at the bottom of the window.
If the problem persists, try Method 2.
Method 2: I suggest that you follow the steps in the article given below and check.
Can't access some Web sites in Internet Explorer
Note: The steps described in the article for Internet Explorer 10 for Windows 7 also applies to IE 11 for Windows 7.
Important: Reset the Internet Explorer settings can reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings.
Hope the helps of information. Let us know if you need help with Windows related issues. We will be happy to help you.
Hope this information is useful. Please feel free to answer in the case where you are facing in the future other problems with Windows.
-
Too many problems with the latest version of Lightroom
Hi all
I have too many problems with the latest version of Lightroom (CC 2015.2.1 1046594)
In fact, the latest version of 3 or 4 were bad: instead of doing better, I always had more problems.
So I would like to go back to a previous version of lightroom
Adobe customar care, in Italy, is unnecessary:
they can just to:
-looking for answer on this forum
-saying "you solve your problems just with the de-insall and re-install it.
stop, no more...
in this way they create me a lot fo iusses...
I use the English version of the PS and LR, but they made me reinstall the Italian version of CC because it has been blocked
the result was that CC does not recognize software, due to a different language version
so, I contacted again Adobe Customer Care... they said "no problem, uninstall LR, delete these files and install this...
I did and I let go 2 years to develop the parameters on the correction of the colors for my clients because they told me to remove a folder, I need!
so, I ask you now if there is a way to return to a previous version of lightroom, any previous version...
I never found better performance in more recent versions...
I've always found, performance slower, more problems...
personal idea: I do not understand why adobe are boicotting itself, but I think he do!
Thanks to you all
Hi ramontillo,
6.3/CC 2015.3 Lightroom is now available - try to update to this version which includes the previous import feature, bug fixes and new support for photo/target device profile: Lightroom CC 2015.3 / 6.3 now available
Concerning
Pete
Maybe you are looking for
-
How to extract files on DVD VOB
I have many DVDs made from iDVD. The source of film is created from the FCE to QuickTime files. I did not save the Video_TS, VOB?, files. Can I extract these files from the DVD so I can use them for posting to YouTube, more editing, etc?
-
How to open a html (index.html) file on my hard drive?
In the old FireFox drop-down the menu allowed me to open any file html on my HD. How to open an html file on the hard drive with the new FireFox?
-
7203ss dv7 ENVY: ENVY dv7 7203ss los Necesito UN driver of the huella y otros mas few
Hola muy buen dia el Necesito UN driver of the huella y me sirva para el operating system windows 7 y TR pudiesen los demas pilot tambien! Gracias
-
Error in Satellite A135-S7404 - Vista Recovery problem - 10-FC12-0017
I bought a laptop Satellite A135-S7404 and had a problem with an operating system.I went to recover the system with the CD that came with it but 3/4 of the way threw the second disc, it stops and gives me a 10-FC12-0017 error message and wants me to
-
Hello! I have a Lenovo B50-30 with Intel Celeron N2930 quad-core and 2 slots for RAM, a 4 GB and the other is free. Can you tell me if the second slot is active for an another RAM upgrade? Thank you.