Usage of TAble Functions in OBIEE
Hello All,
I have created a table function in the database.
Is it possible to use/call table functions in obiee.Please let me know how to use table functions in OBIEE.
Thanks in advance.
Hi,
Thanks for your reply.
I want to use this table function to generate answers report.
In the query i am using unions,bind variables.I can not create a database view on this query.The best solution would be creating a table function.
But,i do not know how to access/use/call this table function to create answers report.
Thanks in advance.
Similar Messages
-
How to use Table valued MSSQL function in OBIEE
Hi all,
Can some one help me to understand how to use table valued function in OBIEE? I want to use a table valued function (MSSQL function, with some input parameter), in the physical layer to pull the data?
I know for MSSQL Stored Procedure we can write as
EXEC SP_NAME @Parameter = 'VLUEOF(NQ_SESSION.Variablename)'
but now I have a table valued function in the query window I can get the data as
select * from myfunction(parametervalue)
In physical layer of OBIEE I have tried as
select * from myfunction('VLUEOF(NQ_SESSION.Variablename)'), but I'm getting error as the NQ_SESSION variable doesn't have a value , but actually I have initialized the variable but still Im getting error.
Can some one help me to solve this.
Thanks,
MithunFollow this link and try yourself. let me know for issues
Substring instr issue in obiee
Appreciate if you mark
Edited by: Srini VEERAVALLI on Feb 20, 2013 8:13 AM -
OBIEE Usage Tracking Table Is Not Populated
Hello everybody,
OBIEE Usage tracking table (s_nq_acct) is not populated correctly for last a few weeks. I have no experience on configuring / managing usage tracking jobs, so I do not know where to start to solve this problem. First of all, which log file should I go to find the problem? And also which parameters should I look? Can you help me please.
Regards,
DilekCheck that the absolutely correct and precise connection pool information contained in your RPD matches what your entries in the MBeans which then get written to the NQSConfig.ini.
Check that your UT physical model in the RPD physical layer isn't and old (11.1.1.5) setup running on a 11.1.1.7 env where the column definitions don't match.
Several log files. NQServer.log and NQQuery.log to begin with. -
OBIEE 11G - Usage Tracking - Table S_NQ_DB_ACCT
Hi
I successfully set up usage tracking in Obiee 11 and the table S_NQ_ACCT gets a lot of new records. Basically it's working.
In the nqserver.log I get some errors concerning a new table S_NQ_DB_ACCT:
[nQSError: 17001] Oracle Error code: 942, message: ORA-00942: table or view does not exist
at OCI call OCIStmtExecute: INSERT INTO S_NQ_DB_ACCT (ID,LOGICAL_QUERY_ID,QUERY_TEXT,QUERY_BLOB,TIME_SEC,ROW_COUNT,START_TS,START_DT,START_HOUR_MIN,END_TS,END_DT,END_HOUR_MIN) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12).
This is an additional Usage Tracking Table which didn't exist in OBIEE 10G.
I configured the table as S_NQ_ACCT in the same place in the repositry/connection pool. Writing to this table should be possible.
Does anybody has an idea what could be wrong? Does another user fill data to this table than the user which fills data to S_NQ_ACCT?
Thank youHi
Thank you.
I use the table within the default RCU created schema. What I don't understand ist why the table S_NQ_ACCT gets a lot of records (because I set the loglevel) but S_NQ_DB_ACCT keeps empty with the error in the nqserver.log. I mean if one table works then the other should be working too? I checked also the permissions which are the same for both tables.
[2012-06-04T15:14:39.000+00:00] [OracleBIServerComponent] [ERROR:1] [] [] [ecid: 7d4f9e9d968c0bfe:-39c197c9:13773b9d89f:-8000-000000000005c768] [tid: 18e0] [nQSError: 17011] SQL statement execution failed. [[
[nQSError: 17001] Oracle Error code: 942, message: ORA-00942: table or view does not exist
at OCI call OCIStmtExecute: INSERT INTO S_NQ_DB_ACCT (ID,LOGICAL_QUERY_ID,QUERY_TEXT,QUERY_BLOB,TIME_SEC,ROW_COUNT,START_TS,START_DT,START_HOUR_MIN,END_TS,END_DT,END_HOUR_MIN) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12).
]] -
Hi All,
I tried using Evaluate and Evaluate_Aggr in the column formula of a report.
Evaluate_Aggr() is erroring saying the dimension Work Order is incorrectlly defines logical Table Source Mapping for a dimension of Work Order. If I revoke the implicit fact coniguration on this Subject Area which I have, the report executes as expected. But this implicit configuration is required in my scenario for other reports to work.
Using Evaluate() works perfectly.
Can anyone help me in fixing this?
Shld I add any other configuration in the RPD to resolve this issue?
Thanks996933 wrote:
hi all
i got this error when i try to execute evaluate function in obiee answer
nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <(>: Syntax error [nQSError: 26012] . (HY000)
SQL Issued: SELECT DGN_TIME_RES_USAGE_CUBE.DRTCLN_WO_NO, DGN_TIME_RES_USAGE_CUBE.HOURS, DGN_TIME_RES_USAGE_CUBE.PROJ_NO, EVALUATE('FUNC_FIND_EMPLOYEE_DESC(%1,%2,%3)','KASA',DGN_TIME_RES_USAGE_CUBE.DRTCHD_EMP_ID,1), RMAX(DGN_TIME_RES_USAGE_CUBE.DRTCHD_DATE), RMIN(DGN_TIME_RES_USAGE_CUBE.DRTCHD_DATE) FROM LIVE2 years back post from the next time open new thread ? (Business Intelligence Suite Enterprise Edition )
Thanks,
Saichand -
Unable to use WriteBack function in OBIEE on a Unix setup
Hi All
I am trying to implement the writeBack function in OBIEE. We have OBIEE installed on a Unix machine. Below is the xml that I have writte, it keeps erroring stating that the xml file cannot be read.
<?xml version="1.0" encoding="utf-8" ?>
<WebMessageTables xmlns:sawnm="com.siebel.analytics.web/message/v1">
<WebMessageTable lang="en-us" system="WriteBack" table="Messages">
<WebMessage name="forecast">
<XML>
<writeBack connectionPool="MOM_BI">
<Insert></Insert>
<Update>UPDATE STORE SET STORE_NAME='{@c1}' WHERE STORE={@c0}</Update>
<postUpdate>COMMIT</postUpdate>
</writeBack>
</XML>
</WebMessage>
</WebMessageTable>
</WebMessageTables>
Below is the log that I've received from OBIEE:
Error loading XML Message File (/app/oracle/product/OBIEE10133/OracleBI/web/msgdb/CustomMessages/forecast.xml): Sax parser returned an exception.
Message: Invalid document structure, Entity publicId: /app/oracle/product/OBIEE10133/OracleBI/web/msgdb/CustomMessages/forecast.xml, Entity systemId: , Line number: 2, Column number: 1^M
Error Codes: UH6MBRBC^M
Could you please let me know what is wrong with my xml file? By the way I only want to do an update to my table. Also I have followed all the examples from Venkat and others but I stil cannot get it to work.
Regards
AdnanIt's already good to know that the file gets picked up.
What I don't understand: "The log files are not being updated with the error however when I re-save my Answer it is populating the log file to state that the object already existed."?
I had to put a fake "insert" statement to get it working once. Here's the example:
<?xml version="1.0" encoding="utf-8"?>
<WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
<WebMessageTable lang="en-us" system="WriteBack" table="Messages">
<WebMessage name="ELT_Upside">
<XML>
<writeBack connectionPool="ELT_Writeback_Pool">
<update> UPDATE T_DW_LOGIC_ELT_UPSIDE SET COMMENTS='@{c0}', AMOUNT=@{c1}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where UPSIDE_COMMENT_ID=@{c2} </update>
<insert> UPDATE T_DW_LOGIC_ELT_UPSIDE SET COMMENTS='@{c0}', AMOUNT=@{c1}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where UPSIDE_COMMENT_ID=@{c2} </insert>
</writeBack>
</XML>
</WebMessage>
<WebMessage name="ELT_Downside">
<XML>
<writeBack connectionPool="ELT_Writeback_Pool">
<update> UPDATE T_DW_LOGIC_ELT_DOWNSIDE SET COMMENTS='@{c0}', AMOUNT=@{c1}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where DOWNSIDE_COMMENT_ID=@{c2} </update>
<insert> UPDATE T_DW_LOGIC_ELT_DOWNSIDE SET COMMENTS='@{c0}', AMOUNT=@{c1}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where DOWNSIDE_COMMENT_ID=@{c2} </insert>
</writeBack>
</XML>
</WebMessage>
<WebMessage name="ELT_Outlook">
<XML>
<writeBack connectionPool="ELT_Writeback_Pool">
<update> UPDATE T_DW_LOGIC_ELT_OUTLOOK SET AMOUNT=@{c4}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where OUTLOOK_COMMENT_ID=@{c0} </update>
<insert> UPDATE T_DW_LOGIC_ELT_OUTLOOK SET AMOUNT=@{c4}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where OUTLOOK_COMMENT_ID=@{c0} </insert>
</writeBack>
</XML>
</WebMessage>
</WebMessageTable>
</WebMessageTables>
Cheers,
C. -
Urgent - INSTR() Functions in OBIEE?
Hi All,
I just got some very good help from the DB experts on these forums about solving a problem with a table join that I had.
But now I have this SQL query and I'm trying to figure out how to implement this in OBIEE:
select *
from TABLE1,TABLE2
where instr(TABLE2.USER_ID,TABLE1.USER_ID) > 0
My question is how do I implement this instr() function on OBIEE? I checked physical and business model mapping layers in the repository and it does not allow me to configure this type of join. Is it possible to configure this type of join function to be invoked automatically everytime a user runs a certain query in OBIEE (as if it was a natural join)?
Any help would be greatly appreciated.
AlanHi,
You can refer the below links,
Substring instr issue in obiee
extract a string from a string
http://108obiee.blogspot.in/2009_10_01_archive.html
Award points it is useful.
Thanks,
satya -
Issue With External Table Authentiaction in OBIEE 11.1.1.6.4
Hi,
We are trying to implement security through External table Authentication in OBIEE 11.1.1.6.4.As a part of this process,we want to pass the credential values which are entered in login screen to the below query in the GET SQL PASSWORD section of ReadonlySQLAuthentication Provider.
select encryptfn(:USER,:PASSWORD) from Users where Username=?
Credential values which we are entering in Analytics Answers login screen are not getting passed into :USER and :PASSWORD.
Can anybody please help us what is the exact variable we should use in place of :USER and :PASSWORD in the function called from the above select statement?
Thanks,
SyamHi,
We are also facing the same issue. Any suggestions/workarounds are appreciated.
Thanks,
Obul -
Does using TABLE FUNCTIONS degrades performance
Hi,
I am using a TABLE Function TABLE(TABLEA)
I am using a SQL Statement where I am joing TABLE FUNCTION :TABLE(TABLEA) and Normal table:TABLEB
i.e
SELECT CODE,SUD FROM TABLEB,TABLE(TABLEA)
WHERE CODE=CODE1 (CODE1 is a Object Type variable).user598986 wrote:
I am using a TABLE Function TABLE(TABLEA)
I am using a SQL Statement where I am joing TABLE FUNCTION :TABLE(TABLEA) and Normal table:TABLEB
i.e
SELECT CODE,SUD FROM TABLEB,TABLE(TABLEA)
WHERE CODE=CODE1 (CODE1 is a Object Type variable).One particular issue with table functions and joins is that the optimizer doesn't have a clue about the cardinality, i.e. the number of rows returned by the table function and therefore applies defaults which might be way off. If you somehow know roughly how many rows are going to be returned (may be a quite constant number of rows or your process know the number of rows in a collection etc.) then you can help the optimizer by using the (undocumented) "CARDINALITY" hint, e.g.
SELECT /*+ CARDINALITY (A, 100) */ CODE,SUD FROM TABLEB B,TABLE(TABLEA) A...
tells the optimizer that the table function is going to return 100 rows. Note the usage of the alias in the hint.
But bear in mind that this only helps partially, some other basic information like column statistics are still missing and therefore the estimates of the optimizer still might be inaccurate.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Applying decode function in obiee 11g
DECODE(A.AC_CCY,'INR',DECODE(DRCR_IND,'D',-1,1)*A.LCY_AMOUNT,DECODE(DRCR_IND,'D',-1,1)*A.FCY_AMOUNT),
DECODE(DRCR_IND,'D',-1,1)*A.LCY_AMOUNT,
Can any one help me how to decode the above sql statement in obiee 11g.
Edited by: 925104 on Apr 3, 2012 12:48 AMyou can achieve it by using CASE WHEN condition END function in obiee. nested case also supported by obiee.
check the below link Decode Join Condition in OBIEE RPD
Thanks
Jay.
Edited by: Jay on Apr 3, 2012 12:56 PM -
Converting Decode function in OBIEE
Hi Guru's
we are converting some BO reports to OBIEE and need to convert Decode function
Below is the Decode function they are using:
Decode ( sign(nvl(BOOKINGS_DATA_UDTC.qty_shipped,0)), 0,decode(BOOKINGS_DATA_UDTC.DELIVERY_NUMBER, 0,decode(BOOKINGS_DATA_UDTC.Schd_Ship_date_fk,to_date('1/1/1990','mm/dd/yyyy'),'Next Month Backlog',decode(sign(nvl(BOOKINGS_DATA_UDTC.Schd_Ship_date_fk, '01-JAN-90') -PAR.PAR_DATE), 1, 'Next Month Backlog', 'Current month will ship')) ,'Awaiting for collection') ,'MTD Shipped')
i have tried converting into case :
case when sign(IFNULL("BOOKINGS_DATA_UDTC"."Qty Shipped",0)) = 0 then (case when "BOOKINGS_DATA_UDTC"."Delivery Number" = 0 then (case when "BOOKINGS_DATA_UDTC"."SCHD_SHIP_DATE_FK" = '01-JAN-1990' then 'Next Month Backlog' else (case when Timestampdiff(SQL_TSI_DAY, cast('@{ParDate}{28-DEC-2012}' as Date),(case when "BOOKINGS_DATA_UDTC"."SCHD_SHIP_DATE_FK" IS NULL then CAst('01-JAN-1990' as DATE) else "BOOKINGS_DATA_UDTC"."SCHD_SHIP_DATE_FK" end)) > 1 then 'Next Month Backlog' else 'Current Month Will Ship' end) end) else 'Awaiting For Collection' end) else 'MTD Shipped' end
But it is not workign as expected.
Can some one please help me with this.
Thanks,you can achieve it by using CASE WHEN condition END function in obiee. nested case also supported by obiee.
check the below link Decode Join Condition in OBIEE RPD
Thanks
Jay.
Edited by: Jay on Apr 3, 2012 12:56 PM -
How to use the Table Function defined in package in OWB?
Hi,
I defined a table function in a package. I am trying to use that in owb using Table function operator. But I came to know that, owb R1 supports only standalone table functions.
Is there any other way to use the table function defined in a package. As like we create synonyms for functions, is there any other way to do this.
I tryed to create synonyms, it is created. But it is showing compilation error. Finally I found that, we can't create synonyms for functions which are defined in packages.
Any one can explain it, how to resolve this problem.
Thank you,
Regards
Gowtham Sen.Hi Marcos,
Thank you for reply.
OWB R1 supports stand alone table functions. Here what I mean is, the table fucntion which is not inculded in any package is a stand alone table function.
for example say sample_tbl_fn is a table function. It is defined as a function.It is a stand alone function. We call this fucntion as "samp_tbl_fn()";
For exampe say sample_pkg is a package. say a function is defined in a package.
then we call that function as sample_pkg.functionname(); This is not a stand alone function.
I hope you understand it.
owb supports stand alone functions.
Here I would like to know, is there any other way to use the functions which are defined in package. While I am trying to use those functions (which are defined in package -- giving the name as packagename.functionname) it is throwing an error "Invalid object name."
Here I would like know, is there any other way to use the table functions which are defined in a package.
Thank you,
Regards,
Gowtham Sen. -
Table function on a collection in Dynamic SQL
Hello,
I am trying to create a refcursor by selecting from a collection using table function.
If I use the Select statement the query executes, but if I put the Select statement in a string
the collection variable does not get resolved. The resaon I am putiing it in a string is because the
WHERE clause will be passed a parameter. The code below is an anonymous block but will be changed to a
procedure once I get it to work.
I have tried many different ways but was unsuccessful.
Please see if anybody cann assist or what I am trying to achive is not possible, so provide an alternative.
The error I am getting is
ORA-00904: "V_ALARM_REC_TABLE": invalid identifier
ORA-06512: at line 50
Thanks.
Bimal
DECLARE
TYPE c_refcurtype IS REF CURSOR;
x c_refcurtype;
p_recordset c_refcurtype;
v_rec mc2_dev2.mc2_alarm_rec_type := mc2_dev2.mc2_alarm_rec_type(null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null);
v_alarm_rec_table mc2_dev2.mc2_alarm_rec_table := mc2_dev2.mc2_alarm_rec_table();
v_select varchar2(200) := 'select a.* from ';
v_table varchar2(200) := 'table(v_alarm_rec_table) a ';
v_where varchar2(200) := 'where a.alarm_rule_def_uid = 9';
v_query varchar2(32000);
BEGIN
MC2_ALARM.create_mc2_alarm(x, 1); --- ( X is a refcursor, which I will use to populate v_alarm_rec_table a (nested table collection)
LOOP
FETCH x INTO v_rec.record_cnt,
v_rec.rn,
v_rec.alarm_precision_order,
v_rec.alarm_rule_def_uid,
v_rec.alarm_type_def_uid,
v_rec.alarm_rule_scope_uid,
v_rec.trigger_tpl_master_uid,
v_rec.alarm_scope_def_uid,
v_rec.alarm_object_uid,
v_rec.error_type,
v_rec.all_error_codes,
v_rec.enabled,
v_rec.start_hour,
v_rec.end_hour,
v_rec.day_type,
v_rec.alarm_severity_def_uid,
v_rec.on_watch_duration,
v_rec.update_on_status_change,
v_rec.log_ind,
v_rec.email_to,
v_rec.email_from,
v_rec.send_email,
v_rec.stale_period;
EXIT WHEN x%NOTFOUND;
v_alarm_rec_table.extend;
v_alarm_rec_table(v_alarm_rec_table.last) := v_rec;
END LOOP;
CLOSE x;
v_query := v_select||v_table||v_where; -- ERROR OCCURS AT THIS LINE as it cannot resolve the TABLE name v_alarm_rec_table)
dbms_output.put_line('sql: '||v_query);
OPEN p_recordset FOR v_query;
LOOP
FETCH p_recordset INTO v_rec.record_cnt,
v_rec.rn,
v_rec.alarm_precision_order,
v_rec.alarm_rule_def_uid,
v_rec.alarm_type_def_uid,
v_rec.alarm_rule_scope_uid,
v_rec.trigger_tpl_master_uid,
v_rec.alarm_scope_def_uid,
v_rec.alarm_object_uid,
v_rec.error_type,
v_rec.all_error_codes,
v_rec.enabled,
v_rec.start_hour,
v_rec.end_hour,
v_rec.day_type,
v_rec.alarm_severity_def_uid,
v_rec.on_watch_duration,
v_rec.update_on_status_change,
v_rec.log_ind,
v_rec.email_to,
v_rec.email_from,
v_rec.send_email,
v_rec.stale_period;
EXIT WHEN p_recordset%NOTFOUND;
some dbms_output statements...
END LOOP;
END;
The error I am getting is
ORA-00904: "V_ALARM_REC_TABLE": invalid identifier
ORA-06512: at line 50Thanks Timur/Solomon,
mc2_dev2 is the schema name.
mc2_alarm_rec_table is a SQL type.
Here are the scripts:
CREATE OR REPLACE TYPE MC2_DEV2.mc2_alarm_rec_type IS OBJECT
( record_cnt NUMBER,
rn number,
alarm_precision_order NUMBER(6),
alarm_rule_def_uid NUMBER(6),
alarm_type_def_uid NUMBER(6),
alarm_rule_scope_uid NUMBER(6),
trigger_tpl_master_uid NUMBER(6),
alarm_scope_def_uid NUMBER(6),
alarm_object_uid NUMBER(6),
error_type VARCHAR2(1),
all_error_codes VARCHAR2(1),
enabled VARCHAR2(1),
start_hour NUMBER(2),
end_hour NUMBER(2),
day_type NUMBER(2),
alarm_severity_def_uid NUMBER(6),
on_watch_duration NUMBER(6),
update_on_status_change VARCHAR2(1),
log_ind VARCHAR2(1),
email_to VARCHAR2(128),
email_from VARCHAR2(128),
send_email VARCHAR2(1),
stale_period NUMBER(6)
CREATE OR REPLACE TYPE MC2_DEV2.MC2_ALARM_REC_TABLE IS TABLE OF MC2_DEV2.mc2_alarm_rec_type;
If I popoulate the cursor with the following code:
OPEN p_recordset FOR
select a.* from table (v_alarm_rec_table) a where a.alarm_rule_def_uid = 9;
there is no issue it works just fine.
But when when I use
OPEN p_recordset FOR v_query; ---- where v_query := v_select||v_table||v_where;
the variable v_alarm_rec_table does not get resolved.
Regards,
Bimal -
How can we find the most usage and lowest usage of table in Sql Server by T-SQL
how can we find the most usage and lowest usage of table in Sql Server by T-SQL
The table has time stamp column
StartedOn datetime
EndedOn datetimeThe Below query has been used , but the textdata column doesnot include the name of the table ServiceLog.
SELECT
FROM
databasename,
duration
fn_trace_gettable('F:\Program
Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\log_148.trc',
default)
WHERE
DATABASENAME='ZTCFUTURE'
AND TEXTDATA
IS
NOT
NULL
--AND TEXTDATA LIKE 'SERVICE%'
order
by cpu
desc; -
Performance issues with pipelined table functions
I am testing pipelined table functions to be able to re-use the <font face="courier">base_query</font> function. Contrary to my understanding, the <font face="courier">with_pipeline</font> procedure runs 6 time slower than the legacy <font face="courier">no_pipeline</font> procedure. Am I missing something? The <font face="courier">processor</font> function is from [url http://www.oracle-developer.net/display.php?id=429]improving performance with pipelined table functions .
Edit: The underlying query returns 500,000 rows in about 3 minutes. So there are are no performance issues with the query itself.
Many thanks in advance.
CREATE OR REPLACE PACKAGE pipeline_example
IS
TYPE resultset_typ IS REF CURSOR;
TYPE row_typ IS RECORD (colC VARCHAR2(200), colD VARCHAR2(200), colE VARCHAR2(200));
TYPE table_typ IS TABLE OF row_typ;
FUNCTION base_query (argA IN VARCHAR2, argB IN VARCHAR2)
RETURN resultset_typ;
c_default_limit CONSTANT PLS_INTEGER := 100;
FUNCTION processor (
p_source_data IN resultset_typ,
p_limit_size IN PLS_INTEGER DEFAULT c_default_limit)
RETURN table_typ
PIPELINED
PARALLEL_ENABLE(PARTITION p_source_data BY ANY);
PROCEDURE with_pipeline (argA IN VARCHAR2,
argB IN VARCHAR2,
o_resultset OUT resultset_typ);
PROCEDURE no_pipeline (argA IN VARCHAR2,
argB IN VARCHAR2,
o_resultset OUT resultset_typ);
END pipeline_example;
CREATE OR REPLACE PACKAGE BODY pipeline_example
IS
FUNCTION base_query (argA IN VARCHAR2, argB IN VARCHAR2)
RETURN resultset_typ
IS
o_resultset resultset_typ;
BEGIN
OPEN o_resultset FOR
SELECT colC, colD, colE
FROM some_table
WHERE colA = ArgA AND colB = argB;
RETURN o_resultset;
END base_query;
FUNCTION processor (
p_source_data IN resultset_typ,
p_limit_size IN PLS_INTEGER DEFAULT c_default_limit)
RETURN table_typ
PIPELINED
PARALLEL_ENABLE(PARTITION p_source_data BY ANY)
IS
aa_source_data table_typ;-- := table_typ ();
BEGIN
LOOP
FETCH p_source_data
BULK COLLECT INTO aa_source_data
LIMIT p_limit_size;
EXIT WHEN aa_source_data.COUNT = 0;
/* Process the batch of (p_limit_size) records... */
FOR i IN 1 .. aa_source_data.COUNT
LOOP
PIPE ROW (aa_source_data (i));
END LOOP;
END LOOP;
CLOSE p_source_data;
RETURN;
END processor;
PROCEDURE with_pipeline (argA IN VARCHAR2,
argB IN VARCHAR2,
o_resultset OUT resultset_typ)
IS
BEGIN
OPEN o_resultset FOR
SELECT /*+ PARALLEL(t, 5) */ colC,
SUM (CASE WHEN colD > colE AND colE != '0' THEN colD / ColE END)de,
SUM (CASE WHEN colE > colD AND colD != '0' THEN colE / ColD END)ed,
SUM (CASE WHEN colD = colE AND colD != '0' THEN '1' END) de_one,
SUM (CASE WHEN colD = '0' OR colE = '0' THEN '0' END) de_zero
FROM TABLE (processor (base_query (argA, argB),100)) t
GROUP BY colC
ORDER BY colC
END with_pipeline;
PROCEDURE no_pipeline (argA IN VARCHAR2,
argB IN VARCHAR2,
o_resultset OUT resultset_typ)
IS
BEGIN
OPEN o_resultset FOR
SELECT colC,
SUM (CASE WHEN colD > colE AND colE != '0' THEN colD / ColE END)de,
SUM (CASE WHEN colE > colD AND colD != '0' THEN colE / ColD END)ed,
SUM (CASE WHEN colD = colE AND colD != '0' THEN 1 END) de_one,
SUM (CASE WHEN colD = '0' OR colE = '0' THEN '0' END) de_zero
FROM (SELECT colC, colD, colE
FROM some_table
WHERE colA = ArgA AND colB = argB)
GROUP BY colC
ORDER BY colC;
END no_pipeline;
END pipeline_example;
ALTER PACKAGE pipeline_example COMPILE;Edited by: Earthlink on Nov 14, 2010 9:47 AM
Edited by: Earthlink on Nov 14, 2010 11:31 AM
Edited by: Earthlink on Nov 14, 2010 11:32 AM
Edited by: Earthlink on Nov 20, 2010 12:04 PM
Edited by: Earthlink on Nov 20, 2010 12:54 PMEarthlink wrote:
Contrary to my understanding, the <font face="courier">with_pipeline</font> procedure runs 6 time slower than the legacy <font face="courier">no_pipeline</font> procedure. Am I missing something? Well, we're missing a lot here.
Like:
- a database version
- how did you test
- what data do you have, how is it distributed, indexed
and so on.
If you want to find out what's going on then use a TRACE with wait events.
All nessecary steps are explained in these threads:
HOW TO: Post a SQL statement tuning request - template posting
http://oracle-randolf.blogspot.com/2009/02/basic-sql-statement-performance.html
Another nice one is RUNSTATS:
http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551378329289980701
Maybe you are looking for
-
Master Data -- unable to delete the request
I loaded master data for 0EMPLOYEE info object, all the records Added but the request is in Read, I am trying to QM status Green Manually it is giving the message QM action not allowed for DTP requests in master data and Text Tables . I am unable t
-
Hi, When Import a picture from a file, it imports the picture but never finish it. I Force Quit iPhoto, and the picture was imported.
-
Hi experts, I need a query that will help me design a report for a customer. The query should show the journal entry transactions for business partners, that is their debit and credit transactions. Also the query should help me to design the report a
-
Currency config in vendor master
Dear team How can i configure two currency in one vendor please guide me Thanks Gan
-
IMAQdx External Compiler Interface
Hello, I wish to use the IMAQdx and NI-Vision External Compiler Interfaces with Cygwin gcc/g++ compilers. I am already doing this sort of game without any problem with the NI-VISA and NI-DAQmx External Interfaces (g++ appears to be happy with the dll