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 Antony
Hi 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
Similar Messages
-
Hi all,
Am mainly an Oracle DBA and had just recently return to supporting SAP customers after a 4 year absence of supporting non-SAP customers.
Anyway, I have some question on using Oracle RMAN with SAP databases. Backup softwares are Netbackup and Data Protector.
I managed to get the backup working, that is, there is no issues, Oracle RMAN backup using SAP's brarchive and brbackup works alright. My question is about using an Oracle RMAN catalog. I've read thru several SAP documentation and cannot find one where I can use a RMAN catalog.
Reading from
http://help.sap.com/saphelp_nw04/helpdata/en/d1/43d7cab9a04a409cc46876e36762c2/content.htm
Does that mean I cannot use a RMAN catalog? Had anyone managed to use a RMAN catalog to do the RMAN backup?
*Another question I have is, do I need Netbackup and Data Protector if I want to run RMAN backup to disk via brarchive and brbackup? Does backint requires a SBT library to use RMAN? What I mean is, I want to use RMAN but doing backup to disk instead of to tape which means I don't need the tape library installed, will backint know that this is the case and will not look for the tape library?
Any advise or feedback on this will be very much appreciated. Thanks in advance.
Extracts from http://help.sap.com/saphelp_nw04/helpdata/en/d1/43d7cab9a04a409cc46876e36762c2/content.htm are as below:
The Oracle Recovery Manager (RMAN) is an Oracle backup program. You can use it as a command line interface (CLI) or as a graphical user interface (GUI) in the Oracle Enterprise Manager (OEM). We support RMAN with the SAP backup tools BRBACKUP and BRARCHIVE.
RMAN uses the System Backup to Tape (SBT) interface to back up to tape devices. We implement SBT using the SAP backup library. External backup tools can implement this interface as a dynamic link library (DLL).
Integration
By integrating RMAN into BRBACKUP, you can add security and flexibility to important functions in existing backup strategies and tools:
· The recovery catalog is not used. The backup information is stored in the control file. After the backup, the control file is also backed up. In a restore, the control file is restored first, followed by the data files.
· The integration of RMAN into BRBACKUP also guarantees integration into the SAP Structure linkComputing Center Management System (CCMS).
· BRBACKUP tape management functions as previously (that is, as when using the SAP backup library).
· You can still use the BACKINT interface with external tools.
· All previous SAP backup strategies are supported while using RMAN. Nevertheless, RMAN is not supported for standby database backups and split-mirror backups.
· The following components are delivered with the standard Oracle8 installation:
¡ RMAN with the Oracle SBT interface
¡ Backup library and backup tool Networker from Legato
¡ Legatou2019s BACKINT interface implementation (as of Oracle 8.0.5)
The SAP installation also delivers the SAP backup library with BRBACKUP and BRARCHIVE.
Edited by: newbie01.sap on Jun 11, 2010 10:50 AMHi,
This question has been answered by Stefan Koehler. Not sure why the thread is not updated by his response. I am hoping to give him the max points actually.
It was a very good response which is as below:
Subject: Re: Oracle RMAN and SAP Databases
Message: Hello,
> Does that mean I cannot use a RMAN catalog? Had anyone managed to use a RMAN catalog to do the RMAN backup?
Correct - if you are using the BR*Tools and RMAN you are not able to use a RMAN catalog with it.
You can do manual catalog syncs, but the BR*Tools are not supporting a catalog database.
>Does backint requires a SBT library to use RMAN?
Check this documentation (Point "RMAN Backups Without Backup Library"): http://help.sap.com/saphelp_nw04/helpdata/en/3f/9d800e1aec11d2b42c00609419997a/content.htm
> Any advise or feedback on this will be very much appreciated.
We are also using RMAN for taking backup of all our oracle database (SAP and non-SAP), but without any BR*Tools.
That is also possible - check sapnote #105047 (Part "50. Recovery Manager (RMAN)").
As you mentioned, that you are a fulltime DBA you should have enough knowledge to use RMAN without BR*Tools.
Regards
Stefan -
Hi,
Can someone please point out the benefits of using Oracle OPM over SAP or a general difference between Oracle OPM and SAP.
It would be of great help.
Thanks in Advance,
RishiYes, SAP and Oracle EBiz Suite are both ERPs. In SAP, process manufacturing is an integral part of the Production Planning Module. It appears as an additional responsibility called PPPI. However, OPm has been as a seperate application integrated with the oracle eBiz suite of applications such as Inventory, Purchasing, order management etc.
With Oracle ebiz Suite 12 i, OPM too has had enhanced features such as Converged Inventory, Inventory transfers between process and discreet organizations possible with transfer prices, Manufacturing Account Controller ( MAC) which captures the accounting data of the process related transactions to the subledgers is replaced with Subledger Accounting etc. All these and some other features makes OPM an integral part of overall Oracle eBiz Suite. In addition, OPM has a solid oracle database, which even SAP uses.
You can state any specific feature comparison between SAP vs OPM, 'shall be able to give the information as well.
krishna -
Multiple record insert problem in Oracle Procedure that uses a cursor
Dear X-pert guies,
I have a oracle procedure that use a cursor, I repeatedly make query on 1st table using cursor value and insert that queried value(of 1st table) to 2nd table
y_summary. y_summary has composite primary key :PK_Y_SUM (BILL_DATE, TRUNK_MGR, IDD_FLAG, PK_FLAG, PREFIX).*
when i run the procedure explicit2('201001'); the it gives me the error:::: begin explicit2('201001'); end;_
ORA-00001: unique constraint (PRM.PK_Y_SUM) violated_
ORA-06512: at "PRM.EXPLICIT2", line 413_
ORA-06512: at line 1_
but when i remove the composite primary key from y_summary table then, the procedure runs ok and make so many duplicate entries in y_summary.
but i want the single record to be inserted for single time in y_summary ,so You guies are honorly requested to make the required help .
the structure of y_summary Table and Procdure code is given below.
Table:
-- Create table
create table Y_SUMMARY
BILL_DATE VARCHAR2(10) not null,
TRUNK_MGR VARCHAR2(20) not null,
IDD_FLAG VARCHAR2(10) not null,
PK_FLAG NUMBER(2) not null,
OUTCALLS NUMBER(20,2),
OUTDUR NUMBER(20,2),
PREFIX VARCHAR2(10) not null
tablespace TBS_PRM_D01
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
initial 64K
minextents 1
maxextents unlimited
-- Create/Recreate primary, unique and foreign key constraints
alter table Y_SUMMARY
add constraint PK_Y_SUM primary key (BILL_DATE, TRUNK_MGR, IDD_FLAG, PK_FLAG, PREFIX)
using index
tablespace TBS_PRM_D01
pctfree 10
initrans 2
maxtrans 255
storage
initial 64K
minextents 1
maxextents unlimited
Procedure:
create or replace procedure explicit2( month_val in varchar2) is
cursor explicit_cur is select dest_code from y_table where dest_code like '44%' order by dest_code desc;
dummy varchar2(100);
lv_length Number(9);
sqlstr varchar2(2500);
rec_count1 number;
rec_count2 number;
rec_count3 number;
begin
open explicit_cur;
LOOP
fetch explicit_cur into dummy;
EXIT WHEN explicit_cur%NOTFOUND;
rec_count1 :=0;
rec_count2 :=0;
rec_count3 :=0;
lv_length := length(dummy);
sqlstr := 'select count(*) from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr into rec_count1;
sqlstr := 'select count(*) from y_table_data1 t where t.fee_dur_1_2 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'',
''ITAX1B'',''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr into rec_count2;
sqlstr := 'select count(*) from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'',
''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''012'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr into rec_count3;
if(rec_count1>0) then
sqlstr := 'insert into y_summary(BILL_DATE ,PREFIX, TRUNK_MGR,OUTCALLS , OUTDUR , IDD_FLAG , PK_FLAG )
select '|| month_val||' ,substr(t.orig_called_num,1,'||lv_length||'),t.trunkout_operator ,count(*) , round(sum(ceil(t.duration / 15) * 15) / 60, 0),''00'',''1'' from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||''''|| ' group by t.trunkout_operator,substr(t.orig_called_num,1,'||lv_length||')';
execute immediate sqlstr;
commit;
sqlstr :='DELETE from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr;
commit;
end if ;
if(rec_count2>0) then
sqlstr :='insert into y_summary(BILL_DATE ,PREFIX, TRUNK_MGR,OUTCALLS , OUTDUR , IDD_FLAG , PK_FLAG )
select '|| month_val||' ,substr(t.orig_called_num,1,'||lv_length||'),t.trunkout_operator ,count(*) , round(sum(ceil(t.duration / 15) * 15) / 60, 0),''00'',''0'' from y_table_data1 t where t.fee_dur_1_2 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' group by t.trunkout_operator,substr(t.orig_called_num,1,'||lv_length||')';
execute immediate sqlstr;
commit;
sqlstr :='DELETE from y_table_data1 t where t.fee_dur_1_2 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''00'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr;
commit;
end if;
if(rec_count3>0) then
sqlstr :='insert into y_summary(BILL_DATE ,PREFIX, TRUNK_MGR,OUTCALLS , OUTDUR , IDD_FLAG , PK_FLAG )
select '|| month_val||',substr(t.orig_called_num,1,'||lv_length||'),t.trunkout_operator ,count(*) , round(sum(ceil(t.duration / 15) * 15) / 60, 0),''012'',''0'' from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''012'' group by t.trunkout_operator,substr(t.orig_called_num,1,'||lv_length||')';
execute immediate sqlstr;
commit;
sqlstr :='DELETE from y_table_data1 t where t.fee_dur_1_1 <> 0
and t.out_trunk in (''MHISRM'', ''GEISRM'', ''GEIMRP'', ''MHIMRP'', ''13'', ''ITAX1B'', ''ITAX3B'',''ITAX5B'', ''ITAX6B'', ''ITAX7B'', ''BTIMRP'', ''BTI5RP'', ''BTI6RP'', ''BTI7RP'')
and t.service_code = ''012'' and substr(t.orig_called_num,1,'||lv_length||')='||''''||dummy||'''';
execute immediate sqlstr;
commit;
end if;
end loop;
close explicit_cur;
end explicit2;
Edited by: user10951541 on 25.4.2010 12.08Dear concern
Really sorry not to make format listing because i am amature to this blog.
my anwser to your way .
1. I have Tested my SQL statements manually in SQL*Plus. this runs ok
2. "Cursor loops, such as the one you have coded here, have been obsolete in Oracle since version 8i 12+ years ago.
Look up BULK COLLECT and FORALL in the docs and use them instead."
I am trying to make use of the BULK COLLECT and FORALL statement in proper location.
3. "Your procedure never performs a commit so no work actually takes place" i need to get the anwser why........................?
4. "On what basis was the decision made to use the default PCTFREE and PCTUSED values of 10 and 40?"
is there any problem if default is used..? if any suggestion........pls
5." You did not format your listing using the CODE tags as explained in the FAQ making your listing unreadable ... so I've not read it.
Please read the FAQ and use the proper way to post code so we can understand it. Then perhaps we can help you further. " really sorry not to make understandable to you..? but i will try from next post..
I really will try to be synced..
My aim is to make query to Table A using the cursor value like( '4422','442','4411','441','44') and get some data in accordance of these values.Then i put the data into another Table B. same time i need to delete the record from Table A containing the prefix value in accordance for example- i compute value for '4422' from Table A and put the computed value to Table B .Then i delete the record from Table A where prefix is '4422' .so that computed value for the next prefix '442' should contain the computed value for 442[0-1] and 442[3-9] .Same way it will be happened for ('4411','441','44'....bla...bla).
Thanks in advance.. -
How to access oracle cursors using jdbc (expecting ur earliest reply)
Hi All,
can anyone help me out by giving me an idea or sample code in accessing the cursors that are defined in the oracle... i have to access those cursors using java... Thanks in advance for your reply and time....
RaguI have tried to follow the example from the URL link you provided.
I'm using :
- Oracle 8.1.6/8.1.7
- JDK 1.3.1
I've created:
create or replace package types
as
type cursorType is ref cursor;
end;
create or replace function sp_ListEmp return types.cursortype
as
l_cursor types.cursorType;
begin
open l_cursor for
select ename, empno
from emp
order by ename;
return l_cursor;
end;
Then I have on my code the following:
import java.sql.*;
import oracle.jdbc.driver.*;
String conStatus = "":
String driver_class = "oracle.jdbc.driver.OracleDriver";
String connect_string = "jdbc:oracle:thin:@slackdog:1521:oracle8";
String query = "begin :1 := sp_listEmp; end;";
Connection conn;
Class.forName(driver_class);
conn = DriverManager.getConnection(connect_string, "scott", "tiger");
try{
conStatus = "before prepareCall, ";
CallableStatement cstmt = conn.prepareCall(query);
conStatus = conStatus + "before Register out, ";
cstmt.registerOutParameter(1,OracleTypes.CURSOR);
conStatus = conStatus + "before execute, ";
cstmt.execute();
conStatus = conStatus + "before getObject, ";
ResultSet rset = (ResultSet)cstmt.getObject(1);
while (rset.next ())
System.out.println( rset.getString (1) );
cstmt.close();
} catch (Exception e) {
conStatus = conStatus + e;
System.out.println(conStatus);
What happens is that I am able to successfully compile the code. But when I run the code, it displays:
"before prepareCall, before Register out, SQLException: incompatible types = -10."
What does that mean? Pls point out to me what I did wrong in my code.
Thanks. -
Hi,
Our company has various system like Oracle Apps, Peoplesoft, SAP and some custom systems which uses microsoft active directory. All the system has a common User ID but diffrent password as set by the user. For now every user have to remember 4 different passwords and username(in some cases).
We wish to integrate the Authentication process using BPEL. Some thing like a SSO so the user will login into a new application(Build using ADF) like a portal, which will contain the links to all the above stated application. With this new application the user will have to remember only one user name and password and this user name and password will be sinked with all the other applications using BPEL.
Can you guys through some ideas as in how we can acchive this? Is it possible to integrate the Authentication process using BPEL?
Thanks in advance,
Deepak.Why dont you synch ypur users in OPID and keep one username password there and then use external application or portal context to authenticate to all your other applications?
-
Most useful SAP courses in Oracle area from SAP or other providers
Hi!
I am certified SAP Basis consultant (SAP NetWeaver´04 - SAP Web AS for ORACLE).
Now I have the possibility to extend my knowledge and to visit one or two SAP courses.
I already attended on ADM505, ADM506.
What are the other most useful Oracle courses/certification that you could recommend?
Thank you very much!
regards
ThomNo cross posting
Read the "Rules of Engagement"
Regards
Juan -
Problem while using oracle stored procedure in VC
Hi All,
I have created JDBC system and connected my locally installed Oracle data base to the VC. I mapped the data base user to my VC user. I tested connection and it is fine. Further I see the DB alias in Visual Composer and I can drop stored procedures to my story board. I can define parameters, but when I am executing procedures I get the error message.
Problem: I can not execute stored procedures stored in Oracle data base. Error Message: Portal request failed. Could not execute stored procedure.
In the stored procedure, I have used select query, that returns set of records, so that I have used REF CURSOR as OUT Parameter. Is REF CURSOR supported by VC?. Else, any tricks available to solve this problem?.
Note: Stored Procedure of Sql server is working fine in VC.
Thanks,
Venkatesh RReturning (or sending in) multiple rows directly from (or to) a stored procedure is not currently possible. I have been in contact with SAP on this subject earlier, and they suggest using a web service to do the job. I used this as a work around, calling the stored procedure from a web service. I send in VC tables to this web service, and this in turn contacts my stored procedure.
The problem is related to the connector framework in the J2EE environment.
I am on 7.0 sps 17
If you use stored procedure single value parameters of type varchar, number ... then VC has no problem communicating with your procedures.
Good luck
Henning Strand -
Cursors are not closed when using Ref Cursor Query in a report ORA-01000
Dear Experts
Oracel database 11g,
developer suite 10.1.2.0.2,
application server 10.1.2.0.2,
Windows xp platform
For a long time, I'm hitting ORA-01000
I have a 2 group report (master and detail) using Ref Cusor query, when this report is run, I found that it opens several cursors (should be only one cursor) for the detail query although it should not, I found that the number of these cursors is equal to the number of master records.
Moreover, after the report is finished, these cursors are not closed, and they are increasing cumulatively each time I run the report, and finally the maximum number of open cursors is exceeded, and thus I get ORA-01000.
I increased the open cursors parameter for the database to an unbeleivable value 30000, but of course it will be exceeded during the session because the cursors are increasing cumulatively.
I Found that this problem is solved when using only one master Ref Cursor Query and create a breake group, the problem is solved also if we use SQL Query instead of Ref Query for the master and detail queries, but for some considerations, I should not use neither breake group nor SQL Query, I have to use REF Cursor queries.
Is this an oracle bug , and how can I overcome ?
Thanks
Edited by: Mostafa Abolaynain on May 6, 2012 9:58 AMThank you Inol for your answer, However
Ref Cursor give me felxibility to control the query, for example see the following query :
function QR_1RefCurDS return DEF_CURSORS.JOURHEAD_REFCUR is
temp_JOURHEAD DEF_CURSORS.JOURHEAD_refcur;
v_from_date DATE;
v_to_date DATE;
V_SERIAL_TYPE number;
begin
SELECT SERIAL_TYPE INTO V_SERIAL_TYPE
FROM ACC_VOUCHER_TYPES
where voucher_type='J'
and IDENT_NO=:IDENT
AND COMP_NO=TO_NUMBER(:COMPANY_NO);
IF :no_date=1 then
IF V_SERIAL_TYPE =1 THEN
open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
FROM JOURHEAD
WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
AND IDENT=:IDENT
AND ((TO_NUMBER(VOCH_NO)=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
OR (TO_NUMBER(VOCH_NO) BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
OR (TO_NUMBER(VOCH_NO)<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))
ORDER BY TO_NUMBER(VOCH_NO);
ELSE
open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
FROM JOURHEAD
WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
AND IDENT=:IDENT
AND ((VOCH_NO=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
OR (VOCH_NO BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
OR (VOCH_NO<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))
ORDER BY VOCH_NO;
END IF;
ELSE
v_from_date:=to_DATE(:from_date);
v_to_date:=to_DATE(:to_date);
IF V_SERIAL_TYPE =1 THEN
open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
FROM JOURHEAD
WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
AND IDENT=:IDENT
AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
OR (:from_date is null and :to_date is null ))
ORDER BY VOCH_DATE,TO_NUMBER(VOCH_NO);
ELSE
open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
FROM JOURHEAD
WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
AND IDENT=:IDENT
AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
OR (:from_date is null and :to_date is null ))
ORDER BY VOCH_DATE,VOCH_NO;
END IF;
END IF;
return temp_JOURHEAD;
end; -
Unable to use ref cursor as a input parameter at the time of inserting reco
Hi
i am unable to use ref cursor when inserting the data to oracle 11g from visual studio 2008. please help me as early as possible my code is bellows
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Configuration;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
public partial class App_frmTest : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
protected void btnClick_Click(object sender, EventArgs e)
OracleCommand cmd=new OracleCommand();
Data objdata = new Data();
int i = 0;
string constr = "Data Source=Cwc;User Id=scott; Password=tiger;";// enlist=false; pooling=false;
OracleConnection con = new OracleConnection(constr);
/*Connection Open*/
con.Open();
cmd.Connection = con;
/*Connection Open End*/
/*Select Through Ref Cursor*/
cmd.CommandText = "scott.TEST_USER.getUSER";
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter p_rc = cmd.Parameters.Add("p_rc", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Output);
OracleParameter p_rc1;
if (TextBox1.Text == "")
p_rc1 = cmd.Parameters.Add("p_rc", OracleDbType.Int16, DBNull.Value, ParameterDirection.Input);
else
p_rc1 = cmd.Parameters.Add("p_rc", OracleDbType.Int16, Convert.ToInt16(TextBox1.Text), ParameterDirection.Input);
// OracleParameter p_rc1 = cmd.Parameters.Add("p_rc", OracleDbType.Int16, 2, ParameterDirection.Input);
OracleDataReader reader = cmd.ExecuteReader();
DataSet ds = new DataSet();
DataTable dt1 = new DataTable();
dt1.Load(reader);
ds.Tables.Add(dt1);
GridView1.DataSource = ds;
GridView1.DataBind();
cmd.Parameters.Clear();
con.Close();
con.Dispose();
OracleCommand cmd1 = new OracleCommand();
OracleConnection con1 = new OracleConnection(constr);
con1.Open();
cmd1.Connection = con1;
cmd1.CommandText = "scott.TEST_USER.ADDUSER";
cmd1.CommandType = CommandType.StoredProcedure;
OracleParameter P_ADDUSER = cmd1.Parameters.Add("P_ADDUSER", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Input);
cmd1.ExecuteNonQuery(); // i am getting error when executing this line
Server Error in '/CWC' Application.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source Error:
Line 77: OracleParameter P_ADDUSER = cmd1.Parameters.Add("P_ADDUSER", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Input);
Line 78: //OracleParameter P_MSG = cmd.Parameters.Add("P_MSG", OracleDbType.Varchar2, DBNull.Value, ParameterDirection.Output);
Line 79: cmd1.ExecuteNonQuery();
Line 80:
Line 81: DataTable dt = new DataTable();
Source File: d:\CWC\App\frmTest.aspx.cs Line: 79
Stack Trace:
[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
Oracle.DataAccess.Client.OpsSql.ExecuteNonQuery(IntPtr opsConCtx, IntPtr& opsErrCtx, IntPtr& opsSqlCtx, IntPtr& opsDacCtx, IntPtr opsSubscrCtx, Int32& isSubscrRegistered, Int32 bchgNTFNExcludeRowidInfo, Int32 bQueryBasedNTFNRegistration, Int64& query_id, OpoSqlValCtx*& pOpoSqlValCtx, String pCommandText, IntPtr& pUTF8CommandText, IntPtr[] pOpoPrmValCtx, String[] ppOpoPrmRefCtx, OpoMetValCtx*& pOpoMetValCtx, Int32 prmCnt, Int32 bFromPool) +0
Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery() +4731
App_frmTest.btnClick_Click(Object sender, EventArgs e) in d:\CWC\App\frmTest.aspx.cs:79
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565Hi;
Its better to ask it at visual studio forum site:http://social.msdn.microsoft.com/Forums/en-US/category/visualstudio
Regard
Helios -
How to update data returned using REF CURSOR
Hi all,
I am trying to update updated data in a gridview but the update button seem to do nothing as i retrieve data using REF CURSOR.
Let me describe the architecture of my application first. I'm trying to implement best practice whenever possible. I am following the data access tutorial published in www.asp.net , the only difference is that i have an Oracle (10g) database. So I split my application into three layers, data access, business logic, and presentation layer. I'm also writing all queries in an Oracle package.
So I have my Oracle packages that perform CRUD operations. Then I have an xsd file that define dataTable based on the package procedure. My business logic layer then calls functions defined in the xsd file. And finally a detailsView control that uses an ObjectDataSource to call business logic functions.
In a nutshell, I am just trying to update records retrieved using REF CURSOR. Your help is very much appreciated. Please let me know if further details are required. Cheers,In the DataSet (xsd) where your DataTable is defined, you just need to add additional methods to the TableAdapter to handle insert, update and delete, either with SQL or by mapping to stored procedures.
Alternatively in code, create an OracleDataAdapter and supply its InsertCommand, UpdateCommand and DeleteCommand.
David -
How can we do the data migration between Oracle Applications and SAP R/3.
Hi All,
How can we do the data migration between Oracle Applications and SAP R/3 system.What are all the possible ways to move bulk data from Oracle Apps to SAP r/3 system.
Provide any 3rd party tools which supports data migration and also pls rpovide the SAP's own data migration tools with supports the above feature.
Awaiting for best possible solution.
Thanks in advance.
Regards
Dharmarajuthe 3rd party tool is ETL , you can use ETL tool and the prepare the load files then you can use LSMW method to upload the data to SAP.
-
Inserting an indicator using a cursor
I need to write a procedure that will use a cursor like the one you see in the select statement, how I can write another cursor that will insert an indicator of Y in a column if the szslife_pidm repeat the same building code and room number in two different terms?
For example you can see for term 200590 and 200610 the pidm 1862 has the same room and building, so I want to created another column indicator n the record for the term 200610 will said something like repeat_room y
SELECT
szslife_pidm,
szslife_student_id,
szslife_slrrasg_term_code ,
szslife_building_code ,
szslife_building_name ,
szslife_room_number
FROM SZSLIFE
WHERE szslife_pidm = 1862
ORDER BY szslife_pidm
SZSLIFE_PIDM SZSLIFE_STUDENT_ID SZSLIFE_SLRRASG_TERM_CODE SZSLIFE_BUILDING_CODE SZSLIFE_BUILDING_NAME szlife_repeat_ind
1862 00001862 200290 BLA Blackstone House 003
1862 00001862 200510 UNI Unity House 4
1862 00001862 200490 UNI Unity House 4
1862 00001862 200610 SMI Grace Smith House 216 Y
1862 00001862 200390 BLA Blackstone House 207
1862 00001862 200310 BLA Blackstone House 003
1862 00001862 200410 BLA Blackstone House 207
1862 00001862 200590 SMI Grace Smith House 216
szlife_repeat_ind IS THE COLUMN I WANT WITH THE Y
I will appreciate any help!
Thank youYou could use the LAG() function
I used the EMP table for an example
SQL> select job, mgr from emp order by job;
JOB MGR
ANALYST 7566
ANALYST 7566
CLERK 7782
CLERK 7698
CLERK 7902
CLERK 7788
MANAGER 7839
MANAGER 7839
MANAGER 7839
PRESIDENT
SALESMAN 7698
SALESMAN 7698
SALESMAN 7698
SALESMAN 7698
14 rows selected.
SQL> select job, mgr ,
2 decode(lag(mgr) over (partition by job order by mgr) , null, null, mgr, 'Y', null)
3 from emp order by job;
JOB MGR D
ANALYST 7566
ANALYST 7566 Y
CLERK 7698
CLERK 7782
CLERK 7788
CLERK 7902
MANAGER 7839
MANAGER 7839 Y
MANAGER 7839 Y
PRESIDENT
SALESMAN 7698
SALESMAN 7698 Y
SALESMAN 7698 Y
SALESMAN 7698 Y
14 rows selected.For more information about analytical functions see the Datawarehousing Guide
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/analysis.htm#15913
Fixed a problem when mgr is null
Message was edited by:
Jens Petersen -
Using Oracle Hints in Selects......
Hello,
Are there any after effects/side effects by using Oracle Hints in a SQL select ??? (hints such as Cache, NOCache, all_rows)
Can anyone let me know whether there are any good documentation or site on Oracel SQL hints..
thanks
KanchiHi!
There is an exception, that I think is a bug in Oracle, but I4m not sure. If you use the PARALLEL HINT in a select that will be use in a Cursor, in order to insert the results in other table, and the results come in groups built following a group by sentence, there are possibilities that two childs (a child is a parallel process) take portions of this whole group, and built each one one group.
If the new table use certain number of columns as a primary key, this may cause an duplicated primary key trigger.
I4m going to write and document this case, in order to show it to oracle support.
I hope this help. Bye.
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by kanchana Hettiarachchi ([email protected]):
Hello,
Are there any after effects/side effects by using Oracle Hints in a SQL select ??? (hints such as Cache, NOCache, all_rows)
Can anyone let me know whether there are any good documentation or site on Oracel SQL hints..
thanks
Kanchi<HR></BLOCKQUOTE>
null -
Stored Proc to create XML (using nested cursors)?
From previous posts and from the
documentation for XSQL I have
discovered the joys of the
CURSOR operator to create
nested tables: i.e:
SELECT dname,
CURSOR (SELECT ename, sale....) as employees
FROM dept
However, I can not find any other
documentation on how to program (PL/SQL)
this functionality.
I would like to use XSQL as
it is exactly what I need, but
I can not because my client does
not want to use Java and they
require IIS, but do not want to
use JRUN, etc... (I tried this
first).
Since I only need to do an XML
dump to a variable for processing
by other parts of the program, life
is fairly easy. I have already done
this using Microsoft Data Shapes in
VB (client does not want VC++ either...)
However this was slow.
In order to speed things up I want to
create a stored procedure in Oracle to
dump out the XML hierarchy to a variable given
an SQLQuery input. If I use
nested CURSORS this should be very easy.
I would like to create a recursive PL/SQL
function to handle this, but I have the
following questions:
1) I want the function to have an
input of an open cursor,
My plan is to detect the column
type, when it is a nested cursor
I would recurse with the open cursor
to handle the nested cursor.
2) I can not find a reference on to
programatically handle "untyped collections
based on an SQL statement" in anything
other than the XSQL documentation.
I am assuming that I can detect the
column type of nested cursor somehow
and then recurse on this to handle
dump the recordset to an XML tagset.
But I wuold like to find some documentation
or examples on the calls, type statements,
etc....I think the CURSOR() thing is an invention of the XSQL Servlet; not available elsewhere.
You can accomplish nesting via user defined types and object views, using the "cast(multiset())" syntax, which is not documented particularly well either. This does require some setup, and so is not particularly dynamic.
Maybe you are looking for
-
ITunes won't open even after reinstall
Since October 1, 2012 when I clicked on desktop icon to open/launch iTunes it will not. I did nothing different, nothing has changed or been modified on my computer. I continue to receive basic error box "itunes has encountered a problem and needs to
-
Analysis Services Processing Task - Error processing
Hi all, I have a SSIS package containing an Analysis Services Processing Task. In case it fails, I want to insert the error messages in a table. I have create an SSIS package that fails because of dimension values that are not in the fact table. The
-
Moving playlists/selections from one drive to another:
Hello all, thanks in advance for your attention. I need to make some more room on my main music storage drive. I hope to accomplish this by moving some of my less-used songs/playlists to another drive on my pc. I know I could just drag-and-drop the f
-
Authorization object for 351 movement type
Dear expert Please guide me How to restrict 351 movement type for created STO for self plant in self plant? for eg : there are 2 plant 1001, 2001. STO CREATED IN 1001 PLANT IN THIS suppling plant : 2001 & Recieving plant : 1001 Now, suppling plant h
-
How to create remote monitor and control webpages using cFP2220
Hi all, I'm fresh user using compact field point. I would like to make cfp2220 as a web server, so other PCs can using IE to monitor and control through web browser. Moreover, does the webpages support security? and how to setup? Thanks, Regards, Rob