Oracle cursor question
Hello,
When using cursors, is it the same thing if i issue:
cursor c is .....
r c%rowtype;
begin
for r in c loop .... end loop;or
loop
open c;
fetch c into r;
exit when c%NOTFOUND;
-- do some actions....
end loop;?
Or is it any difference?
Thanks
Edited by: Roger22 on 23.06.2010 10:59
user13165454 wrote:
I understand both are almost same process to iterate through the result set. One is iterating the cursor result set while the other one is using for loop iteration.There is no such thing as a "+cursor result set+" - this creates the illusion that a physical set of results are created by the cursor and the client is fetching rows from this data set.
Does not work like this. Where would such a result set lives? In database memory? What then about scalability? Such a result set can potentially contain millions of rows. A database server can be required to service 1000's of open cursors at the same time.
Such a result set approach cannot scale as it will make a huge demand on memory.
The results of a cursor is the output of a cursor. The cursor (the set instructions to find the relevant rows) are executed by the server. Rows are found. These are output. And the process repeats with each fetch where the cursor finds the next set of rows (based on Oracle multi version concurrency control model) to output to the client.
As for the difference between a FOR cursor loop and a FETCH cursor loop - simply one of implicit versus explicit cursor variable management. There is no difference in how the server-side SQL cursor is used.
E.g.
-- FETCH loop -- FOR loop
open c; for varBuffer in (...) -- cursor is implicitly opened
loop loop
fetch c into varBuffer; -- n.a. as the fetch is implicitly performed into the buffer variable "varBuffer"
exit when c%notfound; -- n.a. as loop will automatically terminated when %notfound
.. process .. .. process ..
end loop; end loop;
close c; -- n.a. as cursor is implictly closedWhich one is faster? Neither really. Both do the same things..
a) open a cursor on the Oracle server
b) fetch from the cursor
c) close the cursor
Whether that is implicitly or explicitly done, is irrelevant in terms of performance in this case.
What is important is how the cursor on the client side acts. The FOR loop does an implicit bulk collect of a 100 rows (10g and later). With the FETCH loop one needs to manually code the bulk collect. But there one has more flexibility as one can also use bulk processing (i.e. a FORALL DML). This is not possible in the FOR loop as it does not provide access to the implicit collection used for the bulk fetch.
On the Oracle side.. both will use the VERY SAME CURSOR for the same source SQL statement. It is important to note that "cursor performance" is not really relevant on the Oracle server side. Whether the client uses a ref cursor, DBMS_SQL cursor, implicit cursor, explicit cursors.. the Oracle server side does not know, does not need to know and does not care.
This is a client side method for interacting with the cursor in the server.. and how "fast" that interaction (e.g single fetch vs bulk fetch) is with the cursor on the server is a client issue.
Similar Messages
-
Passing contents of text file in oracle cursor
Hi,
I need to pass the content of text file in cursor and pass it on to calling codes. then calling codes will generate another text at their end. Can some help how can I pass contents of text file in oracle cursor? Thanksi need to do it without tables for some reasons.
-
Using Oracle CURSOR in SAP PI 7.0
Hi All,
I have a scenario in which I need to get the data from Oracle database using cursor, but I couldnu2019t find a direct method in PI to do the same using the JDBC sender channel.
Can anyone tell me how we can access Oracle cursors in SAP PI?
I have the work around like using temporary tables in the Oracle DB but I would like to know how we can use cursor
I am using SAP PI 7.0 EHP 1
Thanks in advanceu2026
Regards,
Manish AntonyHi Krish,
I need to retrieve more than one record at a time and the oracle stored procedure cannot return more than one record like SQL server. The way to get more than one record from Oracle Stored procedure is through cursors.
Also I may not be able to use standard query because I have a complex logic to retrieve the data (I need to get the data from multiple main tables and look up tables based on different conditions and also need to update the tables to avoid data duplication in the target system) which cannot be put in to the select and update statements in the communication channel.
Regards,
Manish Antony -
PI 7.0 SP 11 support oracle cursor ?
Hi
Does PI 7.0 SP 11 support oracle cursor ? Because i need to send multiple rows data to oracle store procedure.
Where do i have to search about the information how to call oracle store procedure with ref cursor input
Regards
FernandThank you Raj,
I manage to calling store procedure with normal input (single), but then still got problem to supply data to store proc with input CURSOR.
Base on link that you send me, i get this line out
"CURSOR (output; only in conjunction with the Oracle JDBC driver)." is it meaning that JDBC adapter does not support CURSOR for input ? even SP 11 ?
This is my sample oracle store procedure :
CREATE OR REPLACE PACKAGE DB2_PAYSLIP IS
CURSOR c_details IS SELECT '' in_nogaji
, '' in_jenis
, '' in_no
, '' in_deskripsi
, '' in_jumlah
FROM DUAL;
TYPE ct_details IS REF CURSOR RETURN c_details%ROWTYPE;
END;
CREATE OR REPLACE PROCEDURE proc_ins_payslip(in_cur IN OUT db2_payslip.ct_details) IS
v_in db2_payslip.c_details%ROWTYPE;
BEGIN
LOOP
FETCH in_cur INTO v_in;
INSERT INTO PAYSLIP_DETAIL VALUES(v_in.in_nogaji,v_in.in_jenis,v_in.in_no,v_in.in_deskripsi,v_in.in_jumlah);
EXIT WHEN in_cur%NOTFOUND;
END LOOP;
CLOSE in_cur;
COMMIT;
END;
Regards
Fernand -
Need oracle practice question for OCA
Need oracle practice question for OCA.
Edited by: 823938 on Dec 27, 2010 10:21 PMIt's illegal to use dumps.
Read the following link:
http://www.certguard.com/braindumps.asp -
Multiple Oracle Cursors in a function
Hello folks.
We are componentizing a good chunk of data wrangling,
stuffing the random-ish queries and stored procedures in to CFCs.
However, many of the Oracle procedures return more than one cursor
(resultset). I am a bit shaky on CFCs in general I am afraid! The
question is how do I return both result sets when we can only have
one cfreturn tag per function?
I am probably missing something obvious, wouldn't be the
first time!I got as far as putting a cursor and a single returned
variable in a structure, but ended up going a different direction
before trying 2 cursors. Hope this helps. -
Oracle/VB question - same newbie different question.
Hi,
I've just learned the magic that is getting VB to call stored procedures in Oracle - but now I have a question.
I have a procedure that runs through a table, this is the loop part :
loop
fetch staff_c into surname_str, first_str, salary_str;
exit when staff_c%notfound;
dbms_output.put_line('data ' || surname_str || ', ' || first_str || ' - ' || salary_str);
end loop;
close staff_c;
so my question is simply this, I'm using the following VB code to access a stored procedure which is passing a param in, and a param out -
Dim cmd As ADODB.Command
Dim conn As ADODB.Connection
Dim param As ADODB.Parameter
Set conn = New ADODB.Connection
conn.Open "dsn=PaulsRescueDB", "x", "y"
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "lang_count"
Set param = cmd.CreateParameter("@p_in", adVarChar, adParamInput, 10, "english")
cmd.Parameters.Append param
cmd.Execute
MsgBox cmd.Parameters(1).Value
conn.Close
what do I need to do in order to be able to treat the result of the stored procedure as a recordset - or am I mis-understanding something?
Thanks in advance,
Ed.Just in case anyone else out there was interested here's a brief summary of the solution.
First lets look at the stored procedure as this is where the first and most important point is to be seen:
create or replace package types
as
type cursorType is ref cursor;
end;
so we're creating a cursor type variable called cursortype, this is then used in the following code:
create or replace procedure getemps( p_in in varchar, p_cursor in out ref cursor
as
begin
open p_cursor for select surname, firstname
from staff
where initcap(p_in) = surname;
end;
It should be noted that a cursor is effectively an area of memory specific to your session that stores a result set, the cursor is treated as a variable/object.
In the case of the above code the cursor contains the result of the select statement.
You will also notice that the code opens the cursor with the contents of the select (this is because whenever you create an object it is null - unless you give it an initial value).
The variable P_In is a varchar (when defining a procedure you do not specify the size of an int or varchar) and p_cursor is the returned data.
I do not know why p_cursor is both in and out, out alone would have been the obvious choice.
So we now have a stored procedure that takes a parameter to pass to a select statement, does a search and then returns a resultset (cursor).
Now to answer the original question, how do you use this in VB?
The code below illustrates (ADO):
Dim cmd As ADODB.Command
Dim conn As ADODB.Connection
Dim param As ADODB.Parameter
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
conn.Open "dsn=PaulsRescueDB", "x", "y"
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "getemps"
Set param = cmd.CreateParameter("@p_in", adVarChar, adParamInput, 10, "foghorn")
cmd.Parameters.Append param
Set rs = cmd.Execute
While Not rs.EOF
Debug.Print (rs.Fields(1).Value & " " & rs.Fields(0).Value)
rs.MoveNext
Wend
conn.Close
As you can see I am manually creating an ADODB object, specifying that the commandtype is a stored procedure and then appending a parameter to the command text.
You will also notice that although the cursor is the second parameter in the stored procedure I do not specify it directly but rather assign the ADO recordset object as the result of the ADO command execution.
Once I've done this I merely use the recordset as a normal recordset object.
CREDITS:
The stored procedure is based on the one supplied by Jens Link in the previous post.
The VB is a hijacked piece of ASP code modfied for VB.
If this helps anyone else out there besides me then I'm happy to have been able to give something back to the community that has helped me.
Ed. -
Oracle/VB question - newbie
Hi,
I've just learned the magic that is getting VB to call stored procedures in Oracle - but now I have a question.
I have a procedure that runs through a table, this is the loop part :
loop
fetch staff_c into surname_str, first_str, salary_str;
exit when staff_c%notfound;
dbms_output.put_line('data ' || surname_str || ', ' || first_str || ' - ' || salary_str);
end loop;
close staff_c;
so my question is simply this, I'm using the following VB code to access a stored procedure which is passing a param in, and a param out -
Dim cmd As ADODB.Command
Dim conn As ADODB.Connection
Dim param As ADODB.Parameter
Set conn = New ADODB.Connection
conn.Open "dsn=PaulsRescueDB", "x", "y"
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "lang_count"
Set param = cmd.CreateParameter("@p_in", adVarChar, adParamInput, 10, "english")
cmd.Parameters.Append param
cmd.Execute
MsgBox cmd.Parameters(1).Value
conn.Close
what do I need to do in order to be able to treat the result of the stored procedure as a recordset - or am I mis-understanding something?
Thanks in advance,
Ed.Hmm. Your question looks like it should have been posted to the SQL/PLSQL forum, or the Technology-Windows-ODBC forum, but I'll try to answer your question anyway.
If you use the Oracle ODBC driver, your procedure needs to return a ref cursor. If you use the Microsoft ODBC driver, you need to return mutliple arrays and synthesis a record set with some special syntax . . .
http://msdn.microsoft.com/library/en-us/odbc/htm/odbcoraclereturning_array_parameters_from_stored_procedures.asp
If you use the oracle odbc driver, you can use this sample code from metalink . . .
Doc ID: Note:73756.1
Subject: Example: Calling Stored Procedures from ADO and returning a ResultSet (SCR 910)
Type: SCRIPT
Status: PUBLISHED
Content Type: TEXT/PLAIN
Creation Date: 18-AUG-1999
Last Revision Date: 08-DEC-2000
Overview
This article contains a Visual Basic (VB) Program that demonstrates how to
call Oracle Stored Procedures and retrieve resultsets using Ref Cursors with
the 8.0.5.6 Oracle ODBC Driver. This example code is intended for VB
Developers using ADO who wish to call Stored Procedures either inside or
outside of Packages.
Program Notes
The code in this article was tested using the following software:
o Visual Basic Version 6 Service Pack 3 with Microsoft Activex Data
Objects Library Version 2.1
o Microsoft ODBC Driver Manager Version 3.510.3711.0
o Oracle ODBC Driver for Oracle Version 8.0.5.6 and 8.1.5.4
Note: This program does not work with ODBC Driver Version 8.0.5.0
to 8.0.5.5 (BUG:883528) or when connected to a Version 7
Database (BUG:994719).
To use the program:
o Create a standard exe.
o Ensure using Project -> References that you have loaded the
Microsoft ActiveX Data Objects 2.1 Library.
o Add a button named STProc and associate the code below with it.
References
Append and CreateParameter Methods section of MS ADO Help
[BUG:883528] ORACLE ODBC DRIVERS DO NOT WORK WITH MICROSOFT ADO FUNTIONALITY
[BUG:994719] CALLING STORED PROCEDURES WITH REF CURSOR PARAMETERS DOES NOT WORK VS. V 7 DBASE
Caution
The sample program in this article is provided for educational purposes only
and is NOT supported by Oracle Support Services. It has been tested
internally, however, and works as documented. We do not guarantee that it
will work for you, so be sure to test it in your environment before relying
on it.
Program
Private Sub STProc_Click()
' This example code demonstrates calling packaged procedures
' from ADO and also returning result sets from them
' This code was tested using the following software:
' Visual Basic Version 6 Service Pack 3 with
' Microsoft Activex Data Objects Library Version 2.1
' Microsoft ODBC Driver Manager Version 3.510.3711.0
' Oracle ODBC Driver for Oracle Version 8.0.5.6 and 8.1.5.4
' (NOTE: that this does not work with ODBC Driver Version 8.0.5.0
' to 8.0.5.5 (bug 883528)
' or when connected to a Version 7 Database (Bug 994719)
' Error Message:
' Run-Time Error -2147467259(80004005)':
' ORA-6550 - PLS-00306 wrong number or types of argument in call
' to 'GETEMPS' )
' Oracle Database Version 8.0.5.1
' The Command to create the packaged procedure (under the SCOTT schema) is
'create or replace package adotst as
'type empcur is ref cursor;
'procedure getemps(vdeptno in number,vcount out number,ecur out empcur);
'end adotst;
'create or replace package body adotst as
'procedure getemps(vdeptno in number,vcount out number,ecur out empcur) is
'begin
' select count(*) into vcount from emp where
' deptno = vdeptno;
' open ecur for select ename from emp
' where deptno = vdeptno;
'end getemps;
'end adotst;
Dim cnn1 As ADODB.Connection
Dim cmdExeproc As ADODB.Command
Dim prmDeptno As ADODB.Parameter
Dim prmECount As ADODB.Parameter
Dim rstEmps As ADODB.Recordset
Dim intDeptno As Integer
Dim strEname As String
Dim strCnn As String
' Open connection.
Set cnn1 = New ADODB.Connection
' Modify the following line to reflect a DSN within your environment
strCnn = "DSN=W805; UID=scott; PWD=tiger;"
cnn1.Open strCnn
cnn1.CursorLocation = adUseClient
' Open command object with one parameter.
Set cmdExeproc = New ADODB.Command
' Note that this has been tested using
' cmdExeproc.CommandText = "scott.adotst.GetEmps"
' which also works
cmdExeproc.CommandText = "adotst.GetEmps"
cmdExeproc.CommandType = adCmdStoredProc
' Get parameter value and append parameter.
intDeptno = Trim(InputBox("Enter Department:"))
Set prmDeptno = cmdExeproc.CreateParameter("vdeptno", _
adInteger, adParamInput)
Set prmECount = cmdExeproc.CreateParameter("vcount", _
adInteger, adParamOutput)
cmdExeproc.Parameters.Append prmDeptno
prmDeptno.Value = intDeptno
cmdExeproc.Parameters.Append prmECount
' Create recordset by executing the command.
' NOTE: if no resultset is being returned execute the stroed procedure
' using cmdExeproc.Execute on it's own
Set cmdExeproc.ActiveConnection = cnn1
Set rstEmps = cmdExeproc.Execute
' Build stirng to be displayed with information returned
strEname = "The " & prmECount.Value & _
" Employees in Department " & intDeptno & " are :"
Do While Not rstEmps.EOF
strEname = strEname & " " & rstEmps!ename & ","
rstEmps.MoveNext
Loop
MsgBox (strEname)
' Close resultsets and log off
rstEmps.Close
cnn1.Close
End Sub
Copyright (c) 1995,2000 Oracle Corporation. All Rights Reserved. Legal Notices and Terms of Use. -
Convert oracle cursor statements along with validations to XML
Hi Gurus/Odie,
I've one current in pl/sql report which is generating output as text format, but users are expecting to see the same output in excel format. In oracle apps we can generate XML tags and those tags can be produced to template so as to generate them in excel file.
My current procedure as shown below.Currently it is displaying output in one line concatenating all the data. But i want keep the same logic like that and change into xml tags. How can we do that. Please provide me your valueable inputs in this regard.
CREATE OR REPLACE PROCEDURE APPS.ACCTALS (
errbuf OUT VARCHAR2,
retcode OUT NUMBER,
p_st_date IN VARCHAR2,
p_end_date IN VARCHAR2,
p_set_of_book IN NUMBER,
p_chart_of_acnt IN NUMBER,
p_min_flex IN VARCHAR2,
p_max_flex IN VARCHAR2,
p_transaction_type IN VARCHAR2
IS
TYPE flex_tbl_type IS TABLE OF VARCHAR2 (10)
INDEX BY BINARY_INTEGER;
CURSOR c_acct (
p_period_num_low NUMBER,
p_period_num_high NUMBER,
p_min_flex_tbl flex_tbl_type,
p_max_flex_tbl flex_tbl_type
IS
SELECT gjh.period_name period_name,
sat.user_je_source_name SOURCE,
cat.user_je_category_name CATEGORY,gjb.NAME batch_name,
gjh.NAME journal_name, gcc.segment1, gcc.segment2, gcc.segment3,
gcc.segment4, gcc.segment5, gcc.segment6, gcc.segment7,
gcc.segment8, gjl.je_line_num,
gjl.description je_line_description, gjl.reference_1 party_name,
(SELECT pv.segment1
FROM ap_invoices_all aia, po_vendors pv
WHERE aia.invoice_id =TO_NUMBER(DECODE(NVL(LENGTH(LTRIM (TRANSLATE (gjl.reference_2,'1234567890','3'),'3')),0),0, TO_NUMBER (gjl.reference_2),-999))
AND pv.vendor_id = aia.vendor_id) party_number,
NULL trx_number, -- invoice_num,
NULL trx_line_number, -- invoice_line_num,
CASE
WHEN gjh.je_category = 'Purchase Invoices'
THEN (SELECT pha.segment1
FROM apps.ap_invoice_distributions_all aid,
apps.po_headers_all pha,
apps.po_lines_all pla,
apps.po_distributions_all pda
WHERE aid.po_distribution_id =
pda.po_distribution_id
AND pda.po_line_id = pla.po_line_id
AND pla.po_header_id = pha.po_header_id
AND aid.invoice_id = TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3))
ELSE ''
END po_number,
CASE
WHEN gjh.je_category = 'Purchase Invoices'
AND gjl.reference_3 IS NOT NULL
THEN (SELECT pla.line_num
FROM apps.ap_invoice_distributions_all aid,
apps.po_headers_all pha,
apps.po_lines_all pla,
apps.po_distributions_all pda
WHERE aid.po_distribution_id =
pda.po_distribution_id
AND pda.po_line_id = pla.po_line_id
AND pla.po_header_id = pha.po_header_id
AND aid.invoice_id = TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3))
ELSE TO_NUMBER ('')
END po_line,
CASE
WHEN gjh.je_category = 'Purchase Invoices'
AND gjl.reference_3 IS NOT NULL
THEN (SELECT mc.segment1
FROM apps.ap_invoice_distributions_all aid,
apps.po_headers_all pha,
apps.po_lines_all pla,
apps.po_distributions_all pda,
apps.mtl_categories mc
WHERE aid.po_distribution_id =
pda.po_distribution_id
AND pda.po_line_id = pla.po_line_id
AND mc.category_id = pla.category_id
AND pla.po_header_id = pha.po_header_id
AND aid.invoice_id = TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3))
ELSE ''
END po_category,
gjl.accounted_dr debit, gjl.accounted_cr credit,
NVL (gjl.accounted_dr, 0) - NVL (gjl.accounted_cr, 0)
net_amount,
-- Added by Murali for bug 10405
gjh.currency_code entered_currency,
gjl.entered_dr entered_debit, gjl.entered_cr entered_credit,
NVL (gjl.entered_dr, 0)
- NVL (gjl.entered_cr, 0) net_entered_amount,
gjl.attribute1 bank_account_number,
gjl.attribute2 bank_account_name,
gjl.attribute3 it2_nl_posting_ref,
gjl.attribute4 bank_transaction_date,
gjl.attribute5 it2_transaction_number,
gjl.attribute6 funds_subtype_name,
CASE
WHEN gjh.je_category = 'Purchase Invoices'
THEN
CASE
WHEN (SELECT NVL (aid.po_distribution_id,-999)
FROM ap_invoice_distributions_all aid
WHERE aid.invoice_id =TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3)) =
-999
THEN
(SELECT aia.attribute5
FROM apps.ap_invoices_all aia
WHERE aia.invoice_id =
TO_NUMBER(DECODE(NVL(LENGTH(LTRIM(TRANSLATE(gjl.reference_2,'1234567890','3'),'3')),0),0, TO_NUMBER(gjl.reference_2),-999))
AND ROWNUM = 1)
ELSE
--For PO Matched Invoice ,Pickup Proj code from PO header project DFF
(SELECT pha.attribute1
FROM apps.ap_invoice_distributions_all aid,
apps.po_headers_all pha,
apps.po_lines_all pla,
apps.po_distributions_all pda
WHERE aid.po_distribution_id = pda.po_distribution_id
AND pda.po_line_id = pla.po_line_id
AND pla.po_header_id = pha.po_header_id
AND aid.invoice_id = TO_NUMBER (gjl.reference_2)
AND aid.distribution_line_number =
TO_NUMBER (gjl.reference_3)
AND ROWNUM = 1)
END
ELSE
-- Invoice (Header) is not PO-Matched, so pickup Proj Code from invoice DFF --CHG0030444
(SELECT aia.attribute5
FROM apps.ap_invoices_all aia
WHERE aia.invoice_id =TO_NUMBER(DECODE(NVL(LENGTH(LTRIM (TRANSLATE (gjl.reference_2,'1234567890','3'),'3')),0),0, TO_NUMBER (gjl.reference_2),-999))
AND ROWNUM = 1)
END proj_code,
gjh.posted_date post_date, gjl.effective_date gl_date,
DECODE (gjh.je_category,
'Purchase Invoices', 'AP Invoice',
'Payments', 'AP Payment'
) transaction_class,
gjl.reference_3, gjl.reference_4, gjl.reference_5,
gjl.reference_1, gjl.reference_7,
gjl.attribute7, gjl.attribute8,
gjl.attribute9
FROM apps.gl_code_combinations gcc,
apps.gl_je_lines gjl,
apps.gl_je_headers gjh,
apps.gl_je_batches gjb,
apps.gl_period_statuses per,
apps.gl_je_categories_tl cat, -- Added by Murali for Bug 10405
apps.gl_je_sources_tl sat -- Added by Murali for Bug 10405
WHERE gcc.segment1 >= p_min_flex_tbl (1)
AND gcc.segment1 <= p_max_flex_tbl (1)
AND gcc.segment2 >= p_min_flex_tbl (2)
AND gcc.segment2 <= p_max_flex_tbl (2)
AND gcc.segment3 >= p_min_flex_tbl (3)
AND gcc.segment3 <= p_max_flex_tbl (3)
AND gcc.segment4 >= p_min_flex_tbl (4)
AND gcc.segment4 <= p_max_flex_tbl (4)
AND gcc.segment5 >= p_min_flex_tbl (5)
AND gcc.segment5 <= p_max_flex_tbl (5)
AND gcc.segment6 >= p_min_flex_tbl (6)
AND gcc.segment6 <= p_max_flex_tbl (6)
AND gjl.set_of_books_id = NVL (p_set_of_book, 1001)
AND per.effective_period_num BETWEEN p_period_num_low
AND p_period_num_high
AND gjl.code_combination_id = gcc.code_combination_id
AND gjl.status || '' = 'P'
AND gjb.average_journal_flag = 'N'
AND gjh.actual_flag =
DECODE (p_transaction_type,
'Actual', 'A',
'Budget', 'B',
gjh.actual_flag
AND gjh.je_header_id = gjl.je_header_id
AND gjb.je_batch_id = gjh.je_batch_id
AND per.application_id = 101
AND per.set_of_books_id = gjl.set_of_books_id
AND per.period_name = gjl.period_name
AND gjh.period_name = gjl.period_name
AND per.period_name = gjb.default_period_name
AND gjb.set_of_books_id = per.set_of_books_id
AND gjh.je_source = 'Payables'
AND cat.je_category_name = gjh.je_category
AND cat.LANGUAGE = 'US'
AND sat.je_source_name = gjh.je_source
AND sat.LANGUAGE = 'US'
main_rec c_acct%ROWTYPE;
l_min_flex_tbl flex_tbl_type;
l_max_flex_tbl flex_tbl_type;
l_min_flex VARCHAR2 (100);
l_max_flex VARCHAR2 (100);
min_flex_count NUMBER;
max_flex_count NUMBER;
i NUMBER;
v_display_str VARCHAR2 (1000);
v_header_str VARCHAR2 (1000);
l_proj_code VARCHAR2 (240);
rf_period_cur sys_refcursor;
l_period_num_low NUMBER := '';
l_period_num_high NUMBER := '';
-- l_vendor_name varchar2(1000);
l_party_name VARCHAR2 (1000);
l_party_number VARCHAR2 (1000);
l_trx_number VARCHAR2 (1000);
l_trx_line_number VARCHAR2 (50);
--Added by Bharat.K for CHG0035496
l_contract_number VARCHAR2 (30);
l_contract_modified VARCHAR2 (30);
l_order_number VARCHAR2 (30);
l_statement_date VARCHAR2 (30);
l_billed_from VARCHAR2 (30);
l_billed_to VARCHAR2 (30);
l_start_date VARCHAR2 (30);
l_reference_number VARCHAR2 (30);
BEGIN
fnd_file.put_line (fnd_file.LOG, 'set of book id: ' || p_set_of_book);
l_min_flex := p_min_flex;
i := 1;
LOOP
IF INSTR (l_min_flex, '-') = 0
THEN
EXIT;
END IF;
l_min_flex_tbl (i) := SUBSTR (l_min_flex, 1, INSTR (l_min_flex, '-') - 1);
l_min_flex :=SUBSTR (l_min_flex,INSTR (l_min_flex, '-') + 1,LENGTH (l_min_flex) - INSTR (l_min_flex, '-'));
i := i + 1;
END LOOP;
l_min_flex_tbl (i) := l_min_flex;
min_flex_count := i;
l_max_flex := p_max_flex;
i := 1;
LOOP
IF INSTR (l_max_flex, '-') = 0
THEN
EXIT;
END IF;
l_max_flex_tbl (i) := SUBSTR (l_max_flex, 1, INSTR (l_max_flex, '-') - 1);
l_max_flex :=SUBSTR (l_max_flex,INSTR (l_max_flex, '-') + 1,LENGTH (l_max_flex) - INSTR (l_max_flex, '-'));
i := i + 1;
END LOOP;
l_max_flex_tbl (i) := l_max_flex;
max_flex_count := i;
v_header_str := '';
v_header_str :=
'Period'|| '^'|| 'Source'|| '^'|| 'Category'|| '^'|| 'Batch Name'|| '^'|| 'Journal Name'|| '^'|| 'Company'|| '^'|| 'IBX'|| '^'|| 'Dept'|| '^'|| 'Account'
|| '^'|| 'Intercompany'|| '^'|| 'Product'|| '^'|| 'Future2'|| '^'|| 'Future3'|| '^'|| 'JE Line Num'|| '^'|| 'Description'|| '^'|| 'GL Date'|| '^'|| 'GL Post Date'
|| '^'|| 'Party Name'|| '^'|| 'Party Number'|| '^'|| 'Transaction Class'|| '^'|| 'Transaction Number'|| '^'|| 'Transaction Line Number' --bug#9819
|| '^'|| 'PO Number'|| '^'|| 'PO Line Num'|| '^'|| 'PO Category'|| '^'|| 'Project Code'|| '^'|| 'Converted Debit'|| '^'|| 'Converted Credit'
|| '^'|| 'Converted Net Amount (Dr - Cr)'|| '^'|| 'Entered Currency'|| '^'|| 'Entered Debit'|| '^'|| 'Entered Credit'|| '^'
|| 'Entered Net Amount (Dr - Cr)'|| '^'|| 'BANK ACCOUNT NUMBER'|| '^'|| 'BANK ACCOUNT NAME'|| '^'
|| 'IT2 NL POSTING REF'|| '^'|| 'BANK TRANSACTION DATE'|| '^'|| 'IT2 TRANSACTION NUMBER'|| '^'|| 'FUNDS SUBTYPE NAME'|| '^'
|| 'PCard Merchant Name'|| '^'|| 'PCard Posting Date'|| '^'|| 'PCard Transaction Date'|| '^'|| 'Contract Number'
|| '^'|| 'Contract Modified Number'|| '^'|| 'Order Number'|| '^'|| 'Statement Date'|| '^'|| 'Billed From'
|| '^'|| 'Billed To'|| '^'|| 'Start Date'|| '^'|| 'Reference Number';
fnd_file.put_line (fnd_file.output, v_header_str);
fnd_file.put_line (fnd_file.LOG, 'get effective period number');
OPEN rf_period_cur FOR
SELECT MIN (effective_period_num), MAX (effective_period_num)
FROM gl_period_statuses
WHERE start_date >= fnd_date.canonical_to_date (p_st_date)
AND end_date <= fnd_date.canonical_to_date (p_end_date)
AND set_of_books_id = p_set_of_book
AND application_id = 101;
FETCH rf_period_cur
INTO l_period_num_low, l_period_num_high;
CLOSE rf_period_cur;
IF l_period_num_low IS NOT NULL AND l_period_num_high IS NOT NULL
THEN
fnd_file.put_line (fnd_file.LOG,'effective period number low: '|| l_period_num_low|| ' period number high: '|| l_period_num_high);
i := 0;
OPEN c_acct (l_period_num_low,l_period_num_high,l_min_flex_tbl,l_max_flex_tbl);
LOOP
FETCH c_acct
INTO main_rec;
EXIT WHEN c_acct%NOTFOUND;
l_contract_number := NULL;
l_contract_modified := NULL;
l_order_number := NULL;
l_statement_date := NULL;
l_billed_from := NULL;
l_billed_to := NULL;
l_start_date := NULL;
l_reference_number := NULL;
--Do All the Processing for customer number and customer name--bug#9819
IF main_rec.CATEGORY = 'Adjustment'
THEN
BEGIN
SELECT hp.party_name, rc.account_number
INTO l_party_name, l_party_number
FROM ar_adjustments_all adj,
ra_customer_trx_all trx,
-- ra_customers rc
hz_cust_accounts rc,
hz_parties hp
WHERE adj.customer_trx_id = trx.customer_trx_id
AND trx.bill_to_customer_id = rc.cust_account_id
AND rc.party_id = hp.party_id
AND trx.set_of_books_id = NVL (p_set_of_book, 1001)
AND adj.adjustment_number = main_rec.reference_5;
EXCEPTION
WHEN OTHERS
THEN
l_party_name := NULL;
l_party_number := NULL;
END;
ELSIF main_rec.SOURCE = 'Payables'
THEN
l_party_name := main_rec.reference_1;
BEGIN
SELECT segment1
INTO l_party_number
FROM po_vendors
WHERE UPPER (vendor_name) = UPPER (l_party_name);
EXCEPTION
WHEN OTHERS
THEN
l_party_number := NULL;
END;
ELSIF main_rec.CATEGORY = 'Payments'
THEN
BEGIN
SELECT pv.vendor_name, pv.segment1
INTO l_party_name, l_party_number
FROM ap_checks_all ac, po_vendors pv
WHERE pv.vendor_id = ac.vendor_id
AND ac.check_id = main_rec.reference_3;
EXCEPTION
WHEN OTHERS
THEN
l_party_name := NULL;
l_party_number := NULL;
END;
-- Commented End for Bug 10405
ELSIF ( main_rec.CATEGORY = 'Debit Memos'
OR main_rec.CATEGORY = 'Credit Memos'
OR main_rec.CATEGORY = 'Sales Invoices'
THEN
BEGIN
SELECT hp.party_name, rc.account_number
INTO l_party_name, l_party_number
FROM apps.ra_cust_trx_line_gl_dist_all dist,
-- apps.ra_customer_trx_lines_all line,
apps.ra_customer_trx_all trx,
-- apps.ra_customers rc
apps.hz_cust_accounts rc,
hz_parties hp -- /*bug#7534 */
WHERE cust_trx_line_gl_dist_id = main_rec.reference_3
--and dist.CUSTOMER_TRX_LINE_ID=line.CUSTOMER_TRX_LINE_ID
AND trx.customer_trx_id = dist.customer_trx_id
AND trx.bill_to_customer_id = rc.cust_account_id
AND rc.party_id = hp.party_id
AND trx.set_of_books_id = NVL (p_set_of_book, 1001);
EXCEPTION
WHEN OTHERS
THEN
l_party_name := NULL;
l_party_number := NULL;
l_reference_number := NULL;
END;
ELSIF ( main_rec.CATEGORY = 'Misc Receipts'
OR main_rec.CATEGORY = 'Trade Receipts'
THEN
BEGIN
SELECT hp.party_name, hca.account_number
INTO l_party_name, l_party_number
FROM hz_parties hp, hz_cust_accounts hca
WHERE hp.party_id = hca.party_id
AND hca.cust_account_id = main_rec.reference_7;
EXCEPTION
WHEN OTHERS
THEN
l_party_name := NULL;
l_party_number := NULL;
END;
ELSE
l_party_name := main_rec.party_name;
l_party_number := main_rec.party_number;
l_reference_number := NULL;
END IF;
IF main_rec.SOURCE = 'Receivables' THEN
IF ( main_rec.CATEGORY = 'Debit Memos'
OR main_rec.CATEGORY = 'Credit Memos'
OR main_rec.CATEGORY = 'Sales Invoices'
THEN
BEGIN
SELECT DECODE (line.interface_line_context,
'OKS CONTRACTS', line.interface_line_attribute1, 'EQIX METERED POWER',line.interface_line_attribute3,
NULL
) contract_number,
DECODE (line.interface_line_context,
'OKS CONTRACTS', line.interface_line_attribute2,
NULL
) contract_modified,
DECODE (line.interface_line_context,
'ORDER ENTRY', line.interface_line_attribute1,
NULL
) order#,
(SELECT aci.cut_off_date
FROM apps.ar_cons_inv_all aci,
(SELECT DISTINCT customer_trx_id, cons_inv_id
FROM apps.ar_cons_inv_trx_lines_all) acit
WHERE aci.cons_inv_id = acit.cons_inv_id
AND dist.customer_trx_id = acit.customer_trx_id)
statement_date,
CASE line.interface_line_context
when 'OKS CONTRACTS' then
TO_CHAR
(TO_DATE (line.interface_line_attribute4,'YYYY/MM/DD' ),
'DD-MON-YYYY')
when 'EQIX METERED POWER' then line.interface_line_attribute4
else null
end as billed_from,
CASE line.interface_line_context
when 'OKS CONTRACTS' then
TO_CHAR
(TO_DATE (line.interface_line_attribute5,'YYYY/MM/DD' ),
'DD-MON-YYYY')
when 'EQIX METERED POWER' then line.interface_line_attribute5
else null
end as billed_to,
TO_CHAR(TO_DATE (DECODE (line.interface_line_context, 'OKS CONTRACTS', line.interface_line_attribute8, NULL ),'YYYY/MM/DD'),'DD-MON-YYYY') start_date
INTO l_contract_number,
l_contract_modified,
l_order_number,
l_statement_date,
l_billed_from,
l_billed_to,
l_start_date
FROM
apps.ra_customer_trx_all trx,
ra_customer_trx_lines_all line,
apps.ra_cust_trx_line_gl_dist_all dist,
apps.hz_cust_accounts rc,
hz_parties hp
WHERE cust_trx_line_gl_dist_id = main_rec.reference_3
AND trx.customer_trx_id = line.customer_trx_id
AND dist.customer_trx_line_id=line.customer_trx_line_id
AND trx.bill_to_customer_id = rc.cust_account_id
AND rc.party_id = hp.party_id
AND trx.set_of_books_id = NVL (p_set_of_book, 1001)
AND line.line_type = 'LINE';
EXCEPTION
WHEN OTHERS
THEN
l_contract_number := NULL;
l_contract_modified := NULL;
l_order_number := NULL;
l_statement_date := NULL;
l_billed_from := NULL;
l_billed_to := NULL;
l_start_date := NULL;
END;
END IF;
END IF;
--do processing to get line number , trx_number
IF ( main_rec.CATEGORY = 'Debit Memos'
OR main_rec.CATEGORY = 'Credit Memos'
OR main_rec.CATEGORY = 'Sales Invoices'
THEN
BEGIN
SELECT TO_CHAR (line_number), line.interface_line_attribute1
INTO l_trx_line_number, l_reference_number
FROM ra_cust_trx_line_gl_dist_all dist,
ra_customer_trx_lines_all line,
ra_customer_trx_all trx
WHERE cust_trx_line_gl_dist_id = main_rec.reference_3
AND dist.customer_trx_line_id = line.customer_trx_line_id
AND trx.customer_trx_id = line.customer_trx_id;
EXCEPTION
WHEN OTHERS
THEN
l_trx_line_number := NULL;
END;
l_trx_number := main_rec.reference_4;
ELSIF ( main_rec.CATEGORY = 'Misc Receipts'
OR main_rec.CATEGORY = 'Trade Receipts'
THEN
l_trx_number := main_rec.reference_4;
l_trx_line_number := NULL;
ELSIF main_rec.CATEGORY = 'Adjustment'
THEN
l_trx_number := main_rec.reference_5;
l_trx_line_number := NULL;
ELSIF main_rec.CATEGORY = 'Purchase Invoices'
THEN
l_trx_number := main_rec.reference_5;
l_trx_line_number := main_rec.reference_3;
ELSIF main_rec.CATEGORY = 'Payments'
THEN
--l_trx_number:=main_rec.reference_3;
l_trx_number := main_rec.reference_4;
-- change by dody CHG0030444
l_trx_line_number := NULL;
ELSE
l_trx_number := main_rec.trx_number;
l_trx_line_number := main_rec.trx_line_number;
END IF;
v_display_str :=
main_rec.period_name| '^'|| main_rec.SOURCE|| '^'|| main_rec.CATEGORY|| '^'|| main_rec.batch_name|| '^'|| main_rec.journal_name
|| '^'|| main_rec.segment1|| '^'|| main_rec.segment2|| '^'|| main_rec.segment3|| '^'|| main_rec.segment4|| '^'|| main_rec.segment5
|| '^'|| main_rec.segment6|| '^'|| main_rec.segment7|| '^'|| main_rec.segment8|| '^'| main_rec.je_line_num|| '^'|| main_rec.je_line_description
|| '^'|| main_rec.gl_date|| '^'|| main_rec.post_date|| '^'|| l_party_name|| '^'|| l_party_number|| '^'|| main_rec.transaction_class
|| '^'|| l_trx_number|| '^'|| l_trx_line_number|| '^'|| main_rec.po_number|| '^'|| main_rec.po_line|| '^'|| main_rec.po_category --Added for Bug # 11741
|| '^'|| main_rec.proj_code|| '^'|| main_rec.debit|| '^'|| main_rec.credit|| '^'|| main_rec.net_amount|| '^'|| main_rec.entered_currency
|| '^'|| main_rec.entered_debit|| '^'|| main_rec.entered_credit|| '^'|| main_rec.net_entered_amount|| '^'|| main_rec.bank_account_number
|| '^'|| main_rec.bank_account_name|| '^'|| main_rec.it2_nl_posting_ref|| '^'|| main_rec.bank_transaction_date|| '^'|| main_rec.it2_transaction_number
|| '^'|| main_rec.funds_subtype_name| '^'|| main_rec.attribute7|| '^'|| main_rec.attribute8|| '^'|| main_rec.attribute9|| '^'
|| l_contract_number|| '^'|| l_contract_modified|| '^'|| l_order_number|| '^'|| l_statement_date
|| '^'|| l_billed_from|| '^'|| l_billed_to|| '^'|| l_start_date|| '^'|| l_reference_number;
i := i + 1;
fnd_file.put_line (fnd_file.output, v_display_str);
END LOOP;
CLOSE c_acct;
ELSE
END IF;
EXCEPTION
WHEN OTHERS THEN
fnd_file.put_line (fnd_file.LOG, 'account analysis process error out - ' || SQLERRM );
retcode := 2;
errbuf := SUBSTR (SQLERRM, 1, 120);
RAISE;
END ACCTALS;
/Thanks in advance,
Nag
Edited by: 838961 on Apr 12, 2013 1:29 AM
Edited by: 838961 on Apr 12, 2013 2:02 AMYou are probably looking for the SQL/XML functions that have been in Oracle for several major releases now. Here is the latest Oracle documentation on them
[url http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb13gen.htm]Generating XML Data from the Database
You can also find some examples at [url http://www.oracle-base.com/articles/misc/sqlxml-sqlx-generating-xml-content-using-sql.php]SQL/XML (SQLX) : Generating XML using SQL in Oracle. There are plenty of examples on the forums and web in general.
Note: It is a lower case "code" in your formatting tags, not "CODE" -
Multiple Oracle Configuration Question
We have a typical environment setup. I will explain it below:
Our application works in Online and Offline Mode. For Online mode we connect to Oracle 10g enterprise server and a Local instance of Access and In offline application totally works in Access.
Now we want to move away from Access and have Oracle PE instead just because we want to use stored procedure and same set of code for offline and online processing.
So a typical user machine will have a PE instance and a Oracle Client. Currently we use LDAP.ora for Configuring connections. Now i have few questions
1. How do we ensure that Oracle PE will work when we don't have network connection. Can we have like PE setup with Tnsnames.ORA
2. What can be the smallest possible package for PE.
3. Can I use one client to access both PE and Server databases.
Any help will be highly appreciated.
Thanks in advance.Assuming the "Xcopy installation" refers to using the Windows xcopy command, can you clarify what, exactly, you are installing via xcopy? Are you just using xcopy to copy the ODP.Net bits? Or are you trying to install the Oracle client via that approach?
If you are concerned about support, you would generally want to install everything via the Oracle Universal Installer (barring those very occasional components that don't use the OUI). Oracle generally only supports software installed via the installer because particularly on Windows, there are a number of registry entries that need to get created.
You can certainly do a custom install of the personal edition on the end user machines. There are a few required components that I believe have to be installed (that the installer will take care of). I assume your customization will take the form of a response file to the OUI in order to do a silent install?
Justin -
Hi
I have a multi-tab form and in the first tab block (B1) one of the field's values is used to populate an NBT field in another multi-record tab block (B2). When tab B2 fields are filled in, the last value is populated automatically with the value from B1. I had thought that if the value in B1 is subsequently changed then I would like the form, in B2, to update the field(s) (if any) with the new value input in B1.
DB relation is B1 parent, B2 child.
I thought the best option would be to use a cursor to loop through the records in B2 when:
B1 field's system record status is 'CHANGED'
And PK(s) in B2 are present i.e. records are present and need updated.
So i've not really get much experience using cursors so thought this would be ideal opportunity to learn it. I created the following cursor:
IF :system.record_status = 'CHANGED' AND :B2.ID IS NOT NULL THEN
DECLARE
v_mod_id NUMBER := :B2.FK; --variable used for join condition in cursor
v_cvs_val VARCHAR2(100) := :B1.UpdatedValue; Passes updated B1 value into variable so it can be used to update B2
CURSOR c_cvs IS
SELECT B2_PK, B2_current_val --Current value to be updated
FROM B2 table
WHERE B2_FK = v_mod_id;
B2_Table_rec c_cvs%ROWTYPE; --declares record of cursor type
BEGIN
OPEN c_cvs;
LOOP
FETCH c_cvs INTO B2_Table_rec;
EXIT WHEN c_cvs%NOTFOUND;
:B2.field_requiring_B1updatedValue := v_cvs_val; Passes updated value into --each field in the block B2
END LOOP;
CLOSE c_cvs;
END;
END IF;
What I am a bit confused about is what trigger to use this in. I have used it in when validate item in B1, so when I update value the cursor should go through the records in B2 to update them, and it does, but only does it once, and only does it to the record in B2 that I left focus in; so if I was on row 2 in B2 and went and changed value in B1 it would only update row 2 in B2.
I would appreciate if anyone can offer any advice as to where i'm going wrong, either in the cursor statement itself or in what trigger I should put it.
thanks
Andrewhttp://asktom.oracle.com/pls/ask/f?p=4950:8:3983328209686210967::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:5241391331097
Rgds. -
Oracle 8i Question Compile Error
I have used the following code before on a 10g db but I am having problems getting it to compile on 8.1.7.4 Im pretty sure it should still work thought.
create or replace procedure bulk_load as
cursor c1 is
select * from schema.table;
TYPE t_select IS TABLE OF c1%ROWTYPE;
t_data t_select;
BEGIN
OPEN c1;
LOOP
FETCH c1 BULK COLLECT INTO t_data LIMIT 1000;
FORALL i in 1..t_data.COUNT
INSERT INTO schema.table VALUES t_data(i);
exit when c1%NOTFOUND;
end loop;
commit;
close c1;
null;
end;
Line: 13 Column: 28 Error: PLS-00597: expression 'T_DATA' in the INTO list is of wrong type
Line: 13 Column: 1 Error: PL/SQL: SQL Statement ignored
Line: 15 Column: 63 Error: PLS-00518: This INSERT statement requires VALUES clause containing a parenthesised list of values
Line: 15 Column: 2 Error: PL/SQL: SQL Statement ignored
Line: 15 Column: 2 Error: PLS-00435: DML statement without BULK In-BIND cannot be used inside FORALL
Line: 14 Column: 11 Error: PL/SQL: Statement ignored
Any questions comments would be helpful
Thanks
Edited by: user11937852 on Jan 17, 2011 11:30 AMIf I am not mistaken BULK COLLECT has to be done per column in 8i:
open c1;
fetch c1 bulk collect into collection_1, collection_2, ...; -
Question about oracle rac. lets say we have a 3 node RAC database and our tnsnames.ora file is configured to point to node 1. If an application is connected to the database using the database connection information that is on the tnsnames.ora file (pointing to node1), and node 1 is down, how does the application know to point to node 2 or node 3 to connect to the database?
If you didn't configure node2 and node3 as failover nodes, only the currently connected sessions would failover by the other nodes.
New connections are no longer possible.
Sybrand Bakker
Senior Oracle DBA
Oracle is not about rocket science. It is about being able and willing to read documentation. -
Connecting to an oracle database questions
<p>Our current solution to connecting to our oracle database uses the following code:</p><p> ReportClientDocument clientDoc = new ReportClientDocument;</p><p> java.sql.ResultSet rs = fetchResultSet(driverName, connectStr, userName, password, <u>query</u>);</p><p> clientDoc.getDatabaseController().setDataSource(rs, <u>tableName</u>,tableName+"_ResultSet"); </p><p>The code for subreports is very similar, but isn't necessary for my question. The problem w/ this approach is we have to define the SQL query and the table name in the JSP, which we shouldn't have to do considering both of these are stored in the report. Any changes to the reports' sql would then require someone to edit the jsp, which is just bad. </p><p>I have been reading up on the ConnectionInfo and ConnectionInfos classes (nice naming convention btw) and the CrystalReportViewer.setDataBaseLogonInfos() method, and I believe a solution may lie here. The problem is the tutorials on using the ConnectionInfo class assume the database name is stored in the report, and we do not want to assume this. We are developing our reports to be used by our customers, who may name their database whatever they want so long as the tables inside it are what we specify. Because of this assumption, I have yet to find a good explanation of how to use the setAttributes(PropertyBag) method which is the only I have seen to specify the database name (within a connection string). I have examples of it, but nothing that defines the key/value pairs required in the PropertyBag to create a connection to an oracle database. </p><p>Is there some documentation on the key/value pairs needed by the PropertyBag? Also, if there is another (easier) solution I am overlooking then please let me know, thanks.</p><p>-Sam Morehouse</p><p>HBF Group, Inc </p><p> </p>
<p>got it working, here's some sample code. </p><p> </p><p><%<br /> try{<br /> ReportClientDocument clientDoc = new ReportClientDocument();<br /> clientDoc.open(reportName, 0);<br /> <br /> ConnectionInfos connInfos = new ConnectionInfos();<br /> IConnectionInfo iConnInfo = new ConnectionInfo();<br /><br /> PropertyBag bag = new PropertyBag();<br /> bag.put("Database Class Name",driverName); // "oracle.jdbc.driver.OracleDriver"<br /> bag.put("Connection URL",connectStr); // "jdbc:oracle:thin:@dbName:1521:sid"<br /> <br /> PropertyBag pb = new PropertyBag();<br /> pb.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES ,bag);<br /> pb.put(PropertyBagHelper.CONNINFO_DATABASE_DLL ,"crdb_jdbc.dll");<br /> iConnInfo.setAttributes(bag);<br /> <br /> iConnInfo.setUserName(userName);<br /> iConnInfo.setPassword(password); <br /> <br /> iConnInfo.setAttributes(pb);<br /> <br /> connInfos.add(iConnInfo);<br /> session.setAttribute(reportName, clientDoc);<br /> session.setAttribute("reportSource", clientDoc.getReportSource());<br /><br /> //Setup viewer. Only going to include the relevant line, the rest can be found</p><p> //elsewhere.<br /></p><p> CrystalReportViewer oCrystalReportViewer = new CrystalReportViewer(); oCrystalReportViewer.setDatabaseLogonInfos(connInfos); } </p><p>catch(ReportSDKExceptionBase exc)%></p>
-
Hi,
I have stored proc that takes pl/sql table as IN parameter and returns a ref cursor.
Data from pl/sql table is separated into two table type objects ... oType1 and oType2 based on some condition.
following works fine...
If oType1.Count > 0 then
OPEN list_out FOR
select col1, col2, col3, col4 ..... col20
from TABLE(CAST(oType1 AS obj_table_t)) a,
t1,
t2
where a.colvalue = t1.colvalue
and etc....
UNION ALL
select col1, col2, col3, col4 ..... col20
from TABLE(CAST(oType1 AS obj_table_t)) a,
t3,
t4
where a.colvalue = t3.colvalue
and different conditions etc....
I have 4 UNION ALL's. Had to use this because of different where coditions.
end if..
The problem is with oType2......
If oType2.Count > 0 then
-- getting data from different database using dblink along with values from present database.
-- resultset columns will be same as above
-- Question is how to send these results in same refcursor.
end if;
Thanks for your time.Hi,
I think that a plsql table is what you want and not a ref cursor. If you have a plsql table based on your user defined type you can keep assigning all the values you want to it and then pass it out of your procedure.
null
Maybe you are looking for
-
Opens Webmail login page instead of sso login page after changing the webma
Hi Gurus, I have setup notes webmail in portal which uses SSO. I login to portal and click the webmail link which opens the sso page for authentication(Cuz I have integrated the webmail to use SSO). I enter my username and password. Then it shows my
-
Keep getting error message 'itouch application failed' What does this mean
When I turn on my PC I get an error message 'itouch application failed'. What does this mean
-
Nokia 5800 Serious Problems not Solved??
I have been using 5800 for over 4 months and I have updated my firmware whenever it is available but none of the firmware updates solved the following very serious problems that turned my phone into a useless thing: First thing is the text messaging
-
Can someone explain the super key word
i am using this good from Adobe Training from the Source public class ProductEvent extends Event public var product:Product; public function ProductEvent(prod:Product,type:String) super(type); this.product = prod; public override function clone():Eve
-
ITunes can't find episode on server! PLEASE HELP! :)
I am a teacher publishing using Podcast Maker to create the podcast and feed, and it published fine to our school server. However, when in iTunes, if you try to get an episode, you get the message "The URL (http://96.4.32.37/podcasts/testclip.mov ) c