The analysis of the query variable
I am facing a problem when parsing variable query of exit.Scenario: -.
I stored the name of session variable as long as the value of a column in a table.
Now, I used the cfquery tag and get the result column value that is the name of the session variable. But cold fusion does not analyze this session with its actual value variable.
Step 1 - Table view using the cfdump tag
query - Top 1 of 1 lines
PARAMETERNAME - PARAMETERVALUE
1 @matterspacename - #SESSION. Matter_space_Name #.
Step 2 - use cfquery tag to retrieve data from the table: -.
< name cfquery = "qSendNotification" datasource = "#Database_DSN #" >
Select
ParameterName,
ParameterValue
Of
Tbl_EventParameterDetails
where
NotificationEventID = 1
and IsActive = 1
< / cfquery >
Step 3 - now using the cfquery output result.
< cfset event_data = #qSendNotification.ParameterValue # >
Step 4 - when I used cfdump to view the result of his shows value provided for in: -.
< cfdump var = "#event_data #" >
output:-#SESSION. Matter_space_Name #.
Instead of the actual value of the session variable analysis, it displays the name of the session variable.
Please help me, how to analyze this session value or if my code is an error, please suggest me another way to handle this situation.
Thanks in advance
In short when I dump the query result it shows just the name of the session variable because it is [#Session.Matter_space_Name #] instead of display the value of this variable real session.
Simply, it comes down to this: you saved the string ' #Session.Matter_space_Name # ' as data in the column parameterValue. If this isn't what you want, return to the inserted code data and change the value. Or perhaps you plan to store the string Session.Matter_space_Name under parameterValue so that you can then get the value with
Evaluate (qSendNotification.ParameterValue).
Tags: ColdFusion
Similar Questions
-
hide the query variable Dynamics vo in the advanced search area
Hello
I have a dynamic VO with two variables in the query of the VO, I added the request for the Original Panel in the user interface. On the page, I have the query variable, the values already defined, is anyway to hide variables in the Advanced Search Panel as well as the specific queryable columns appear.
THX
TodayHello
Yes you can hide.
Double-click the link on your VO variable,
Click on the tab "control tips."
There is a choice of display Hint list
Set to hide.Kind regards
Dimitris. -
cfdocument header does not support the query results
IN CF7, I was able to use the results of the query in the header of the document.
Now in CF8 when I try to use cfoutput content in the header either get an error (using the query variable only be #var #) or if I use the syntax #queryname.variablename # I get the first saves the information populating the header for the whole Recordset.
Example:
< cfdocument = bookmark 'pdf' format = "yes" fontembed = "no" >
< cfoutput query = "someQuery" >
< cfdocumentsection name = "#someQuery.someVar #" >
< cfdocumentitem type = "header" >
#someQuery.somevar # <-does not work!
< / cfdocumentitem >
< cfdocumentitem type = "footer" >
#cfdocument.currentpagenumber # the page <-this works
< / cfdocumentitem >
#content #.
< / cfdocumentsection >
< / cfoutput >
< / cfdocument >Hello Eric,
I tried your example with a simple query. I'm using CF8 server with "ColdFusion 8: CFDocument cumulative patch '. The last version released late January. I have no other patch on the test server. But I know it works with CHF2 or CHF3. See my attached code and try with the Cum Hot Fix CFDoc.You can be again on the forums and maybe on our site:
Here's the user forums with no regular follow-up by guaranteed Adobe. This has been the same since the days of Allaire.ColdFusion 8 hotfixes are listed in the technical note here.
Bugs can be submitted to the feature request/Bug Report Form
The Support Page of ColdFusion to the main address is www.adobe.com/support/coldfusion/. Note There are links to programs, patches, information about support plans, etc.
-
Hello!
I have a simple object type and a proecdure in which I am trying to use it to insert into another table
-object
CREATE ORREPLACETYPEmt_mtg ASOBJECT
(
ACOL NUMBER ,
BCOL NVARCHAR2 (100)
);
CREATE ORREPLACETYPEREF_MTG ASTABLEOFMt_MTG ;
-same structure as the use of sampletbl target table in the cursor query
create table tbl_MT_MTG
(
ACOL NUMBER ,
BCOL NVARCHAR2 (100)
);
-procedure
CREATE ORREPLACEINTERIORTEST_PROCEDURE1
AS
ref_cur sys_refcursor ;
REFR ref_mtg ;
BEGIN
OPEN ref_cur FOR
Select acol,
BCOL
DE sampletbl où rownum<10;
Fetch ref_cur in bulk collectintorefr;
Insert intotbl_MT_MTG(acol,bcol)selectacol,bcol fromtable(refr);
commit;
CLOSE Ref_cur;
END;
/
When I run this procedure fails with
ORA-06504: PL/SQL: return variables of the game results or the query types do not match
ORA-06512: at "TEST_PROCEDURE1", line 10
ORA-06512: at line 2
Any help on this please...
Thanks to an OLD POST below
so perfect helped me! Thank you
Tubby
After 5 years of more :-)
How to store refcursor in collection How to store refcursor in collection
-
Bind the Variable Table name in the query of VO
I have a VO that must have its clause defined dynamically at run time. I have a string bind variable defined with a default value that is referenced in the query of the VO. However, JDeveloper allow me to leave the definition of the query of the view object when the from clause is a variable binding, even if the binding variable has the default value.
For example.
Select
« X »
Of
: TABLE
where
1 = 1
The variable binding TABLE is defined as a string with a default value of the 'double '. Did I miss something in the definition of the VO?
Thank you
Hello
I suggest you to dynamically set the query of the view object. This does not meet your requirements.
xxVo.setQuery ();
-
How not to display variable binding in the query ADF search panel?
Hello, I use JDeveloper 11.1.2.3.0.
I have a variable binding in my VO, (* required) that I use in the sql query. I put the value of this variable to link through the groovy expression so I don't have to manually put through my page. It works fine but the problem is that it appears in the query ADF Panel that I created in my page. To do this, I created a ViewCriteria and I've specified to display only 3 (other) fields for the simple search. Apart from the selected 3 variable bind shows here again because its value is set. I tried to remove the ' * required ' of the variable binding in the original Version, but in this case I have problems with my sql query.
Does anyone know how this variable is not to display in the Panel request ADF?
Thank you
Has tried to define the binding to bee hidden variable?
Controll tips, hint of display = hide
-
Question the use of Oracle query Variables
Hello
I am new to Oracle, I tried to extract the data from the Oracle database by using the following query which includes 1 variable SYSDATE_UTS, but when I try to execute the query I get an error. Please let me know what I am doing wrong and how I can fix.
Error message
-----
ORA-06550: line 4, column 1:
PLS-00428: an INTO clause in this SELECT statement
-----
Oracle query
DECLARE SYSDATE_UTS NUMBER: = (sysdate-to_date('19700101','yyyymmdd')) * 86400;
BEGIN
SELECT
INCIDENT_NUMBER,
TO_DATE (to_char ((1/86400 * REPORTED_DATE) + to_date ('19700101', 'YYYYMMDD'), "jj/mm/aaaa hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as REPORTED_DATE_TIME,
GROUP_TRANSFERS
LAST_MODIFIED_BY
, to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * LAST_MODIFIED_DATE, "mm/dd/yyyy hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as LAST_MODIFIED_DATE
, (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) age
CASE
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 0 AND 1, THEN ' 0 - 1 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 2 AND 4 and THEN 2-4 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 5 AND 9, THEN 5-9 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 10 AND 19, THEN 10-19 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) > 20 THEN ' Days 20 + ".
ANOTHER "UNKNOWN".
END AS AGE_GROUP
OF IncidentDataBase
and the STATE not in (4,5,6)
and rownum < 10;
END;If you run this query in sql * plus you can declare a sql * more variable, assign a numeric value according to 'now' and use in your application, i.e.
SQL > variable NUMBER of SYSDATE_UTS;
SQL > exec SYSDATE_UTS: = (sysdate-to_date('19700101','yyyymmdd')) * 86400;You would then call your request, referring to sql * more variable with a colon as SYSDATE_UTS prior to it (i.e.: SYSDATE_UTS)
SELECT
INCIDENT_NUMBER,
TO_DATE (to_char ((1/86400 * REPORTED_DATE) + to_date ('19700101', 'YYYYMMDD'), "jj/mm/aaaa hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as REPORTED_DATE_TIME,
GROUP_TRANSFERS
LAST_MODIFIED_BY
, to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * LAST_MODIFIED_DATE, "mm/dd/yyyy hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as LAST_MODIFIED_DATE
, (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) age
CASE
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 0 AND 1, THEN ' 0 - 1 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 2 AND 4 and THEN 2-4 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 5 AND 9, THEN 5-9 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 10 AND 19, THEN 10-19 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) > 20 THEN ' Days 20 + ".
ANOTHER "UNKNOWN".
END AS AGE_GROUP
OF IncidentDataBase
and the STATE not in (4,5,6)
and rownum<>Table stores IncidentDataBase the "dates" in the number of seconds since the epoch unix?
-
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.
-
Hi all
In addition to the discussion of yesterday (
)For a list of the table used in the SQL query, there is another way.
If we plan to explain for the query command, table plan we will be able to get all the table names.
But in the query, if we used all the views, the tables used in the underlying views are also the list.
I don't know how to do to get the name of view only, not the names of the underlying tables.
Thank you
Manon...
Dint you pick me up I guess. If you see the plan for performance that I posted you will find oracle have not all table EMP scan. There is therefore no reference to the EMP table in the PLAN_TABLE.
SQL > delete from plan_table;
0 rows deleted.
SQL > explain the plan for
2. Select empno in emp;He explained.
SQL > select * from plan_table where object_type = "TABLE";
no selected line
-
I am writing a query that scans a product Dimension Row_Wid, notes the gaps in the sequence and generates the missing Row_Wids. It loads these 'missing Feds"in a sequence of wid created table to reuse by Informatica transformation of research without bond during the subsequent data loads. Yes, I expect many people asking why I do this. The simple reason is that Informatica has a limit of 2 147 sequence generator 483 647'. I arrived at this upper limit, but my table contains only 2.2 million lines of actual data. I'm trying to reuse these Row_Wids now 'not used '.
I have a job with success the query to find the first ditch and fill some of that gap. Now my next problem is to figure out how to get my request to move away from the next. I can't use the PL/SQL in the query. My client does not allow its use.
I'll paste the code I have now. I need to evolve to the next gap. Suggestions? Help? Ideas?
The Version of database: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
The table I'm inserting: CREATE GLOBAL TEMPORARY TABLE "OLAP". "" ROWWIDVAL "("ROWWID"NUMBER (10.0), NUMBER (10,0)"EXTRAVAL") ON COMMIT PRESERVE ROWS;
A note: the Temp Table to test this point, I've created is "RowWidVal" and it has two columns.
-Updated Code collaboration-
Published by: user1002601 on 16 January 2013 08:33Insert Into RowWidVal( SELECT CASE WHEN NumGen <= GapSize+2 THEN (P2.MinGapStart-1)+NG.NumGen END RowWid, 0 FROM (SELECT MIN(T4.GapStart) MinGapStart, MIN(T4.GapStop) MinGapStop, (MIN(T4.GapStop) - MIN(T4.GapStart)) GapSize FROM (SELECT T2.row_wid + 1 GapStart, (SELECT MIN(T1.row_wid) - 1 FROM w_product_d_test T1 WHERE T1.row_wid > T2.row_wid) GapStop FROM w_product_d_test T2 LEFT OUTER JOIN w_product_d_test T3 ON T2.row_wid = T3.row_wid - 1 WHERE T3.row_wid IS NULL ) T4 WHERE T4.GapStop IS NOT NULL ) P2, (SELECT LEVEL NumGen FROM dual CONNECT BY LEVEL <= (SELECT ((Min(GapStop) - Min(T4.GapStart)) +1) GapSize FROM (SELECT T2.row_wid + 1 GapStart, (SELECT MIN(T1.row_wid) - 1 FROM w_product_d_test T1 WHERE T1.row_wid > T2.row_wid) GapStop FROM w_product_d_test T2 LEFT OUTER JOIN w_product_d_test T3 ON T2.row_wid = T3.row_wid - 1 WHERE T3.row_wid IS NULL ) T4 WHERE T4.GapStop IS NOT NULL) ) NG WHERE P2.MinGapStart < P2.MinGapStart+(GapSize+2));
Published by: user1002601 on 16 January 2013 08:39How about this?
Sample data:
SQL> create table w_product_d_test (row_wid number); Table created SQL> SQL> insert into w_product_d_test (row_wid) 2 select column_value 3 from table(sys.odcinumberlist(1,2,3,4,5,11,12,13,31,32,33,34)); 12 rows inserted SQL> select * from w_product_d_test; ROW_WID ---------- 1 2 3 4 5 11 12 13 31 32 33 34 12 rows selected
Generate sequence available numbers:
SQL> with gaps as ( 2 select rw, gapsize 3 from ( 4 select row_wid as rw 5 , row_wid - lag(row_wid,1,0) over(order by row_wid) - 1 as gapsize 6 from w_product_d_test 7 ) 8 where gapsize > 0 9 ) 10 select g.rw - t.column_value as available_rw 11 from gaps g 12 , table( 13 cast( 14 multiset( select level from dual connect by level <= g.gapsize ) 15 as sys.odcinumberlist 16 ) 17 ) t 18 ; AVAILABLE_RW ------------ 10 9 8 7 6 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 22 rows selected
-
solution to watch to the stealth variable
Hello
What is the solution to variable stealthily without going to 11g?
I got the answer before as outline stored, but I don't think that this will fix it because stored outlines will stabilize the plan which we do not want, I think that the histogram is a better solution?
Thank youuser8803475,
Take the following test case, which could leave you ask if creating a histogram on a column that is used by bind variable is a good idea.
Setting up:
SHOW PARAMETER OPTIMIZER NAME TYPE VALUE ------------------------------------ ----------- -------- optimizer_dynamic_sampling integer 2 optimizer_features_enable string 10.2.0.4 optimizer_index_caching integer 0 optimizer_index_cost_adj integer 100 optimizer_mode string ALL_ROWS optimizer_secure_view_merging boolean TRUE CREATE TABLE T10 AS SELECT ROWNUM COL1, DECODE(MOD(ROWNUM,1000),1,1,2,2,3,3,DECODE(MOD(ROWNUM,25),10,10,11,11,25)) COL2, LPAD('A',255,'A') COL3 FROM (SELECT ROWNUM RN FROM DUAL CONNECT BY LEVEL<=10000) V1, (SELECT ROWNUM RN FROM DUAL CONNECT BY LEVEL<=1000) V2; CREATE INDEX IND_T10_1 ON T10(COL1); CREATE INDEX IND_T10_2 ON T10(COL2); EXEC DBMS_STATS.GATHER_TABLE_STATS(OWNNAME=>USER,TABNAME=>'T10',CASCADE=>TRUE,METHOD_OPT=>'FOR COLUMNS SIZE 254 COL2') SELECT COL2, COUNT(*) NUM, COUNT(*)/10000000*100 PERCENT FROM T10 GROUP BY COL2 ORDER BY COL2; COL2 NUM PERCENT ---- ---------- ---------- 1 10000 .1 2 10000 .1 3 10000 .1 10 400000 4 11 400000 4 25 9170000 91.7
The foregoing has created a table of 10,000,000 rank with 6 distinct values in COL2. 0.1% of the lines have a value of 1 in COL2, and 91.7% of the lines have a value of 25 in COL2. There is an index with a histogram on COL2. Obviously (or not) if we only COL2 = 1 in the WHERE clause, we would be better to use the index on the column COL2 to extract lines. Obviously (or not) if we only COL2 = 25 in the WHERE clause, we would probably want to use a full table scan to extract lines. So, what happens when bind variable peeking takes place when a histogram is present on COL2? Ignore a moment in time that came out in what follows (note that I have clear cache buffers to physical force reads for consistency - direct i/o is enabled):
VARIABLE N1 NUMBER EXEC :N1:=1 ALTER SYSTEM FLUSH SHARED_POOL; ALTER SYSTEM FLUSH BUFFER_CACHE; ALTER SYSTEM FLUSH BUFFER_CACHE; SET TIMING ON SELECT /*+ GATHER_PLAN_STATISTICS */ COL2, COUNT(COL1) C1 FROM T10 WHERE COL2= :N1 GROUP BY COL2; COL2 C1 ---------- ---------- 1 10000 Elapsed: 00:00:42.72 SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST')); ------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | A-Rows |A-Time | Buffers | Reads | ------------------------------------------------------------------------------------------------------------- | 1 | SORT GROUP BY NOSORT | | 1 | 1 | 1 |00:00:42.29 | 10022 | 10022 | | 2 | TABLE ACCESS BY INDEX ROWID| T10 | 1 | 8856 | 10000 |00:00:39.03 | 10022 | 10022 | |* 3 | INDEX RANGE SCAN | IND_T10_2 | 1 | 8856 | 10000 |00:00:00.06 | 22 | 22 | ------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("COL2"=:N1) EXEC :N1:=25 ALTER SYSTEM FLUSH BUFFER_CACHE; ALTER SYSTEM FLUSH BUFFER_CACHE; SELECT /*+ GATHER_PLAN_STATISTICS */ COL2, COUNT(COL1) C1 FROM T10 WHERE COL2= :N1 GROUP BY COL2; COL2 C1 ---------- ---------- 25 9170000 Elapsed: 00:00:32.37 SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST')); ------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | A-Rows |A-Time | Buffers | Reads | ------------------------------------------------------------------------------------------------------------- | 1 | SORT GROUP BY NOSORT | | 1 | 1 | 1 |00:00:32.35 | 402K| 402K| | 2 | TABLE ACCESS BY INDEX ROWID| T10 | 1 | 8856 | 9170K|00:00:27.57 | 402K| 402K| |* 3 | INDEX RANGE SCAN | IND_T10_2 | 1 | 8856 | 9170K|00:00:09.22 | 17879 | 17879 | ------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("COL2"=:N1) EXEC :N1:=25 ALTER SYSTEM FLUSH SHARED_POOL; ALTER SYSTEM FLUSH BUFFER_CACHE; ALTER SYSTEM FLUSH BUFFER_CACHE; SELECT /*+ GATHER_PLAN_STATISTICS */ COL2, COUNT(COL1) C1 FROM T10 WHERE COL2= :N1 GROUP BY COL2; COL2 C1 ---------- ---------- 25 9170000 Elapsed: 00:00:20.76 SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST')); ------------------------------------------------------------------------------------------------ | Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | ------------------------------------------------------------------------------------------------ | 1 | SORT GROUP BY NOSORT| | 1 | 1 | 1 |00:00:20.57 | 384K| 384K| |* 2 | TABLE ACCESS FULL | T10 | 1 | 9234K| 9170K|00:00:27.54 | 384K| 384K| ------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("COL2"=:N1) EXEC :N1:=1 ALTER SYSTEM FLUSH BUFFER_CACHE; ALTER SYSTEM FLUSH BUFFER_CACHE; SELECT /*+ GATHER_PLAN_STATISTICS */ COL2, COUNT(COL1) C1 FROM T10 WHERE COL2= :N1 GROUP BY COL2; COL2 C1 ---------- ---------- 1 10000 Elapsed: 00:00:20.20 SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'ALLSTATS LAST')); ------------------------------------------------------------------------------------------------ | Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | ------------------------------------------------------------------------------------------------ | 1 | SORT GROUP BY NOSORT| | 1 | 1 | 1 |00:00:20.19 | 384K| 384K| |* 2 | TABLE ACCESS FULL | T10 | 1 | 9234K| 10000 |00:00:28.73 | 384K| 384K| ------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("COL2"=:N1)
The foregoing shows that the first time the SQL statement is hard analyzed, a bind variable 1 to value, which causes a scan of the index systematic range without worrying if the query selects 0.1% of lines or 91.7% of the lines. OK, if we then empty the shared pool and first set the value of the variable bind to 25, a full table scan is used without worrying if we choose to 91.7% of lines or 0.1% lines. You notice that when the full table scan is used when the binding variable has been set at 25 the query finished in 20.76 seconds and when a scan of each index was used with the same bind variable value the query completed in 32.37 seconds.
OK so far, now the part that can be confusing. When a scan of each index was used for two bind variable values, Oracle counted 0.1% matching rows (10000) to 42,72 seconds, with 91.7% of the lines (9 170 000) in 32.37 seconds. You may ask why Oracle is able to return the result of the count of 91.7% of the lines by the index scan systematic range faster that it is able to count the 0.1% of the lines - I'll leave to your inquiry.
Now, looking at the above, which is better? :
To allow the binding of the variable values presented in the analysis difficult to determine the execution plan.
* Use a stored outline to lock the execution plan to always use a scan of the index systematic range.
* Use an outline stored to lock the execution plan to always use a full table scan.
* Not enough information is available.Either Google your friend in trying to answer this question.
Charles Hooper
Co-author of "Expert Oracle practices: Oracle Database Administration of the Oak Table.
IT Manager/Oracle DBA
K & M-making Machine, Inc.Published by: Charles Hooper on November 29, 2009 21:26
Initially, copied the results of tests for a different (from another server) test in depth. -
Hello
I'm looking to create the registry variable, the script console and came across this post http://en.community.dell.com/techcenter/performance-monitoring/foglight-administrators/f/4788/t/19557561.aspx to create the simple registry variable.
However, I need to add registry values to objects of topology (FxMApplicationResult to be precise). Is there a way to do this in the script. Can you please indicate.
Thank you
Vincent
To add that John has already provided.
This will allow you to query the outside object and assign the value.
She could use additional checks of types etc. but a quick way to reach of many objects to a specific value that are not part of the global default value
// Name of the Registry Variable we are going to updatedef regVarName = 'SampleRegistryVariableName' //Value we want to set on the returned objects.//This is based on the registry Variable Type (Double, Long, Integer, String, Boolean, Timestamp, Password)def newRegValue = 99 as Double // Query to return the objects we want the registry value scoped toodef topologyQuery = #!Host where name like 'host%'# // Get the Registry Service to execute the registry updatedef regSrv = server["RegistryService"] // Get the registry variable for updatedef regVar = regSrv.editRegistryVariable(regVarName) // Get all existing values for this registrydef values = regVar.getRegistryValues() // Loop through the objects returned from the queryfor( obj in topologyQuery.getTopologyObjects() ) { // create the registry value object associated to the current object in loop newTop = regVar.createTopologyObjectRegistryValue(obj.uniqueId) //set the value defined within newRegValue newTop.setDefaultValue(newRegValue) //add the topologyObjectRegistryValue to the Array of existing values values.add(newTop)} // Store the values within the Registry VariableregSrv.saveRegistryVariable(regVar)
Hope this helps your use and any other case.
-
Select the query in the sqlite database
Hello friends,
I used this application in my application... It worked fine...
Select fld_name in the limit of 0.10 tbl_placelist
But when I used the query below, he showed me error...
«Select fld_name in the limit of tbl_placelist «+ s1, 10»»
I do not have how to pass two values (i.e) a global variable and an integer in the limit
Can someone help me...
Maybe I'm missing something but you want to say something like this:
S1 int = 0;
int s2 = 10;
String q = 'select fld_name from tbl_placelist limit' + s1 + ', ' + 's2;
-
I get an error when I try to update the path in the system variables on my laptop Windows 7, how to add values beyond the limit of 1024 bytes? Is there another limit or can this solution go beyond the character limit?
Hi Ronald,.
Thanks for posting your query in Microsoft Community.
I understand from your description, that you have problems with the update the path in the system variables. I'll be happy to help you
1. what you trying to accomplish?
2. What is the exact error message that you receive?
3. are you referring to the limit of characters of the file name or the path to the file?
248 characters for the maximum path length and 260 for the maximum length of file name.
For more information, you can consult this article:
File naming, paths and namespaces
http://msdn.Microsoft.com/en-us/library/aa365247.aspx
For all windows questions do not hesitate to contact us and we will be happy to help you.
-
Enter choose value in the shell variable
Hi all
I am trying to set the value of a select query in a shell variable, but want just the value with any of the text, as shown below:
invalid_count=`sqlplus / as sysdba <<.eof. set pages 0 feed off heading off echo off verify off termout off select count(*) from dba_objects where status != 'VALID'; exit .eof.`
$ echo $invalid_count
SQL * more: Production of the version 11.2.0.4.0 on Mon Jan 25 10:16:22 2016 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: options of Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production with the partitioning, OLAP, Data Mining and Real Application Testing SQL > SQL > SQL 0 > disconnected from the database Oracle 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production with the partitioning, OLAP, Data Mining and Real Application Testing options
I tried the query with a number of set options but can't seem to get the right combination.
Any ideas please?
If sqlplus / as sysdba
will help you.
Maybe you are looking for
-
will be home to share the work of another House
w
-
Update is not recognize me as an administrator, the only account on my workstation.
After you install a router, I tried to enjoy - as advertised - the possibility to use the USB port on the router to share a printer between 2 computers. I tried to put in place so that my Windows 7 laptop and my Windows XP workstation could share th
-
HP Office Pro 8600: scan to HP Office Pro 8600
How to scan a document of several pages in a single file using the glass flat? When using the document feeder, can I scan multiple pages into a single document. When I use the flat glass, I get a file for each page. Under Advanced settings, page f
-
Load the driver - A required CD/DVD driver is missing
I'm trying to install Windows 7 on a Dell Inspiron 1100 laptop, and at the time of installation, I get the following message: A required CD/DVD device driver is missing. I f you have a driver disk, CD/DVD or player of the USN, please insert it now. I
-
When you try to print in color with my HP 5180 photosmart printer, I get the error message to replace the Cyan cartridge. I replaced all ink cartridges and still can not the printer to print in color! I've never had a problem like this in the past,