How to use RefCursor to return millions of records
I have a stored Procedure which returns a RefCursor. Following is the query which is used to open the RefCursor. this query gets executed in 7 seconds and it returns 13,00,000 records. It takes hours to show them in the dotnet application.
SELECT
CO.COMPANY_ID AS COMPANY_ID,
PCH.HOLDING_ID AS HOLDING_ID,
CO.NAME AS FIRM_NAME,
PCC.NAME AS "Sub-Account Name",
PCC.PORTFOLIO_CLASS_NAME AS "Sub-Account Type",
H.COUPON_RATE AS COUPON_RATE,
NVL(TO_CHAR(H.COUPON_RATE),F_GETCODE(H.COUPON_STRUCTURE_ID,'CPN')) AS COUPON_FIELD,
TO_CHAR(H.MATURITY_DATE,'DD-MON-YYYY') AS MATURITY_DATE,
CO.ALPHA_NAME AS ALPHA_NAME,
H.ISSUER_NAME AS ISSUER_NAME,
H.ISSUER_ALPHA_NAME AS ISSUER_ALPHA_NAME,
PCH.FI_PAR_AMOUNT AS "Currency Par (000s)",
PCH.FI_NET_CHANGE AS "Net Change (000s)",
PCH.FI_BONDS_HELD AS "# of Bonds Held",
TO_CHAR(CO.REPORT_DATE,'DD-MON-YYYY') AS REPORT_DATE,
H.NAME AS ISSUEDESC,
H.ISSUER_COUNTRY_NAME AS ISSUER_COUNTRY_NAME,
F_GETCODE(H.ISSUER_STATE_ID,'S') AS ISSUER_STATE_NAME,
TO_CHAR(H.ISSUE_DATE,'DD-MON-YYYY') AS ISSUE_DATE,
H.LEAD_MANAGER AS LEAD_MANAGER,
H.CURRENCY_CODE AS CURRENCY_CODE,
PCH.MARKET_SECTOR_CODE AS MARKET_SECTOR_CODE,
H.CUSIP AS CUSIP,
H.ISIN AS ISIN,
H.ISSUER_TICKER_SYMBOL_TEXT AS "Primary Exchange Equity Ticker",
H.PLEDGE_NAME AS "Instrument/Pledge",
H.COLLATERAL_NAME AS "Collateral/Purpose",
H.ISSUER_CREDIT_SECTOR_NAME AS "Issuer Credit Sector",
H.COUPON_STRUCTURE_NAME AS "Coupon Structure",
H.SP_RATING_NAME AS "SP Rating",
H.MOODYS_RATING_NAME AS "Moodys Rating",
H.FITCH_RATING_NAME AS "Fitch Rating" ,
P.HONORIFIC_PREFIX_CODE AS HONORIFIC,
P.FIRST_NAME AS FIRST_NAME,
P.MIDDLE_INITIAL AS MIDDLE_INITIAL,
P.LAST_NAME AS LAST_NAME,
P.DISPLAY_FUNCTION_NAME AS Title,
P.DIRECT_DIAL_PHONE AS "DIRECT DIAL PHONE",
D.PHONE_CODE AS "Country Phone Code",
P.EMAIL_ID AS "Email Address",
CO.MAIL_ADDRESS_LINE1 AS MAIL_ADDRESS_LINE1,
CO.MAIL_ADDRESS_LINE2 AS MAIL_ADDRESS_LINE2,
CO.MAIL_CITY_NAME AS MAIL_CITY_NAME,
CO.MAIL_STATE_CODE AS MAIL_STATE_NAME,
CO.MAIL_ZIP_CODE as "Firm Postal Code",
CO.LOC_ADDRESS_LINE1 AS LOC_ADDRESS_LINE1,
CO.LOC_ADDRESS_LINE2 AS LOC_ADDRESS_LINE2,
CO.LOC_CITY_NAME AS LOC_CITY_NAME,
CO.LOC_STATE_CODE AS LOC_STATE_NAME,
CO.LOC_ZIP_CODE,
CO.LOC_COUNTRY_NAME AS LOC_COUNTRY_NAME,
C.PHONE_CODE AS "Firm Country Phone Code",
CO.PHONE_NUMBER AS PHONE,
CO.FAX_NUMBER AS FAXNO,
/* COUNT(PCH.COMPANY_ID) OVER (PARTITION BY PCH.COMPANY_ID ORDER BY PCH.COMPANY_ID) AS ROW_CNT,
COUNT(DISTINCT CO.COMPANY_ID) OVER() AS FIRMCOUNT,
COUNT(DISTINCT CO.COMPANY_ID) OVER() AS TOTAL_RECORDS,
COUNT(DISTINCT PCC.PORTFOLIO_COMPANY_CUSTOMER_ID) OVER(PARTITION BY CO.COMPANY_ID) AS FUNDCOUNT,
COUNT(DISTINCT PCC.PORTFOLIO_COMPANY_CUSTOMER_ID) OVER() AS FUNDPORTFOLIOCOUNT,
COUNT(DISTINCT H.HOLDING_ID) OVER(PARTITION BY CO.COMPANY_ID,PCC.PORTFOLIO_COMPANY_CUSTOMER_ID) AS ISSUECOUNT,
PCC.PRIVATE_PORTFOLIO_FLAG,
PCC.TOP_TEN_HOLDINGS_FLAG ,
TO_CHAR(SYSDATE,'DD/MM/YYYY HH:MM:SS') TI
FROM
PORTFOLIO_COMPANY_HOLDING PCH,
HOLDING H,
COMPANY CO,
PORTFOLIO_COMPANY_CUSTOMER PCC,
PERSON P ,
PERSON_PORTFOLIO PP,
COUNTRY C,
COUNTRY D
WHERE
PCH.HOLDING_ID=H.HOLDING_ID
AND PCH.COMPANY_ID=CO.COMPANY_ID
AND PCH.PORTFOLIO_COMPANY_CUSTOMER_ID=PCC.PORTFOLIO_COMPANY_CUSTOMER_ID
AND P.EMPLOYEE_ID = PP.EMPLOYEE_ID
AND CO.COMPANY_ID=PP.COMPANY_ID
AND CO.COMPANY_ID=PCC.COMPANY_ID
AND PCC.PORTFOLIO_COMPANY_CUSTOMER_ID = PP.PORTFOLIO_COMPANY_CUSTOMER_ID
AND C.COUNTRY_ID = CO.LOC_COUNTRY_ID
AND D.COUNTRY_ID= P.COMPANY_LOC_COUNTRY_ID
AND P.DISPLAY_COMPANY_CONTACT_FLAG = 'Y'
AND PCH.HOLDING_ID IN ( SELECT HOLDING.HOLDING_ID FROM MV_BOND HOLDING WHERE HOLDING.LANGUAGE_ID=2 AND INSTR(PATTNO_STRING,',96,')>0
-- AND (((HOLDING.MARKET_SECTOR_ID) IN (8209) )
AND (((HOLDING.CURRENCY_ID) IN (10000003) )
)
i ran the query in TOAD it got executed in 7 seconds. but when i used the same query in stored procedure it was taking lot of time to complete pushing the data to the application. Need your help to tune the query.
Similar Messages
-
How to use search term2 in customer master record
hi
how to use search term2 in customer master record. can anyone tell me plz
thanks
monicaHi,
Search Term 2
Label used for search helps.
Only uppercase letters are stored in this field. Your entries are converted automatically to uppercase letters.
There are two of these fields for search terms. These fields can be used independently of each other.
Procedure
You can use your own criteria for entering the search term.
Example
You can enter the main part of the name or an organizational ID.
For example, for the company "Hechinger & Sons", you could enter "Hechinger" as the first search term.
The second search term could then be the name ID you use within your company, to help you identify your data later.
Please check out the following link:
http://help.sap.com/saphelp_47x200/helpdata/EN/01/a9b331455711d182b40000e829fbfe/frameset.htm
Hope this helps.
Please assign points as a way to say thanks.
Regards, -
How to use refcursor in a package
i want to use refcursor in a package
but when i am trying to declare a refcursor variable ,
I get no error but the refcursor does not return anything .
why is this happenning ?
I also read that we cannot define cursor variables in a paclage .
Then how to go about it ?
regards
shubhajitSince Oracle 7.3 REF CURSORS have been available which allow recordsets to be returned from stored procedures, functions and packages. The example below uses a ref cursor to return a subset of the records in the EMP table.
First, a package definition is needed to hold the ref cursor type:
CREATE OR REPLACE PACKAGE Types AS
TYPE cursor_type IS REF CURSOR;
END Types;
Note. In Oracle9i the SYS_REFCURSOR type has been added making this first step unnecessary. If you are using Oracle9i or later simply ignore this first package and replace any references to Types.cursor_type with SYS_REFCURSOR.
Next a procedure is defined to use the ref cursor:
CREATE OR REPLACE
PROCEDURE GetEmpRS (p_deptno IN emp.deptno%TYPE,
p_recordset OUT Types.cursor_type) AS
BEGIN
OPEN p_recordset FOR
SELECT ename,
empno,
deptno
FROM emp
WHERE deptno = p_deptno
ORDER BY ename;
END GetEmpRS;
The resulting cursor can be referenced from PL/SQL as follows:
SET SERVEROUTPUT ON SIZE 1000000
DECLARE
v_cursor Types.cursor_type;
v_ename emp.ename%TYPE;
v_empno emp.empno%TYPE;
v_deptno emp.deptno%TYPE;
BEGIN
GetEmpRS (p_deptno => 30,
p_recordset => v_cursor);
LOOP
FETCH v_cursor
INTO v_ename, v_empno, v_deptno;
EXIT WHEN v_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_ename || ' | ' || v_empno || ' | ' || v_deptno);
END LOOP;
CLOSE v_cursor;
END;
In addition the cursor can be used as an ADO Recordset:
Dim conn, cmd, rs
Set conn = Server.CreateObject("adodb.connection")
conn.Open "DSN=TSH1;UID=scott;PWD=tiger"
Set cmd = Server.CreateObject ("ADODB.Command")
Set cmd.ActiveConnection = conn
cmd.CommandText = "GetEmpRS"
cmd.CommandType = 4 'adCmdStoredProc
Dim param1
Set param1 = cmd.CreateParameter ("deptno", adInteger, adParamInput)
cmd.Parameters.Append param1
param1.Value = 30
Set rs = cmd.Execute
Do Until rs.BOF Or rs.EOF
-- Do something
rs.MoveNext
Loop
rs.Close
conn.Close
Set rs = nothing
Set param1 = nothing
Set cmd = nothing
Set conn = nothing
The cursor can also be referenced as a Java ResultSet:
import java.sql.*;
import oracle.jdbc.*;
public class TestResultSet {
public TestResultSet() {
try {
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:oci:@w2k1", "scott", "tiger");
CallableStatement stmt = conn.prepareCall("BEGIN GetEmpRS(?, ?); END;");
stmt.setInt(1, 30); // DEPTNO
stmt.registerOutParameter(2, OracleTypes.CURSOR); //REF CURSOR
stmt.execute();
ResultSet rs = ((OracleCallableStatement)stmt).getCursor(2);
while (rs.next()) {
System.out.println(rs.getString("ename") + ":" + rs.getString("empno") + ":" + rs.getString("deptno"));
rs.close();
rs = null;
stmt.close();
stmt = null;
conn.close();
conn = null;
catch (SQLException e) {
System.out.println(e.getLocalizedMessage());
public static void main (String[] args) {
new TestResultSet();
Hope this helps. Regards
Srini -
How to use execute query For a single record
Hi All,
I am working with oracle forms 10g, I have developed a custom form.
I the form user enter some data and click save in the menu and data get inserted into my table. Inside the insert statement i have hardcoded some values, Once data get inserted i cant able to see that values immediately in my text fields in my form.After requerying i can able to see the changes.
For example I have a text field called Status, and the field is display only field. At that time of insert i have hardcoded as "INCOMPLETE". Once the user enter the data in the form and click save the data get inserted in to my table but i cant able to see the status, after i requery my form i can able to see the status.
Here i do multi insert also.
This is my insert statement
BEGIN
First_Record;
LOOP
IF :BANK_GUARANTEE_BLK.CHECK_IN_OUT = 'Y'
THEN
XXBANK_GUARANTEE_HEADERS.XXBANK_GUARANTEE_INSERT;(this is my package, here i have written my insert statement)
--Execute_query;
END IF;
Exit when :System.Last_Record = 'TRUE';
Next_Record;
END LOOP;
END;
If user insert only one row and i gave Execute_query to refresh and bring the current data, but when i use execute_query Its brings up all the datas in the table.
Can any one tell me how to avoid this and how to use execute_query for a single record.
Thanks ®ards
SrikkanthSolved,
The solution is
set_block_property('LC_REQ_BLK',ONETIME_WHERE,'LC_PO_NUMBER='||:LC_REQ_BLK.LC_PO_NUMBER);
go_block('LC_REQ_BLK');
execute_query;
Works fine.
Regards
Sri -
DAX - how to use dax to return a previous row value?
Hi,
I was trying to use the EARLIER function but couldn't make it work:
EVALUATE
SUMMARIZE (
CALCULATETABLE (
'Inscricoes',
'Ano Letivo'[ID_TB_DIM_ANO_LETIVO] <= VALUE(26),
'Ano Letivo'[ID_TB_DIM_ANO_LETIVO] > VALUE(26) - 5,
'Escola'[ID_TB_DIM_UNIDADE_ORGANICA] = VALUE(6),
Curso[ID_TB_DIM_CURSO] = VALUE(372),
'Tipo de Inscricao no Curso'[DS_TIPO_INSCRICAO_CURSO]
= "Matrícula"
'Ano Letivo'[ID_TB_DIM_ANO_LETIVO],
'Ano Letivo'[DS_ANO_LETIVO],
"NR_INSCRICOES", [NR_ESTUDANTES_INSCRITOS])
This generates:
ID_TB_DIM_ANO_LETIVO
DS_ANO_LETIVO
NR_INSCRICOES
22
2010-11
93
23
2011-12
101
24
2012-13
84
25
2013-14
85
26
2014-15
104
I need a new field that does returns the previous value of subscriptions (NR_INSCRICOES), so last 2 columns will be:
93 -
101 - 93
84 - 101
85 - 84
104 - 85
Need some help. ThanksHi Pedro,
According to your description, you want to get the previous row data along with each row. Right?
In DAX, we can use EARLIER() function to achieve this requirement. Please refer to link below:
PowerPivot DAX Session Notes 2 – Previous Row
In this scenario, I suggest you select the three columns into one table(let's say TABLE1). Then you can try the expression below:
=CALCULATE(MAX(TABLE1[NR_ESTUDANTES_INSCRITOS]), (FILTER(TABLE1,EARLIER(TABLE1[ID_TB_DIM_ANO_LETIVO])>TABLE1[ID_TB_DIM_ANO_LETIVO])))
Reference:
EARLIER Function (DAX)
Best Regards,
Simon Hou
TechNet Community Support -
How to use loop to commit each 1M records?
oracle 9i
40M records need to be insert the table. Need to commit each 1M. But I don't want to loop each record and commit. I like to select 1M records and commit. Then select another 1M, then commit; How to do it? use savepoint?
Appreciate any ideas.
Thanks
S.You can achieve that using anonymous block using a for loop and couter but it not a good idea to commit after 1 million or 100k as you will be putting more overhead on your system and performance will be down.
Regards -
How to use ipod touch as a voice recorder?
Ipod does not have a built in microphone.
Does the Apple Store carry an external mice suitable?
I downloaded the iTalk application as well, but it seems an external mike may be the answer
397bluerockYes you can use an external mic. Some are in the Apple store. You can also Google mic for iPod touch. The 3G and 2G iPod came with a combination earphone/mic since those iPod did not come with a intrnal mic. I do not know if the 1G cam with the combination earphone/mic.
-
How to use (greater than) in web services call
Hello, I am trying to query a set of assets where the external unique ID is greater than 400,000. My existing code looks like
qryIn.ListOfAsset(0).ExternalSystemId = ">'400000'"
However, using this will return any asset record starting with a 5 or above as far as I can tell, I assume b/c it is comparing string data due to the single quotes infering data of type text (string). Is it possible to use comparison operators with numeric data correctly?
I posed this question to support and received the below answer:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <AssetWS_AssetQueryPage_Input xmlns="urn:crmondemand/ws/asset/"> <ListOfAsset xmlns="urn:/crmondemand/xml/asset"> <Asset> <AssetId /> <PurchaseDate/> <OwnerAccountId /> <ExternalSystemId>> '400000'</ExternalSystemId> </Asset> </ListOfAsset> </AssetWS_AssetQueryPage_Input> </soap:Body> </soap:Envelope>
Basically, instructing me to use >. I'm doing coding in .NET visual studio and not using the XML as above. However, I did try the following:
qryIn.ListOfAsset(0).ExternalSystemId = ">'400000'" which returned an error in the compiler.
Any help would be appreciated. Thanks.Thanks for the reply. I would assume "external system id" is an integer, but, I will test on a custom field that I now is of type integer.
Could you take your same code and use a non-zero value for the operand? For example, could you try
objAccQryParam.ListOfAccount[0].CustomInteger0 = ">= '10'"; and let me know if that returns values that are greater than or equal to 10. Using a two digit number is important. Assuming you have data greater than 10.
Thanks! -
Hi...
3....how to create table maintanence generator for a z table and how to use that for transfering a selected records to one server to another server.
thanks and regards,
k.swaminath reddyHi,
Table maintanance Generator is used to manually
input values using transaction sm30.The Table Maintenance Generator is used to create table maintenance program to add, modify or delete records in the database table. This can be accessed using transaction SE54 or in SE11 using the menu Utilities->Table Maintenance Generator
<b>
Follow below steps</b>
go to se11 check table maintanance check box under
attributes tab
utilities-table maintanance Generator->
create function group and assign it under
function group input box.
also assign authorization group default &NC& .
select standard recording routine radio in table
table mainitainence generator to move table
contents to quality and production by assigning
it to request.
select maintaience type as single step.
maintainence screen as system generated numbers
this dialog box appears when you click on create
button
save and activate table
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
One step, two step in Table Maintenance Generator
Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.
Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details.
please check the link for getting information about table maintenance generator !
https://www.sdn.sap.com/irj/sdn/advancedsearch?query=use%20of%20table%20maintenance%20generator&cat=sdn_all
http://www.sapdevelopment.co.uk/tips/tips_tabmaint_tcode.htm
http://www.sap-img.com/abap/create-a-table-maintance-program-for-a-z-table.htm
Regards,
Priyanka. -
How can I use QuickTime to make a screen recording that has both video and audio?
How do use QuickTime to make a screen recording that can be saved with both video and audio together?
do you know of any software that would record a QT movie playing on my Mac screen with both audio and video?
I have used Ambrosia's Snapz Pro X ($69) for years, but they are currently upgrading their Kext (Kernel Extension) software for changes inroduced by the Lion release so it might not be your best bet at this time. I also use ScreenFlow but it is a combination capture and editing utility which runs $99 and may include more features than you may need or will use. Have also tried Screenflick ($29) which, to some extent, appears to have a functionality somewhere between that of Snapz Pro X and ScreenFlow. It is a bit more complicated to set up but for the price might be the best bargin at this point. All three can capture the entire screen or a portion thereof, with or without mic/line and/or system audio. (Or at least they all will as soon as Ambrosia updates its Kext routine.)
Here is a URL link posted by QTKirk three days ago to an article that recaps of a number of currently available third-party screen capture apps from around the world several of which may interest you: http://mac.appstorm.net/roundups/utilities-roundups/10-screen-recording-tools-fo r-mac/ -
How to use the function who returns an array?
how to use getAllT in pls/sql or in java?
--------------------------------------------------->
create or replace package honghai as
type TType is varray(25) of number;
/*it can be like : type TType is table of number;
function getCountT return number;
function getAllT return TType;
end honghai;
create or replace package body honghai as
a number;
function getCountT return number is
acount number;
begin
select count(*) into acount from testasb.t;
return acount;
end getCountT;
function getAllT
return TType is
results TType;
begin
select testid into results(25) from testasb.T ;
return results ;
end getAllT;
begin
a := 2;
end honghai;
For the java part, click on the link below:
http://osi.oracle.com/~tkyte/ResultSets/index.html
For the pl/sql part specific to your problem, see the code below. Since you did not provide any table structure or sample data, I used some simple data for demonstration purposes:
SQL> CREATE TABLE t
2 (testid NUMBER)
3 /
Table created.
SQL> INSERT INTO t
2 VALUES (1)
3 /
1 row created.
SQL> INSERT INTO t
2 VALUES (2)
3 /
1 row created.
SQL> CREATE OR REPLACE PACKAGE honghai
2 AS
3 TYPE ttype IS REF CURSOR;
4 FUNCTION getcountt RETURN NUMBER;
5 FUNCTION getallt RETURN ttype;
6 END honghai;
7 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY honghai
2 AS
3 a NUMBER;
4 FUNCTION getcountt RETURN NUMBER
5 IS
6 account nUMBER;
7 BEGIN
8 SELECT COUNT (*)
9 INTO account
10 FROM scott.t;
11 RETURN account;
12 END getcountt;
13 FUNCTION getallt RETURN ttype
14 IS
15 results ttype;
16 BEGIN
17 OPEN results for 'SELECT testid FROM scott.t';
18 RETURN results;
19 END getallt;
20 BEGIN
21 a := 2;
22 END honghai;
23 /
Package body created.
SQL> VARIABLE g_num NUMBER
SQL> VARIABLE g_ref REFCURSOR
SQL> EXEC :g_num := honghai.getcountt
PL/SQL procedure successfully completed.
SQL> EXEC :g_ref := honghai.getallt
PL/SQL procedure successfully completed.
SQL> PRINT g_num
G_NUM
2
SQL> PRINT g_ref
TESTID
1
2 -
How to use Oracle refcursor dataset output parameter from SP
Can I request for help on how to use Oracle Output parameter from a stored procedure as a source. I need the output tobe stored in a flat file
Thanks
Abhijit
Message was edited by:
Abhijit77yes I would like to use it for ODI.. I would like the ouput of the refcursor to be fed to a text file using ODI. How to handle the records returned by the refcursor and map with txt file.
-
How to use standard Search Input Help (return 2 data code and desc) ?
Hi,
Please advise how to use standard Input Help provided by SAP and return 2 data (code and description) ? because the standard Input Help only return the code only ?
Thank You and Best Regards
Fernand>
Saket Abhyankar wrote:
> Hi,
>
> I think you need to go for 'Search Help Exit' or OVS.
>
> Regards,
>
> Saket.
That is not true that this is the only way. The standard Data Dictory based search help can return more than one value as long as there are multiple exporting values defined in the search help, the search help is attached to a Data Dictionary Structure, and this same data dictionary structure is used as the source of the context node. You can read more about this in the online help:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/9f724642314aabe10000000a42189b/frameset.htm
The Note section under Integration:
If an input help structure is stored in a field in the ABAP Dictionary, and if you want to use the field mapping of search help parameters stored in the ABAP Dictionary as the field name for the structure for your Web Dynpro input help, then map your context nodes to this structure. This ensures that all components of the structure are available dynamically at runtime as attributes of the node.
If the context node is not mapped to the structure, the data element's input help can be used if there is one. -
How to use stored procedures in DIAdem and Can the stored procedures be used to return values?
Can anyone please tell me how to use stored procedures in diadem and to return values from it. Its really important, can you please answer it at the earliest.
Thanks In advance
spiyaHi Spria,
I'm very sorry for the mix-up, I thought Allen was going to answer you back with the particulars that we found out. Check out the attached Word document and the below tidbits:
The built-in DIAdem ODBC functions {SQL_...()} can only call stored functions, which return a scaler result {found then in SQL_Result(1,1)}. The syntax for this with an ORACLE db is
"select function(parameters) from package"
...where package defaults to "dual" if you don't use your own package.
There might be exceptions to that though, and the syntax will be different for other databases. Note that stored ORACLE procedures can NOT be called from the ODBC functions, instead you must use either ADO function calls in the DIA
dem VBScript or the OO4O COM wrapper that ORACLE provides (this is described in further detail in the below Word document).
Hope this helps,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
Attachments:
Calling_ORACLE_Stored_Procedures_from_DIAdem.doc 28 KB -
[SOLVED] How to use return parameter of function as paramter of table?
Hi all,
As continue of post "ADF Faces: how to execute pl/sql function when page is loaded." I came up with an other problem where I can't find an easy solution for.
The problem is easy.
1) I execute a procedure, this returns a value
2) I have a table which needs one input parameter
3) How can I bind the return value of the procedure to the input paramter of the table:
A simple example:
1) I created a pl/sql function that returns 1
CREATE FUNCTION zz_return_1
is
RETURN NUMBER
BEGIN
RETURN 1
end;2) I exposed the function in my TestModule so I can use it on a jps page.
3) I created a table TEST_PARAM_1_TABLE with two columns: a, b
4) I created a view read-only object with one paramter
SELECT a,b
FROM zz_scn_test_tab
where a = :var_15) I added the view object to a jps page as tabe > adf read-only
6) I added a methodAction and invokeAction to execute the function on page load
<executables>
<iterator id="zzscntest1Iterator" RangeSize="10" Binds="zzscntest1"
DataControl="TestModuleDataControl"/>
<invokeAction id="runProc" Binds="ftn_return_1"/>
</executables>
<bindings>
<methodAction id="ftn_return_1"
InstanceName="TestModuleDataControl.dataProvider"
DataControl="TestModuleDataControl"
MethodName="ftn_return_1" RequiresUpdateModel="true"
Action="999" IsViewObjectMethod="false"
ReturnName="TestModuleDataControl.methodResults.TestModuleDataControl_dataProvider_ftn_return_1_result"/>
<table id="zzscntest1" IterBinding="zzscntest1Iterator">
<AttrNames>
<Item Value="A"/>
<Item Value="B"/>
</AttrNames>
</table>
</bindings>how can I bind the return value of the function to the var_1 variable of the table?
Additional to this: Is there a way to store the return value in a managed bean?
for example: if I create a managed bean:
public class globalVars {
private Number ftnReturnValue;
public globalVars() {
public void setFtnReturnValue(Number ftnReturnValue) {
System.out.println("return value is set to: " + ftnReturnValue);
this.ftnReturnValue = ftnReturnValue;
public Number getFtnReturnValue() {
return ftnReturnValue;
}how to store the return value in this ftnReturnValue variable?Thanks to Frank,
I finally got it to work!
For those with the same problem, this is what I did:
- I created a VO material_details with one parameter :sequence_num
- I created a master/detail viewlink from my materials list to the materials_details
- In the application module, I created a call to the procedure, and within this procedure, I set the sequence_num variable.
public Number f_ltf3_adf_syf_init(String reporting_group
, String username
, String RAG_code
, String ABC_class
, String SBU_code){
CallableStatement st = null;
String stmt = "M_LTF3_SFM_CALC.f_ltf3_adf_syf_init('"+ reporting_group
+"','"+ username
+"','"+ RAG_code
+"','"+ ABC_class
+"','"+ SBU_code+"')";
try {
// prepare the statement
st = getDBTransaction().createCallableStatement("begin ? := "+stmt+";end;",0);
st.registerOutParameter(1,2); // register output parameter as Number
//execute the statement
st.executeUpdate();
//set paramter in detail VO of master/view
getLtfSyfRevDetails1().setNamedWhereClauseParam("session_seq", (Number)st.getObject(1));
return (Number)st.getObject(1);
}catch (Exception e){e.printStackTrace();}
return null;
}
Maybe you are looking for
-
How to Pass parameter to Custom Scheduler dynamically
hi , I am new to OIM. Need your help in passing parameters dynamically to Custom Scheduler. I have created Custom Scheduler by extending Task Support. I have registered the plugin through API , using PlatformService.registerPlugin() method. As I need
-
Just uploaded my new software and my texts won't send. How do I fix this?
Why won't my texts send after uploading latest software? How do I fix this?
-
Itunes 7 + Win XP Pro (Recover from a serious error0
Everytime i turn on my PC I get this window telling me that windows has recovered from a serious error. The last blue screen I got was almost a week ago. I have done system retore to pre iTunes 7 and i continue to get this error. iTunes 7 is the only
-
Whenever I link a project to an external file or URL, when I run a course through an LMS and click the link that opens the file or website, it opens the linked content in the same page as the original course. Consequently, when I close the linked win
-
From a few days my monitor 19 " is like "colourless" after turn on G4, but when I start DivX the colour back OK. What it depend from? Claudio Powermac G4 AGP - 400 Hz Mac OS X (10.4.10) ATI Radeon 128 original card