Parameter of DBMS_STATS. Procedure GATEHER_SCHEMA_STATS
HelloI use the Oracle 10.2.0.3 database. When I do a describe on DBMS_STATS statement then I get below output.
PROCEDURE GATHER_SCHEMA_STATS
The argument name
----------------
OWNNAME
ESTIMATE_PERCENT
BLOCK_SAMPLE
METHOD_OPT
DEGREE
GRANULARITY
CASCADE
STATTAB
STATID
Options
STATOWN
NO_INVALIDATE
GATHER_TEMP
GATHER_FIXED
STATTYPE
FORCE
For both parameters GATHER_TEMP and GATHER_FIXED, I couldn't find explanation in the documentation.
Any idea what these setting are made?
Thanks in advance,
Best regards
oratest
You can find GATHER_TEMP in Oracle 9 documentation http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_stats2.htm#1001434 which says:
>
gather_temp
Collects statistics on global temporary tables. The temporary table must be created with the clause "on commit preserve rows. The statistics are based on data in the session where this procedure is performed, but shared in all sessions.
>
And it is likely that GATHER_FIXED means collect statistics on fixed objects (aka dynamism views http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_1001.htm#sthref2417).
It is not the first time that the missing documents for certain parameters in package DBMS_STATS is reported:
Missing parameter of STATTYPE in DMBS_STATS. GATHER_TABLE_STATS
Edited by: P. Forstmann Nov. 29. 2010 19:50
Tags: Database
Similar Questions
-
Pass a parameter to a procedure of inserting the order...?
Hi all
I have a requirement where I need to pass the input parameter of the procedure for the insert inside the procedure command...
My procedure continues like that...
PROCEDURE pmproc_1)
A IN VARCHAR2,
B IN VARCHAR2,
C IN VARCHAR2
)
AS
BEGIN
INSERT INTO my_table
(number , activity, fact )
SELECT the number , activity, fact
Of abcd_actv_tbl
Activity WHERE =
AND > = B
AND number = C;
COMMIT;
NULL;
END pmproc_1;
My requirement is that I need to pass the input parameter C to a column in my table which is my_table
so that it becomes...
INSERT INTO my_table (number , activity, , (HERE I NEED to GET THE VALUE of 'C' ) )
SELECT the number , activity, fact
Of abcd_actv_tbl
Activity WHERE =
AND > = B
AND number = C;
Please let me know if I'm unclear...
Thanks in advance...
DEV
Based on what you have provided, I would say that something as simple as:
INSERT INTO my_table (number activity ,c_column )
SELECT the number is, c
Of abcd_actv_tbl
Activity WHERE =
AND > = B
AND number = C;
-
How to assign values to the nested table and passes as a parameter for the procedure?
How to assign values to the nested table and passes as a parameter for the procedure?
Here are the object and its type
create or replace type test_object1 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type1 is table of the test_object1;
create or replace type test_object2 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type2 is table of the test_object2;
GRANT ALL ON test_object1 to PUBLIC;
GRANT ALL ON test_type1 to PUBLIC;
GRANT ALL ON test_object2 to PUBLIC;
GRANT ALL ON test_type2 to PUBLIC;
Here is the table object type:
create the table test_object_tpe
(
sl_num NUMBER,
Description VARCHAR2 (100),
main_val1 test_type1,
main_val2 test_type2
)
NESTED TABLE main_val1 STORE AS tot1
NESTED TABLE main_val2 STORE AS earlier2;
-----------------------------------------------------------------------------------------------------------
Here is the procedure that inserts values into the nested table:
PROCEDURE INSERT_TEST_DATA (sl_num in NUMBER,
Description in VARCHAR2,
p_main_val1 IN test_type1,
p_main_val2 IN test_type2
)
IS
BEGIN
FOR rec in p_main_val1.first... p_main_val1. Last
LOOP
INSERT INTO xxdl.test_object_tpe
(
sl_num,
Description,
main_val1,
main_val2
)
VALUES
(
sl_num
description
test_type1 (test_object1)
p_main_val1 .val1 (CRE),
p_main_val1 .val2 (CRE),
p_main_val1 .val3 (rec)
)
)
test_type2 (test_object2 (p_main_val2 .val1 (CRE),
p_main_val2 .val2 (CRE),
p_main_val2 .val3 (rec)
)
)
);
END LOOP;
commit;
END INSERT_TEST_DATA;
-------------------------------------------------------------------------------------------
Here are the block anonymoys what values attributed to the object type and pass values in the procedure:
Set serveroutput on;
declare
p_sl_num NUMBER: = 1001;
p_description VARCHAR2 (50): = 'Test Val1;
inval1 test_type1: = test_type1();
inval2 test_type2: = test_type2();
Start
inval1 (1) .val1: = "testx1";
inval1 (1) .val2: = "testx2";
inval1 (1) .val3: = "testx3";
inval2 (1) .val1: = "testy1";
inval2 (1) .val2: = "testy2";
inval2 (1) .val3: = "testy3";
CSI_PKG. INSERT_TEST_DATA (sl_num = > p_sl_num,)
Description = > p_description,
p_main_val1 = > inval1,
p_main_val2 = > inval2
);
end;
/
Someone can correct me.
Thank you
LavanThanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
>
How to assign values to the nested table and passes as a parameter for the procedure?
>
Well you do almost everything bad that could be hurt.Here is the code that works to insert data into your table (the procedure is not even necessary).
declare p_sl_num NUMBER := 1001; p_description VARCHAR2(50) := 'Testing Val1'; inval1 test_type1 := test_type1(); inval2 test_type2 := test_type2(); begin inval1.extend(); inval1(1) := test_object1('testx1', 'testx2', 'testx3'); inval2.extend(); inval2(1) := test_object2('testy1', 'testy2', 'testy3'); INSERT INTO test_object_tpe ( sl_num, description, main_val1, main_val2 ) VALUES (p_sl_num, p_description, inval1, inval2); commit; end; /
See example 5-15 making reference to an element of nested Table Chapter 5 using PL/SQL collections and records in the PL/SQL doc
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#CJABEBEA1. you don't even have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)
inval1(1).val1 := 'testx1';
Since you have not yet created all the elements, there is no element 1 "inval1". You need EXTEND the collection to add an element
inval1.extend();
And then, there is an empty element, but "inval1" is a container for objects of type 'test_object1' not for scalars as "val1", "val2", and "val3".
If you can not doinval1(1).val1 := 'testx1';
You must create an instance of 'test_object1 '.
inval1(1) := test_object1('testx1', 'testx2', 'testx3');
And so on for the other collection
You don't need the procedure (as my code example shows), but once you fill in the variables correctly it will work.
-
procedure call with sys_refcursor as a parameter in the procedure
Hello
I tried the following procedure after sys_refcursor as parameter of a procedure,
And confused about the procedure call
How can I call the above procedure to get the dataCREATE OR REPLACE PROCEDURE test_ref (emp_cur IN sys_refcursor) IS emp_rec Z_emp%ROWTYPE; BEGIN LOOP FETCH emp_cur INTO emp_rec; EXIT WHEN emp_cur%NOTFOUND; dbms_output.put_line(emp_rec.ename ||' is a ' || emp_rec.job); END LOOP; END;
Thank youYou must declare a variable sys_refcursor and open it with the necessary query and then pass that variable as a parameter to your procedure.
Something like that.
set serveroutput on declare my_cursor sys_refcursor; begin open my_cursor for select * from employee; test_ref (my_cursor); end; /
-
How the parameter of the procedure with the default table type?
Hello!
How the parameter of the procedure with the default table type?
For example:type varchar2lType is table of varchar2(50) index by binary_integer;
Published by: bullbil on 16.01.2012 06:35create or replace procedure test1 ( s1 varchar2(50) sa2 Varchar2Type ) as begin dbms_output.put_line('yyxxyyy!'); end; /
If he should really be an associative array for some reason any (can't think why, but just for fun...) you could declare a dummy array in the packet header and specify as the default:
create or replace package wr_test as type varchar2ltype is table of varchar2(50) index by pls_integer; g_dflt_varchar2l_tab varchar2ltype; procedure testit ( p_testarray varchar2ltype default g_dflt_varchar2l_tab ); end wr_test; create or replace package body wr_test as procedure testit ( p_testarray varchar2ltype default g_dflt_varchar2l_tab ) is begin dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements'); end testit; end wr_test;
It is a bit of a hack, because it relies on a global variable that is exposed. A more orderly approach would overload the procedure so that a version does not have the table and another argument:
create or replace package wr_test as type varchar2ltype is table of varchar2(50) index by pls_integer; procedure testit; procedure testit ( p_testarray varchar2ltype ); end wr_test; create or replace package body wr_test as procedure testit is v_default_array varchar2ltype; begin testit(v_default_array); end testit; procedure testit ( p_testarray varchar2ltype ) is begin dbms_output.put_line('p_testarray contains ' || p_testarray.count || ' elements'); end testit; end wr_test;
-
the size of the out parameter in the procedure
Hi all:
I have a procedure in a pl/sql package like this:
create or replace procedure MyProc (PRM_STR in VHARCHAR2, PRM_OUTSTR OUT VARCHAR2) is
V_TEST VARCHAR2 (100)
Start
+...+
V_STR: = SUBSTR (PRM_STR, 22, 31);
V_TEST: = TRIM (V_STR);
PRM_OUTSTR: = V_TEST;
EXCEPTION
WHILE OTHERS THEN
+....+
myproc end;
When I run it, it always gives me an exception: ORA-06502: PL/SQL: digital or value error: character string buffer too small.
Then I debug him:
V_TEST: = TRIM (V_STR)
is OK.
While PRM_OUTSTR: = V_TEST, it throws this exception.
I was confused, the out parameter in the procedure has a size? How can I set it?
Please help me!
Thank you very much!You must declare the size of the variable you use in the call to the procedure to be big enough.
The output parameter itself may not be declared with a size:
for example
Your appeal should be something like the following:
declare v_prmstr varchar2(4000) := 'Your input value'; v_prmoutstr varchar2(4000); begin myproc(v_prmstr,v_prmoutstr) ; end;
v_prmoutstr must be reported to be large enough to contain the value returned by the parameter
PRM_OUTSTRadded example variable
Published by: Keith Jamieson on August 11, 2011 13:32 -
Timestamp in passing as a parameter in a procedure
Hi all
I want to pass the timestamp as a parameter to a procedure... When I try to run it and to give time as parameters, it is throwing error date format picture ends before converting the entire input string... I'm not able to spend sysdate and systimestamp.
Start
Package.PROC_1 (sysdate, sysdate);
end;
for example:
create or replace proc_1 (T_DATE timestamp, v_date2 timestamp) as
Start
Select * from emp where to_date(emp_date,'dd-mon-yyyy') between to_date(v_date,'dd-mon-yyyy') and to_Date (v_date2, 'dd-mon-yyyy');
end proc_1;
Here emp_date is timestamp.Hello
You don't need to convert it to to_date as all data you transmit and comparing the column are of the same type (timestamp). So you can just put your condition
emp_date between T_DATE and v_date2see you soon
VT
-
What is INSIDE and OUTSIDE in parameter of the procedure?
Hello
often IN, OUT and IN OUT are used with the parameter in the procedures and functions.
This means pass by value, by reference, we did in programming c / c++?When you create a procedure or function, you can set parameters. There are three types of parameters that may be declared:
1. - the parameter can be referenced by the procedure or function. The value of the parameter can not be overwritten by the procedure or function.
2 - the parameter may not be referenced by the procedure or function, but the value of the parameter can be replaced by the procedure or function.
3 AL '-the parameter can be referenced by the procedure or function and the value of the parameter can be replaced by the procedure or function. -
In passing the huge parameter to oracle procedure have a performance hit?
I have a script attached, in which I am trying process/XML parsing in a table (STAGE_TBL) in the XMLTYPE column and insert the data analyzed in another table (PROCESSED_DATA_TBL). The XML file can be huge up to 2MB, which translates into approximately 2000 + lines of analyzed data. The issue I see is when I pass an XML object to a procedure (STAGE_TBL_PROCESS) to analyze its takes about 10 seconds per XML, but rather than from XML if I directly pick up table in the procedure (STAGE_TBL_PROCESS) passing the ID to be about 0.15 seconds. According to the document while params are passed by reference, so why is this variation of performance?
Details of database Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64-bit version of PL/SQL Production 11.2.0.3.0 - Production "CORE 11.2.0.3.0 Production" TNS for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production
Note: I could not perform SQL_TRACE or DBMS_STATS as I don't have access to them.
/*
This one is taking .15 seconds to process an XML with about 2000 rp_sendRow elements
*/
DECLARE
CURSOR NewStage IS
SELECT *
FROM STAGE_TBL
WHERE status = 'N'
ORDER BY PUT_TIME ASC;
SUBTYPE rt_NewStage IS NewStage % rowtype;
ROW_COUNT INTEGER := 0; -- Return value from calling the procedure
READ_COUNT INTEGER := 0; -- Number of rows read from the stage table
INSERT_COUNT_TOTAL INTEGER := 0; -- Number of Inserts Inven records
ERROR_COUNT INTEGER := 0; -- Number of Inven inserts that did inserted more then 1 row in Inven
PROCESS_STATUS STATUS.MmsStatus;
STATUS_DESCRIPTION STATUS.MmsStatusReason;
ERRMSG VARCHAR2(500);
PROCEDURE STAGE_TBL_PROCESS (IDDATA IN RAW, PROCESS_STATUS OUT VARCHAR2, STATUS_DESCRIPTION OUT VARCHAR2, ROW_COUNT OUT NUMBER) AS
/*
This procedure is to parse the XML from STAGE_TBL and populate the data from XML to PROCESSED_DATA_TBL table
IN PARAMS
----------
IDDATA - ID from STAGE_TBL
xData - XMLType field from XML_DOCUMENT of STAGE_TBL
OUT PARAMS
-----------
PROCESS_STATUS - The STATUS of parsing and populating PROCESSED_DATA_TBL
STATUS_DESCRIPTION - The description of the STATUS of parsing and populating PROCESSED_DATA_TBL
ROW_COUNT - Number of rows inserted into PROCESSED_DATA_TBL
*/
BEGIN
INSERT ALL INTO PROCESSED_DATA_TBL
(PD_ID,
STORE,
SALES_NBR,
UNIT_COST,
ST_FLAG,
ST_DATE,
ST,
START_QTY,
START_VALUE,
START_ON_ORDER,
HAND,
ORDERED,
COMMITED,
SALES,
RECEIVE,
VALUED,
ID_1,
ID_2,
ID_3,
UNIT_PRICE,
EFFECTIVE_DATE,
STATUS,
STATUS_DATE,
STATUS_REASON)
VALUES (IDDATA
,store
,SalesNo
,UnitCost
,StWac
,StDt
,St
,StartQty
,StartValue
,StartOnOrder
,Hand
,Ordered
,COMMITED
,Sales
,Rec
,Valued
,Id1
,Id2
,Id3
,UnitPrice
,to_Date(EffectiveDate||' '||EffectiveTime, 'YYYY-MM-DD HH24:MI:SS')
,'N'
,SYSDATE
,'XML PROCESS INSERT')
WITH T AS
( SELECT STG.XML_DOCUMENT FROM STAGE_TBL STG WHERE STG.ID = IDDATA)
-- This is to parse and fetch the data from XML
SELECT E.* FROM T, XMLTABLE('rp_send/rp_sendRow' PASSING T.XML_DOCUMENT COLUMNS
store VARCHAR(20) PATH 'store'
,SalesNo VARCHAR(20) PATH 'sales'
,UnitCost NUMBER PATH 'cost'
,StWac VARCHAR(20) PATH 'flag'
,StDt DATE PATH 'st-dt'
,St NUMBER PATH 'st'
,StartQty NUMBER PATH 'qty'
,StartValue NUMBER PATH 'value'
,StartOnOrder NUMBER PATH 'start-on-order'
,Hand NUMBER PATH 'hand'
,Ordered NUMBER PATH 'order'
,Commited NUMBER PATH 'commit'
,Sales NUMBER PATH 'sales'
,Rec NUMBER PATH 'rec'
,Valued NUMBER PATH 'val'
,Id1 VARCHAR(30) PATH 'id-1'
,Id2 VARCHAR(30) PATH 'id-2'
,Id3 VARCHAR(30) PATH 'id-3'
,UnitPrice NUMBER PATH 'unit-pr'
,EffectiveDate VARCHAR(30) PATH 'eff-dt'
,EffectiveTime VARCHAR(30) PATH 'eff-tm'
) E;
ROW_COUNT := SQL%ROWCOUNT; -- Not the # of all the rows inserted.
PROCESS_STATUS := STATUS.PROCESSED;
IF ROW_COUNT < 1 THEN -- The insert failed Row Count = 0 No exception thrown
PROCESS_STATUS := STATUS.ERROR;
STATUS_DESCRIPTION := 'ERROR Did not insert into Pos Inventory. Reason Unknown';
END IF;
EXCEPTION
WHEN OTHERS THEN
ROW_COUNT := 0;
PROCESS_STATUS := STATUS.ERROR;
STATUS_DESCRIPTION := 'SqlCode:' || SQLCODE || ' SqlErrMsg:' || SQLERRM;
END;
BEGIN
DBMS_OUTPUT.enable(NULL);
FOR A_NewStage IN NewStage
LOOP
READ_COUNT := READ_COUNT + 1;
STAGE_TBL_PROCESS(A_NewStage.ID, PROCESS_STATUS, STATUS_DESCRIPTION, ROW_COUNT);
INSERT_COUNT_TOTAL := INSERT_COUNT_TOTAL + ROW_COUNT;
IF(ROW_COUNT <= 0 OR PROCESS_STATUS = STATUS.ERROR) THEN
ERROR_COUNT := ERROR_COUNT + 1;
UPDATE STAGE_TBL
SET status = PROCESS_STATUS,
status_DATE = SYSDATE,
status_DESCRIPTION = STATUS_DESCRIPTION
WHERE ID = A_NewStage.ID;
ELSE
UPDATE STAGE_TBL
SET status = PROCESS_STATUS,
status_DATE = SYSDATE,
status_DESCRIPTION = STATUS_DESCRIPTION,
SHRED_DT = SYSDATE
WHERE ID = A_NewStage.ID;
END IF;
COMMIT;
END LOOP;
COMMIT;
IF ERROR_COUNT > 0 THEN
ERRMSG := '** ERROR: ' || ERROR_COUNT || ' Stage records did not insert in to the Processed table correctly';
RAISE_APPLICATION_ERROR(-20001,ErrMsg);
END IF;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END ;
/*
This one is taking 10 seconds to process an XML with about 2000 rp_sendRow elements
*/
DECLARE
CURSOR NewStage IS
SELECT *
FROM STAGE_TBL
WHERE status = 'N'
ORDER BY PUT_TIME ASC;
SUBTYPE rt_NewStage IS NewStage % rowtype;
ROW_COUNT INTEGER := 0; -- Return value from calling the procedure
READ_COUNT INTEGER := 0; -- Number of rows read from the stage table
INSERT_COUNT_TOTAL INTEGER := 0; -- Number of Inserts Inven records
ERROR_COUNT INTEGER := 0; -- Number of Inven inserts that did inserted more then 1 row in Inven
PROCESS_STATUS STATUS.MmsStatus;
STATUS_DESCRIPTION STATUS.MmsStatusReason;
ERRMSG VARCHAR2(500);
PROCEDURE STAGE_TBL_PROCESS (IDDATA IN RAW, xData IN STAGE_TBL.XML_DOCUMENT%TYPE, PROCESS_STATUS OUT VARCHAR2, STATUS_DESCRIPTION OUT VARCHAR2, ROW_COUNT OUT NUMBER) AS
/*
This procedure is to parse the XML from STAGE_TBL and populate the data from XML to PROCESSED_DATA_TBL table
IN PARAMS
----------
IDDATA - ID from STAGE_TBL
xData - XMLType field from XML_DOCUMENT of STAGE_TBL
OUT PARAMS
-----------
PROCESS_STATUS - The STATUS of parsing and populating PROCESSED_DATA_TBL
STATUS_DESCRIPTION - The description of the STATUS of parsing and populating PROCESSED_DATA_TBL
ROW_COUNT - Number of rows inserted into PROCESSED_DATA_TBL
*/
BEGIN
INSERT ALL INTO PROCESSED_DATA_TBL
(PD_ID,
STORE,
SALES_NBR,
UNIT_COST,
ST_FLAG,
ST_DATE,
ST,
START_QTY,
START_VALUE,
START_ON_ORDER,
HAND,
ORDERED,
COMMITED,
SALES,
RECEIVE,
VALUED,
ID_1,
ID_2,
ID_3,
UNIT_PRICE,
EFFECTIVE_DATE,
STATUS,
STATUS_DATE,
STATUS_REASON)
VALUES (IDDATA
,store
,SalesNo
,UnitCost
,StWac
,StDt
,St
,StartQty
,StartValue
,StartOnOrder
,Hand
,Ordered
,COMMITED
,Sales
,Rec
,Valued
,Id1
,Id2
,Id3
,UnitPrice
,to_Date(EffectiveDate||' '||EffectiveTime, 'YYYY-MM-DD HH24:MI:SS')
,'N'
,SYSDATE
,'XML PROCESS INSERT')
-- This is to parse and fetch the data from XML
SELECT E.* FROM XMLTABLE('rp_send/rp_sendRow' PASSING xDATA COLUMNS
store VARCHAR(20) PATH 'store'
,SalesNo VARCHAR(20) PATH 'sales'
,UnitCost NUMBER PATH 'cost'
,StWac VARCHAR(20) PATH 'flag'
,StDt DATE PATH 'st-dt'
,St NUMBER PATH 'st'
,StartQty NUMBER PATH 'qty'
,StartValue NUMBER PATH 'value'
,StartOnOrder NUMBER PATH 'start-on-order'
,Hand NUMBER PATH 'hand'
,Ordered NUMBER PATH 'order'
,Commited NUMBER PATH 'commit'
,Sales NUMBER PATH 'sales'
,Rec NUMBER PATH 'rec'
,Valued NUMBER PATH 'val'
,Id1 VARCHAR(30) PATH 'id-1'
,Id2 VARCHAR(30) PATH 'id-2'
,Id3 VARCHAR(30) PATH 'id-3'
,UnitPrice NUMBER PATH 'unit-pr'
,EffectiveDate VARCHAR(30) PATH 'eff-dt'
,EffectiveTime VARCHAR(30) PATH 'eff-tm'
) E;
ROW_COUNT := SQL%ROWCOUNT; -- Not the # of all the rows inserted.
PROCESS_STATUS := STATUS.PROCESSED;
IF ROW_COUNT < 1 THEN -- The insert failed Row Count = 0 No exception thrown
PROCESS_STATUS := STATUS.ERROR;
STATUS_DESCRIPTION := 'ERROR Did not insert into Pos Inventory. Reason Unknown';
END IF;
EXCEPTION
WHEN OTHERS THEN
ROW_COUNT := 0;
PROCESS_STATUS := STATUS.ERROR;
STATUS_DESCRIPTION := 'SqlCode:' || SQLCODE || ' SqlErrMsg:' || SQLERRM;
END;
BEGIN
DBMS_OUTPUT.enable(NULL);
FOR A_NewStage IN NewStage
LOOP
READ_COUNT := READ_COUNT + 1;
STAGE_TBL_PROCESS(A_NewStage.ID, A_NewStage.XML_DOCUMENT, PROCESS_STATUS, STATUS_DESCRIPTION, ROW_COUNT);
INSERT_COUNT_TOTAL := INSERT_COUNT_TOTAL + ROW_COUNT;
IF(ROW_COUNT <= 0 OR PROCESS_STATUS = STATUS.ERROR) THEN
ERROR_COUNT := ERROR_COUNT + 1;
UPDATE STAGE_TBL
SET status = PROCESS_STATUS,
status_DATE = SYSDATE,
status_DESCRIPTION = STATUS_DESCRIPTION
WHERE ID = A_NewStage.ID;
ELSE
UPDATE STAGE_TBL
SET status = PROCESS_STATUS,
status_DATE = SYSDATE,
status_DESCRIPTION = STATUS_DESCRIPTION,
SHRED_DT = SYSDATE
WHERE ID = A_NewStage.ID;
END IF;
COMMIT;
END LOOP;
COMMIT;
IF ERROR_COUNT > 0 THEN
ERRMSG := '** ERROR: ' || ERROR_COUNT || ' Stage records did not insert in to the Processed table correctly';
RAISE_APPLICATION_ERROR(-20001,ErrMsg);
END IF;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END ;
My XML with just one rp_sendRow element, it can go upto 2000 rp_sendRow elements
<?xml version = \"1.0\" encoding = \"UTF-8\"?>
<rp_send xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<rp_sendRow>
<store>0123</store>
<sales>022399190</sales>
<cost>0.01</cost>
<flag>true</flag>
<st-dt>2013-04-19</st-dt>
<st>146.51</st>
<qty>13.0</qty>
<value>0.0</value>
<start-on-order>0.0</start-on-order>
<hand>0.0</hand>
<order>0.0</order>
<commit>0.0</commit>
<sales>0.0</sales>
<rec>0.0</rec>
<val>0.0</val>
<id-1/>
<id-2/>
<id-3/>
<unit-pr>13.0</unit-pr>
<eff-dt>2015-06-16</eff-dt>
<eff-tm>09:12:21</eff-tm>
</rp_sendRow>
</rp_send>The issue I see is when I pass an XML object to a procedure (STAGE_TBL_PROCESS) to analyze its takes about 10 seconds per XML, but rather than from XML if I directly pick up table in the procedure (STAGE_TBL_PROCESS) passing the ID to be about 0.15 seconds.
In version 11.1, Oracle introduced a new model of storage for the data type XMLType called XML binary.
Binary XML become the default in 11.2.0.2, to disparage the old storage based on CLOB.
Binary XML is a format optimized after analysis for the storage and treatment of the XQuery.
When an XQuery expression is evaluated (through for example XMLTABLE) on an XMLType column stored as binary XML, Oracle can use an ongoing evaluation of XPath that surpasses the query even crushed a transitional XMLType of several order of magnitude.
You can see that in the action plan of the explain command:
SQL> SELECT E.* 2 FROM stage_tbl t 3 , XMLTABLE('rp_send/rp_sendRow' PASSING t.xml_document 4 COLUMNS store VARCHAR(20) PATH 'store' 5 , SalesNo VARCHAR(20) PATH 'sales' 6 , UnitCost NUMBER PATH 'cost' 7 ) E ; Execution Plan ---------------------------------------------------------- Plan hash value: 1134903869 -------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 2008 | 32 (0)| 00:00:01 | | 1 | NESTED LOOPS | | 1 | 2008 | 32 (0)| 00:00:01 | | 2 | TABLE ACCESS FULL| STAGE_TBL | 1 | 2002 | 3 (0)| 00:00:01 | | 3 | XPATH EVALUATION | | | | | | --------------------------------------------------------------------------------
When the query is executed on a passenger XMLType (for example, a parameter, or a PL/SQL variable), Oracle cannot run the binary model and use a functional assessment based on memory of the XML DOM-like representation.
You can see that in the plan to explain it by spoting a 'COLLECTION ITERATOR PICKLER FETCH' operation.
So what explains the difference (in your version) between treatment from a column of XMLType (stored in binary XML format) or a variable or a parameter.
From 11.2.0.4 and beyond, things have changed a bit with Oracle, introducing a new transitional level of optimization on XMLType.
The plan of the explain command will show a "XMLTABLE ASSESSMENT' in this case.
-
issues related to the parameter in the procedure
Hi all
I have a procedure which the code is given below:
create or replace PROCEDURE seods01.get_cert_tx_lot_tmp (acct_alt_id_in in VARCHAR2
, acct_alt_id_cntx_cde_in IN VARCHAR2 default 'COLA account number.
, ibd_id_in IN INTEGER
qry_rslt_out to sys_refcursor)
IS
BEGIN
OPEN FOR Qry_rslt_out
SELECT L.tx_lot_seq_nbr
L.hld_prd_dte
L.orig_purc_dte
L.tx_lot_amt
L.updt_tx_lot_amt
L.tran_desc_txt
OF v_acct_alt_id A
v_cd_tx_lot L
WHERE A.acct_alt_id = acct_alt_id_in
AND A.acct_alt_id_cntx_cde = acct_alt_id_cntx_cde_in
AND A.ibd_id = ibd_id_in
AND L.eods_acct_id = A.eods_acct_id;
EXCEPTION
WHILE OTHERS THEN
dbms_output.put_line(SQLCODE||) SQLERRM);
END get_cert_tx_lot_tmp;
now when I run the SP in the following way it works fine:
VAR C1 REFCURSOR EXECUTE SEODS01.get_cert_tx_lot_tmp ('004000000000000093108026740', 'Number of COLA account', '1',: C1); PRINT C1
When I try to ignore this value by default setting, then it is throwing ' wrong number or types of arguments "error
VAR C1 REFCURSOR EXECUTE SEODS01.get_cert_tx_lot_tmp ('004000000000000093108026740 ', ' 1',: C1); PRINT C1
and when I tried to put this as null or "then it gives me no results. only way through which I can produce results of this procedure without giving the default parameter is the name of the column with the value of the parameter as follows:
VAR C1 REFCURSOR RUN SEODS01.get_cert_tx_lot_tmp (acct_alt_id_in = > '004000000000000093108026740', ibd_id_in = > '1', qry_rslt_out = >: C1); PRINT C1
but the condition is that we do not want our consumers to put names of columns when they do not pass the default value setting, I hope that there should be a way to do it. Could someone help me please on this issue.
Hello
If you want to use positional notation, then you can only omit parameters by default when they are at the end of the parameter list. In your case, this would mean
(acct_alt_id_in in VARCHAR2
ibd_id_in in FULL
qry_rslt_out ON sys_refcursor
acct_alt_id_cntx_cde_in IN VARCHAR2 default 'COLA account number')
Or you can put the procedure in a package and overload
PROCEDURE seods01.get_cert_tx_lot_tmp
(acct_alt_id_in in VARCHAR2
acct_alt_id_cntx_cde_in IN VARCHAR2
ibd_id_in in FULL
qry_rslt_out to sys_refcursor)
PROCEDURE seods01.get_cert_tx_lot_tmp
(acct_alt_id_in in VARCHAR2
ibd_id_in in FULL
qry_rslt_out to sys_refcursor)
In the procedure without the acct_alt_id_cntx_cde_in parameter, you can call the other version and provide the default value.
Concerning
Marcus
-
How to pass a parameter in this procedure?
Hi all
I'm using oracle 11g.
I have it here is the procedure.
I need same procedure that accepts the name of_/ user Id of the useras a parameter and updates the infocenter reorganization for the particular user.
create or replace
PROCEDURE MS_SRA_UPDATE_USER_INFO_ORDER (p_user_id number,
o_error_code ON the NUMBER,
o_error_message OUT VARCHAR2)
as
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
update of outdoor play of SI_USER_INFOCENTER_T (default_infocenter_flag, display_order) =)
Select case when Claude = 1 then 'Y' else ' end flag n, Claude of
(
Select user_id, infocenter_name, default_infocenter_flag,
ROW_NUMBER() over (partition by user_id stopped by)
CASE INFOCENTER_NAME
When 'A' then 1
WHEN 'B' THEN 2
WHEN 'C' THEN 3
WHEN ' THEN 4
WHEN 'E' THEN 5
When "F" then 6
When 'G' THEN 7
Of OTHER display_order
Gladys END)
OF SI_USER_INFOCENTER_T
) internal
WHERE INNER. USER_ID = EXTERNAL. USER_ID AND INNER.INFOCENTER_NAME = OUTER.INFOCENTER_NAME
)
WHEN USER_ID NOT IN (SELECT
user_id
OF MS_SRA_USER_ORG_ROLE_ACT_V
WHERE
ORG_ENTITY_ID =
(SELECT ORG_ENTITY_ID FROM SI_ORG_ENTITIES_T WHERE ORG_ENTITY_NAME = 'F'
));
O_ERROR_CODE: = 0;
O_ERROR_MESSAGE: = NULL;
COMMIT;
EXCEPTION
WHILE OTHERS THEN
O_ERROR_CODE: = SQLCODE;
O_Error_Message: = Sqlerrm;
END MS_SRA_UPDATE_USER_INFO_ORDER;
I need same procedure that accepts the user Id/username as a parameter and updates the infocenter reorganization for the particular user.
Thank you
Dale
Hello...
I do not understand your question... Something like that
CREATE OR REPLACE
PROCEDURE MS_SRA_UPDATE_USER_INFO_ORDER (p_user_id, NUMBER of)
o_error_code ON the NUMBER,
o_error_message OUT VARCHAR2)
AS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
UPDATE SI_USER_INFOCENTER_T outer_qry
SET (default_infocenter_flag, display_order) =
(SELECT CASE WHEN epimachos = 1 THEN 'Y')
ANOTHER "N".
Flag of END,
Claude (SELECT user_id,
infocenter_name,
-default_infocenter_flag,
ROW_NUMBER() over (PARTITION BY user_id ORDER BY
CASE INFOCENTER_NAME
WHEN 'A' THEN 1
WHEN 'B' THEN 2
WHEN 'C' THEN 3
WHEN ' THEN 4
WHEN 'E' THEN 5
WHEN "F" THEN 6
WHEN 'G' THEN 7
Of OTHER display_order
Gladys END)
OF SI_USER_INFOCENTER_T
WHEN USER_ID = p_user_id) inner_qry
WHERE inner_qry. User_id = outer_qry. USER_ID
AND inner_qry.INFOCENTER_NAME = outer_qry.INFOCENTER_NAME
)
WHERE USER_ID = p_user_id
AND NOT EXISTS (SELECT 1
MSU MS_SRA_USER_ORG_ROLE_ACT_V
WHERE ORG_ENTITY_ID = (SELECT ORG_ENTITY_ID FROM SI_ORG_ENTITIES_T WHERE ORG_ENTITY_NAME = 'F')
AND msu.user_id = outer_qry. USER_ID
AND msu.user_id = p_user_id);
O_ERROR_CODE: = 0;
O_ERROR_MESSAGE: = NULL;
COMMIT;
EXCEPTION
WHILE OTHERS THEN
O_ERROR_CODE: = SQLCODE;
O_Error_Message: = SQLERRM;
END MS_SRA_UPDATE_USER_INFO_ORDER;
-
Several values of parameter of a procedure
Hi all
Here, I need to create a procedure and this procedure has a parameter for this setting, I need to pass multiple values separated by a ',' (comma)
Any help... Thanks in advanceHello
Welcome to the forum!
See
http://www.Oracle-base.com/articles/Misc/DynamicInLists.php
http://tkyte.blogspot.com/2006/06/varying-in-lists.html -
Problem in Varray as a parameter to the procedure
Hi all
I've created a type AS
I am passing table as a parameter for the oracle java before procedure. How to spend together in SQL when the condition is it possible to archive?CREATE OR REPLACE TYPE v_tmp_array IS VARRAY(100) OF NUMBER;
Thanks and greetingsCREATE OR REPLACE PROCEDURE Proc_Varry_Para(p_array IN v_tmp_array, v_tmp OUT REF CURSOR) AS BEGIN BMS_OUTPUT.PUT_LINE( 'begin' ); SELECT * FROM ADDRESS WHERE ADDR_ID = p_array; --- need to pass whole array value in where condition. OPEN v_tmp FOR v_sql_text; END; /
SaamiSELECT * FROM ADDRESS, TABLE (p_array) t WHERE ADDR_ID = t.COLUMN_VALUE;
-
SQL SELECT statement as a parameter in the procedure of string
Hi all
I'm new to PL/SQL and I must get a procedure as parameter select SQL select statement as a VARCHAR and the production output the result of the statement with a few changes. Can someone help me solve this problem?
A possibility I thought at was to use a REF CURSOR. The following example works but binds me to a specific table (in the example of the "customers" table). However, I need the ability to specify arbitrary tables in the select statement parameter.
My idea was to modify this example to work in the following code, but it does not work (I get a compile error):SET SERVEROUTPUT ON DECLARE TYPE my_cur IS REF CURSOR; query_cursor my_cur; BEGIN OPEN query_cursor FOR 'SELECT * FROM customers'; DECLARE record_type customers%ROWTYPE; BEGIN LOOP FETCH query_cursor INTO record_type; EXIT WHEN query_cursor%NOTFOUND; DBMS_OUTPUT.PUT_LINE('some output ... '); END LOOP; END; CLOSE query_cursor; END; /
Does anyone has an idea how can I solve my problem?SET SERVEROUTPUT ON DECLARE TYPE my_cur IS REF CURSOR; query_cursor my_cur; BEGIN OPEN query_cursor FOR 'SELECT * FROM customers'; DECLARE record_type query_cursor%ROWTYPE; BEGIN LOOP FETCH query_cursor INTO record_type; EXIT WHEN query_cursor%NOTFOUND; DBMS_OUTPUT.PUT_LINE('some output ... '); END LOOP; END; CLOSE query_cursor; END; /
Thank you very much!
(I'm using Oracle 11 g)This can help.
Re: Dynamic Extraction on dynamic Sql -
Can we do non-mandatory parameter of stored procedure?
Can we make a parameter in the stored procedure as a non-mandatory? so that we can call the stored procedure with parameters?Assign a default value, for example
p_someparameter IN INTEGER DEFAULT 0
or
p_someparameter IN INTEGER := 0
Maybe you are looking for
-
9/menu/bookmarks Firefox bar: bookmarks lost their icons
iMac. Firefox 9. I just downloaded 8,01-9. In my bookmarks/submaps URL had version 8.01, icons. Now at 9 in the URL icons have disappeared. Restart Firefox, or restart the computer solved the problem... Who knows the solution. In advance my big thank
-
Challenge: Pre-installed YouTube app not working not
Hi all Problems with pre-installed YouTube app. The application crashes when I start and blinks a random string of characters on the top row below the status bar. None of the buttons work (except the main home button) and it shows the same results wi
-
What are the functional differences, if any, between MS detours and the alternative open source EasyHook? http://www.microsoftstore.com/store/msusa/en_US/PDP/Microsoft-Research-detours-v3-professional/ProductID.253663300 https://easyhook.github.IO/in
-
ARC Touch jumps around on the desktop screen?
ARC Touch jumps around on the desktop screen?
-
Acer One S1002 cannot connect to Wifi
I just bought a S1002 an Acer (windows 8.1) last night and connected to the wifi at home. No problem. I get out and continue to downtown, then select wifi that I want to connect, and the State of WiFi sticks on "Checking network requirements" before