How to get a resultset from Stored Procedures
How to efficiently and portably get resultsets from Oracle stored procedures? Oracle does not seem to follow JDBC standards here. A standard way in Oracle is to use a ref cursor and call getObject() on CallableStatement. However, Oracle seems to get all the data in the resultset in getObject(), which is inefficient and leads to large memory usage when the resultset is large.
Another way in Oracle is to use getCursor() on an OracleCallableStatement, which is efficient but not portable across different application servers. For example, in WebSphere, this OracleCallableStatement is not available if we want WebSphere to manager the datasource.
Any ideas will be greatly appreciated. Please email to [email protected]
Oracle JDBC did not support return a result set, if you are using Oracle 9i, you can use pipeline function, then using the TABLE() function the get the row.
Good Luck.
Welcome to http://www.anysql.net/en/
Similar Messages
-
How to get return values from stored procedure to ssis packge?
Hi,
I need returnn values from my stored procedure to ssis package -
My procedure look like and ssis package .Kindly help me to oget returnn value to my ssis package
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [TSC]
-- Add the parameters for the stored procedure here
@P_STAGE VARCHAR(2000)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
--SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>
truncate table [INPUTS];
INSERT
INTO
[INPUTS_BASE]
SELECT
[COLUMN]
FROM [INPUTS];
RETURN
END
and i am trying to get the return value from execute sql task and shown below
and i am taking my returnn value to result set variableYou need to have either OUTPUT parameters or use RETURN statement to return a value in stored procedures. RETURN can only return integer values whereas OUTPUT parameters can be of any type
First modify your procedure to define return value or OUTPUT parameter based on requirement
for details see
http://www.sqlteam.com/article/stored-procedures-returning-data
Once that is done in SSIS call sp from Execute SQL Task and in parameter mapping tabe shown above add required parameters and map them to variables created in SSIS and select Direction as Output or Return Value based on what option you used in your
procedure.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Returning rowcount and resultset from stored procedure
Hello,
In SQL Server you can return multiple resultsets from stored procedure by simple SELECT statement. But in Oracle, you have to use SYS_REFCURSOR.
Sample code:
CREATE OR REPLACE PROCEDURE sp_resultset_test IS
t_recordset OUT SYS_REFCURSOR
BEGIN
OPEN t_recordset FOR
SELECT * FROM EMPLOYEE;
END sp_resultset_test;
Is there any other way in Oracle 10 or 11 ?
Thank You.What is the requirement? Oracle is far more flexible than SQL-Server... with numerous features that do not exist in SQL-Server. (Fact)
One of the biggest mistakes you can make is to treat Oracle like SQL-Server... trying to match feature A1 in SQL-Server to feature B3 in Oracle.
Does not work that way.. rather then stick to SQL-Server as SQL-Server does SQL-Server specific features far better than Oracle.
So instead of trying to map what a T-SQL stored proc to do to an Oracle ref cursor (even to the extent of using that very silly sp_ prefix to name the proc), tell us the problem and requirements... That way we can tell you what Oracle features and options are best used to solve that problem - instead of competing in some unknown feature comparison event with SQL-Server. -
How to generate a report from stored procedure
I would like to generate a report from stored procedure.
I used to work on sql server. this can be done as easy as put a select statement at the end of stored procedure.
The resule can be displayed on the development IDE, like sql developer or consume by Java JDBC client.
is there equivalent way to do this in Oracle stored procedure?Hi,
What type of report you are looking..for.. ??
As you said that "I used to work on sql server. this can be done as easy as put a select statement at the end of stored procedure. "
When you execute it will return the result set and you will display directly on the FrontEnd.. Is my Understanding is correct Up to here.
See, In oracle you have call some custom stored procedures as you did in SQL Sever, but you have return the Results Sets, with help of Out put paramter, Either Cursors or Varrays..
or Else you can generate the Html reports based on your requirement, HTML can be used in the stored procedures of Oracle which will generate for your, you need to code it.
I could not able get the relevant link for your reference.
I will get back to you on this.
- Pavan Kumar N -
Getting resultset from stored procedures..
hi all,
i have got some very fundamental doubts regarding Oracle Stored Procedures and calling it from java.. i want the resultset to be returned from sp and for that i used to following sp and java code.
package
====
CREATE OR REPLACE package
curs_types as
type EmpCurType is REF CURSOR RETURN emp%ROWTYPE;
end curs_types;
procedure
======
procedure
single_cursor(curs1 IN OUT curs_types.EmpCurType)
AS
BEGIN
OPEN curs1 FOR SELECT * FROM emp;
END single_cursor;
java code for calling sp
=========
String sql = "{call single_cursor(?)}";
CallableStatement cstmt1 = con.prepareCall(sql);
cstmt1.registerOutParameter(1, OracleTypes.CURSOR);
cstmt1.execute();
rs = (ResultSet)cstmt1.getObject(1);
while(rs.next())
{ String empno=(String)rs.getString(1);
and it worked properly but the problem is i dont want all the fields from the table emp..i mean, if i change the query inside the sp from "select * from emp" to "select ename,empno from emp" then that sp is showing compilation errors.. is it possile to return a cursor from sp that contains specific fields ??
wat is the procedure to return a cursor that contain datas from multiple tables ???
can any1 help me with this ??? plz mail me on [email protected]
thanks in advance
raj.>
and it worked properly but the problem is i dont want
all the fields from the table emp..i mean, if i
change the query inside the sp from "select * from
emp" to "select ename,empno from emp" then that sp is
showing compilation errors.. You have a cursor with specific fields, so you have to fill all of them in.
is it possile to return
a cursor from sp that contains specific fields ??
Yes. See your Oracle docs.
wat is the procedure to return a cursor that contain
datas from multiple tables ???Yes. Same as a select from multiple tables. -
How to get sequence nextvalue in stored procedure?
Hi, guys,
I am trying to obtain the nextvalue of a sequence in a stored procedure, ultimately this value shall be returned to caller, but how do I assign or get the sequence value inside a stored procedure?
Thanks
jimfoo NUMBER;
SELECT mysequence.nextval INTO foo FROM DUAL; -
How to call 'C' programs from stored procedures?
Hi
Did anybody tried to call 'C' programs
from oracle stored procedures?
If anybody knows, can you please send
how to configure the listener.ora and
tnsnames.ora. If its possible post all the
information from the begining with examples.
thanks....Oracle JDBC did not support return a result set, if you are using Oracle 9i, you can use pipeline function, then using the TABLE() function the get the row.
Good Luck.
Welcome to http://www.anysql.net/en/ -
Cannot get OUT parameter from stored procedure
Hi,
I am new to stored procedure programming. I wrote a simple java stored procedure as follows:
package fvt;
import java.sql.*;
import java.io.*;
public class FVTProcedures
extends COM.ibm.db2.app.StoredProc {
public void addRecord(int id, String name, int status)
throws SQLException {
java.sql.Statement stmt = null;
java.sql.Connection con = null;
PrintWriter pw = null;
try {
status =3;
pw = new PrintWriter(new FileWriter("c:/temp/fvtproc.txt"));
pw.println("starting...");
// get connection
con =getConnection();
pw.println("Got connection");
stmt = con.createStatement();
stmt.execute("INSERT INTO cmtest (id, name) values (" + id + ",'"+name+"')");
pw.println("Inserted the record");
if (!con.getAutoCommit()) {
con.commit();
pw.println("Committed the connection");
catch (SQLException sqle) {
pw.println(sqle.getMessage());
catch (Exception e) {
pw.println(e.getMessage());
finally {
status =2;
pw.close();
try {
if (stmt != null) {
stmt.close();
catch (SQLException sqle) {}
try {
if (con != null) {
con.close();
catch (SQLException sqle) {}
Then I use the following sql command to create this stored procedure, especially register status as OUT parameter.
CREATE PROCEDURE addRecord (IN id INT, IN name VARCHAR(20), OUT status INTEGER)
FENCED LANGUAGE JAVA EXTERNAL NAME 'fvt.FVTProcedures!addRecord' PARAMETER
STYLE DB2GENERAL
My java program calling this stored proc is as follows:
import java.sql.*;
import javax.sql.*;
public class CallableStmtTest {
COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource ds = null;
public static void main(String args[]) {
CallableStmtTest dt = new CallableStmtTest();
try {
dt.test();
} catch (Exception e) {
e.printStackTrace(System.out);
public CallableStmtTest() {
ds = new COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource();
ds.setUser("username");
ds.setPassword("password");
ds.setDatabaseName("database");
public void test() {
java.sql.Connection conn = null;
CallableStatement cs = null;
String sql = "CALL ADDRECORD(?, ?, ?)" ;
try {
conn = ds.getPooledConnection().getConnection();
conn.setAutoCommit(false);
System.out.println("Got the connection");
cs = conn.prepareCall( sql ) ; /* con is the connection */
System.out.println("Callable statement is prepared");
cs.registerOutParameter(3, java.sql.Types.INTEGER);
cs.setInt(1, 1001 );
cs.setString(2, "1001");
cs.execute() ;
System.out.println("Callable statement is executed, return status: "+cs.getInt(3));
conn.commit();
catch(SQLException sqle) {
sqle.printStackTrace();
finally {
try {
if (cs!=null) {cs.close();}
catch (SQLException sqle1) {
try {
if (conn!=null) {conn.close();}
catch (SQLException sqle1) {
However, the out put is always
Callable statement is executed, return status: 0
while i expect to be
Callable statement is executed, return status: 2
Can anyone tell me what's wrong with that?
thansk,
JSTpublic void addRecord(int id, String name, int status)
throws SQLException {
status =3;In regular java you are never going to see this value (3) outside of that method. Java doesn't work that way.
So unless java inside the DB works really differently from regular java, you are going to have to pass something else. -
Getting result set from stored procedures in database controls in weblogic
I am calling a stored procedure from database control which actually returns a result set
when i call the stored procedure like
* @jc:sql statement="call PROC4()"
ResultSet sampleProc() throws SQLException;
it gives me exception saying
"weblogic.jws.control.ControlException: Method sampleProc is DML but does not return void or int"
I would appreciate any help
Thanks,
UmaThanks for you reply!
1) The stored procedure has head
CREATE OR REPLACE PROCEDURE X_OWNER.DISPLAY_ADDRESS
cv_1 IN OUT SYS_REFCURSOR
AS
err_msg VARCHAR2(100);
BEGIN
--Adaptive Server has expanded all '*' elements in the following statement
OPEN cv_1 FOR
Select ...
commit;
EXCEPTION
WHEN OTHERS THEN
err_msg := SQLERRM;
dbms_output.put_line (err_msg);
ROLLBACK;
END;
If I only run select .. in DBArtisan, it display all 2030,000 rows in 3:44 minutes
2) But when call stored procedure, it will take 80-100 minutes .
3) The stored procedure is translated from sybase using migration tools, it's very simple, in sybase it just
CREATE PROCEDURE X_OWNER.DISPLAY_ADDRESS
AS
BEGIN
select ..
The select part is exact same.
4) The perl code is almost exact same, except the query sql:
sybase verson: my $sql ="exec DISPLAY_ADDRESS";
and no need bind the cursor parameter.
This is batch job, we create a file with all information, and ftp to clients everynight.
Thanks!
Rulin -
Can we get data return from stored procedure in a select query ?
Hello,
Suppose i have a function GetSum(x,y) that returns sum of two numbers x and y .We can call this function from within a sql function like this :
select GetSum(4,5) SUM from dual;But is this possible through a stored procedure ? i.e., can i call a stored procedure from within a select query like i have done in above code ?Hi,
bootstrap wrote:
Hello,
Suppose i have a function GetSum(x,y) that returns sum of two numbers x and y .We can call this function from within a sql function like this :
select GetSum(4,5) SUM from dual;But is this possible through a stored procedure ? i.e., can i call a stored procedure from within a select query like i have done in above code ?The short answer has already been given.
Why can't you use a function?
Suppose you could use a procedure. What results would you want to see from:
SELECT my_proc (4, 5)
FROM dual
;? Why?
Explain what you want to do, and somebody will help you find a good way to do it. -
Get out values from stored procedure
Hi folks,
I have need of an aid. I have created this stored procedure:
CREATE OR REPLACE PROCEDURE ProceduraDiProva (
p_val1 IN NUMBER DEFAULT 1,
p_val2 IN NUMBER DEFAULT 1,
p_val3 OUT NUMBER,
p_val4 OUT NUMBER)
AS
BEGIN
p_val3 := p_val1 + p_val2;
p_val4 := 999;
END ProceduraDiProva;
I call the procedure into shell script
$ORACLE_HOME/bin/sqlplus -s user/pwd@oracleid > oracle.log << END
spool ciccio.txt
declare
var a_out number;
var b_out number;
begin
var a_out:=0;
exec ProceduraDiProva(1, 2, a_out, b_out);
end;
spool off;
exit
END
I would know as I make to insert 'a_out' and 'b_out' in a shell variables
Tanks in advanceI found an example with windows
Create a file cmd with;
FOR /F "usebackq delims=!" %%i IN (`sqlplus -s %usuario%/%pwd%@%ddbb% @1.sql`) DO set xresult=%%i
echo %xresult%
And the 1.sql:
set timing off
set feedback off
set pages 0
select sysdate from dual;
exit
------------------------------------------------------------------------------------------ -
How to capture return value from stored procedure?
Hi All,
I want to capture the retun values from this procedure to a table - CALL SYS.GET_OBJECT_DEFINITION('SCHEMA_NAME', 'TABLE_NAME').
The below approach is not working -
Insert into STG.STG_DDL
Call SYS.GET_OBJECT_DEFINITION('DWG', 'DWG_SITE')
Could you please have a look on the same?
Thank you,
VijeeshThanks a lot Everyone.
Considering the discussed options, and an approach explained in this thread - -http://scn.sap.com/thread/3291461 , I have written an SQL to build the Alter statements to add the columns & Constrains to table.
The below Query will provide the scripts to build a table in another environment.
select * from (
select TABLE_name,'tbl_Create' column_name, 1 as position, 'CREATE TABLE '|| schema_name ||'.'|| table_name ||' ( DUMMY_CLMN INTEGER);' as SQLCMD
from tableS
where schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
UNION ALL
-- MASS change of NOT NULL COLUMNS
-- set to NOT NULL - character data type, double, decimal fixed - need the length but not the scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'FALSE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('VARCHAR', 'NVARCHAR', 'DOUBLE')
and scale is NULL
UNION ALL
-- MASS change of NOT NULL COLUMNS
-- set to NOT NULL - character data type, double, decimal fixed - need the length but not the scale
select TABLE_name,column_name, position + 100,'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') );' as SQLCMD
from table_columns
where is_nullable = 'TRUE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('VARCHAR', 'NVARCHAR', 'DOUBLE')
and scale is NULL
UNION ALL
-- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||','|| scale ||') NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'FALSE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DECIMAL' )
and scale is not null
UNION ALL
-- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||','|| scale ||') ) ;' as SQLCMD
from table_columns
where is_nullable = 'TRUE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DECIMAL' )
and scale is not null
UNION ALL
-- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and null scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'FALSE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DECIMAL' )
and scale is null
UNION ALL
-- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and null scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'TRUE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DECIMAL' )
and scale is null
UNION ALL
-- set to NOT NULL - DATE | TIME | SECONDDATE | TIMESTAMP | TINYINT | SMALLINT | INTEGER - don't need length or scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'FALSE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DATE', 'LONGDATE', 'TIME', 'SECONDDATE', 'TIMESTAMP', 'TINYINT', 'SMALLINT', 'INTEGER' )
-- and scale is not null
UNION ALL
-- set to NOT NULL - DATE | TIME | SECONDDATE | TIMESTAMP | TINYINT | SMALLINT | INTEGER - don't need length or scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' ) ;' as SQLCMD
from table_columns
where is_nullable = 'TRUE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DATE', 'LONGDATE', 'TIME', 'SECONDDATE', 'TIMESTAMP', 'TINYINT', 'SMALLINT', 'INTEGER' )
-- and scale is not null
UNION ALL
select table_name, 'PK' AS column_name, 9990, 'ALTER TABLE '||table_name||' ADD CONSTRAINT Primary_key PRIMARY KEY ('||PK_COLUMN_NAME1||
case when PK_COLUMN_NAME2 is null then ' ' else ','|| PK_COLUMN_NAME2 end ||
case when PK_COLUMN_NAME3 is null then ' ' else ','|| PK_COLUMN_NAME3 end ||
case when PK_COLUMN_NAME4 is null then ' ' else ','|| PK_COLUMN_NAME4 end ||');'
from
(SELECT DISTINCT C1.table_name , C1.COLUMN_NAME AS PK_COLUMN_NAME1, C2.COLUMN_NAME AS PK_COLUMN_NAME2, C3.COLUMN_NAME AS PK_COLUMN_NAME3, C4.COLUMN_NAME AS PK_COLUMN_NAME4
FROM (SELECT * FROM CONSTRAINTS WHERE POSITION=1 AND IS_PRIMARY_KEY = 'TRUE') C1
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=2 AND IS_PRIMARY_KEY = 'TRUE') C2
ON C1.table_name = C2.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=3 AND IS_PRIMARY_KEY = 'TRUE') C3
ON C2.table_name = C3.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=4 AND IS_PRIMARY_KEY = 'TRUE') C4
ON C3.table_name = C4.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=5 AND IS_PRIMARY_KEY = 'TRUE') C5
ON C4.table_name = C5.table_name
) PK
where table_name = 'DWG_PRODUCTION_VOLUME_TRX'
UNION ALL
select table_name, 'UK' AS column_name, 9991, 'ALTER TABLE '||table_name||' ADD CONSTRAINT UNIQUE ('||UK_COLUMN_NAME1||
case when UK_COLUMN_NAME2 is null then ' ' else ','|| UK_COLUMN_NAME2 end ||
case when UK_COLUMN_NAME3 is null then ' ' else ','|| UK_COLUMN_NAME3 end ||
case when UK_COLUMN_NAME4 is null then ' ' else ','|| UK_COLUMN_NAME4 end ||');'
FROM
(SELECT DISTINCT C1.table_name , C1.COLUMN_NAME AS UK_COLUMN_NAME1, C2.COLUMN_NAME AS UK_COLUMN_NAME2, C3.COLUMN_NAME AS UK_COLUMN_NAME3, C4.COLUMN_NAME AS UK_COLUMN_NAME4
FROM (SELECT * FROM CONSTRAINTS WHERE POSITION=1 AND IS_PRIMARY_KEY = 'FALSE') C1
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=2 AND IS_PRIMARY_KEY = 'FALSE') C2
ON C1.table_name = C2.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=3 AND IS_PRIMARY_KEY = 'FALSE') C3
ON C2.table_name = C3.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=4 AND IS_PRIMARY_KEY = 'FALSE') C4
ON C3.table_name = C4.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=5 AND IS_PRIMARY_KEY = 'FALSE') C5
ON C4.table_name = C5.table_name
) UK
where table_name = 'DWG_PRODUCTION_VOLUME_TRX'
UNION ALL
SELECT REFERENCED_TABLE_NAME AS table_name,'FK' AS column_name, 9992,
'ALTER TABLE DWG.'||TABLE_NAME||' ADD FOREIGN KEY ( '||COLUMN_NAME||' ) REFERENCES '|| REFERENCED_TABLE_NAME||'('||COLUMN_NAME||' ) ON UPDATE CASCADE ON DELETE RESTRICT;'
FROM REFERENTIAL_CONSTRAINTS
WHERE REFERENCED_TABLE_NAME = 'DWG_SITE'
UNION ALL
select TABLE_name,'tbl_ClmnDrop' column_name, 9995 as position, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' DROP ( DUMMY_CLMN );' as SQLCMD
from tableS
where schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
order by position; -
How to get app.processId from Guided Procedures? Please I need You help
Hi everyone, I need your help, I need to recover the processId once time the Procees was started in Guided Procedures
I found this link from maintenance process in Guided Porcedures administration
http://host:port/webdynpro/dispatcher/sap.com/cafeugpui~rt/Runtime?app.processId=IDnumber
the parameter I need is IDnumber, I dont know if it is possible with web dynpros or with web services please I need you help
How Can I do this?
Thank you very much my friends
Regards from Mexico
Atte IsraelHi,
I am not sure about the version. But you can follow the steps below.
1. Create a Web Dynpro Poroject (Ideally create a DC , but if you don't have NWDI setup a project will do).
2. Add reference to com.sap.security.api.jar and sap.comcafeugpapi.jar
3. Under WebDynpro References -> Library References add sap.com/cafeugp~api
4. Put following code in wdDoInit()
public void wdDoInit()
//@@begin wdDoInit()
IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
IWDMessageManager msgMgr= wdComponentAPI.getMessageManager();
try{
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(user);
Date startDate = new Date(110,1,1); // Start date as 01-Jan-2010
Date endDate= new Date(111,12,31); // End date as 31-Dec-2011
IGPProcessInstanceInfo[] array = rtm.getRunningInstances(GPSearchRole.SEARCH_ROLE_OWNER, startDate, endDate, userContext);
for (int i=0; i<array.length; i++){
String instanceId = array<i>.getProcessInstanceID();
// Write logic to pass the instance ID to the RFC
msgMgr.reportSuccess("Instance id =" + instanceId);
catch(Exception ex)
msgMgr.reportException(ex.getLocalizedMessage(),false);
//@@end
Let me know if you face any issues.
Thanks
Prashant -
How to get line error from a procedure?
Hello,
I want to know the line where the error occurs, since when I treat the exception to show a user friendly error page this erro is not logged at OAS.
How to do it?
Thanks in advance.
EXCEPTION WHEN OTHERS THEN
HTP.P('Sorry');
emailme(SQLERRM);
emailme(line where erro occurs);???????
END;
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Paula Bronfman ([email protected]):
Hello,
I want to know the line where the error occurs, since when I treat the exception to show a user friendly error page this erro is not logged at OAS.
How to do it?
Thanks in advance.
EXCEPTION WHEN OTHERS THEN
HTP.P('Sorry');
emailme(SQLERRM);
emailme(line where erro occurs);???????
END;
<HR></BLOCKQUOTE>
Hi;
your best bet would be to set a variable in the procedure every 10 lines or so, and email the contents of that var.
begin
mydebug:=0;
mydebug:=10;
when others then
emailme(SQLERRM| |' '| |mydebug);
end;
Cheers
Paulo -
How to get the resultset from the field number(11,2) ???
i can get it by rs.getString() but i do not know how to convert String to Number(11,2)?
i dun know exactly what u meant, but to convert string to int is to use Integer.parseInt("555")...
Maybe you are looking for
-
Hello, I'm trying to create a button menu with popup but come to the following problem: I can import a button, but I want to use my own and not the premade. I have made the button with insert/new button. All ok untill there, but I want to save the bu
-
[SOLVED] lspci only detecting half my video RAM
So i needed to look up details about my video card when i noticed something strange. It seems the system is only allocating half of the available video memory for some reason. What's the reason for this? I haven't tweaked it or assigned any swap memo
-
I just bough the new Iphone 4. Can you sort contacts by company rather than name?
-
Parallels 7 on Mac 10.7.4
I bought a new MacBook Pr with 10.7. Installed Parallels Desktop 7. Seemed to install okay, but won't load Windows XP Pro. The Parallels website says that there is an upgrade fix, but I can't find it. Any help?
-
Installation error 29506 on SQL Management Studio...
hai...... I've several ways in tried to install SQL management studio including running of cmd prompt as admin.But the installer shows that "the installer has encountered an unexpected error installing this package.This may indicate a problem with th