How to use stored procedure with many return results and variable with perl
Hi everybody,
i´m writtting now a Perl programm, wich use a oracle stored procedure with more than 1 result and 1 variable(I have to return 2 variable fpr each result). I don´t now how I can get it.I already search the web but I didn´t find.
My example:
PROCEDURE get_projects_and_sub_projects (
v_project_id IN INTEGER,
v_project_c_id OUT INTEGER,
v_project_id_find OUT VARCHAR2
IS
BEGIN
SELECT c_id, proj_id
INTO
v_project_c_id,
v_project_id_find
FROM t_projet
WHERE t_projet .ksa_pro_art_kbz = 'KU'
AND t_projet.proj_id LIKE v_project_id || '%';
EXCEPTION
WHEN NO_DATA_FOUND
THEN
v_project_c_id := NULL;
v_project_id_find := NULL;
WHEN OTHERS
THEN
kmessages.error (NULL,
'get_projects_and_sub_projects',
'Project-Name: ' || v_project_id,
'Errornumber: '
|| SQLCODE
|| ' Error: '
|| SQLERRM,
TRUE,
TRUE
raise_application_error (-20001,
'Error '
|| SQLCODE
|| ' get_projects_and_sub_projects: '
|| SQLERRM,
TRUE
END get_projects_and_sub_projects;
in Perl Program:
sub get_projects_unterprojects_name($$){
my ($db_handle, $proj_name_id) = @_; #$db_handle ist the DB Connection return value
my $db_proj_c_id;
my $db_proj_name;
eval{ my $csr = $db_handle->prepare(q{
BEGIN
pro_doc_ber.get_projects_and_sub_projects(:proj_name_id, :db_proj_c_id, :db_proj_name);
END;
# parameter value
$csr->bind_param(":proj_name_id", $proj_name_id);
# return values
$csr->bind_param_inout(":db_proj_c_id", \$db_proj_c_id, 11);
$csr->bind_param_inout(":db_proj_name", \$db_proj_name, 20);
$csr->execute(); };
But this didn´t work. Could somebody give me some idea?
Thank you
Felx
Some additional info would probably be helpful.
What is your programming enviironment? Java?
In any case I suspect that you will need to use the OCI to deal with specific Oracle types such as user defined object types -- thats not standard ANSI SQL.
In Java I believe you need to use OPAQUE, there are some examples out there. I'm mostly a PL/SQL developer with some Java expereince so others here are more qualifed to answer your question more directly.
Similar Messages
-
How to use Stored Procedures in JDBC sender side and receiver side
Hello,
Can anyone explain how to use stored procedures in configuring the scenario using JDBC adapter at bothe sides sender nad receiver..
Thanks,
SooryaHi,
Refer the below link:
JDBC:
Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
Stored Procedures-
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
http://www.ics.com/support/docs/dx/1.5/tut6.html
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
http://www.ics.com/support/docs/dx/1.5/tut6.html
http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
http://www.sqlteam.com/article/stored-procedures-an-overview
HI in the message mapping structure u need to specify the different action and also u need to specify the procedure name.
refer the below link which has all the associated action
http://help.sap.com/saphelp_nw04s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
Chirag -
How to use stored procedures in DIAdem and Can the stored procedures be used to return values?
Can anyone please tell me how to use stored procedures in diadem and to return values from it. Its really important, can you please answer it at the earliest.
Thanks In advance
spiyaHi Spria,
I'm very sorry for the mix-up, I thought Allen was going to answer you back with the particulars that we found out. Check out the attached Word document and the below tidbits:
The built-in DIAdem ODBC functions {SQL_...()} can only call stored functions, which return a scaler result {found then in SQL_Result(1,1)}. The syntax for this with an ORACLE db is
"select function(parameters) from package"
...where package defaults to "dual" if you don't use your own package.
There might be exceptions to that though, and the syntax will be different for other databases. Note that stored ORACLE procedures can NOT be called from the ODBC functions, instead you must use either ADO function calls in the DIA
dem VBScript or the OO4O COM wrapper that ORACLE provides (this is described in further detail in the below Word document).
Hope this helps,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
Attachments:
Calling_ORACLE_Stored_Procedures_from_DIAdem.doc 28 KB -
How to use Stored Procedure Call in Sender JDBC adapter
Hi All,
Could someone send me a blog on how to use Stored Procedure call in Sender JDBC adapter?
XierHi Xler
refer these links
/people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
Also, you can check Sriram's blog for executing Stored Procedures,
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
/people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter
This blog might be helpfull on stored procedures for JDBC
JDBC Stored Procedures
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
Please go through these threads and see if it helps...
Re: How to execute Stored Procedure?
Re: Problem with JDBC stored procedure
Thnaks !! -
How to use Stored Procedures in form 6i Blocks
Dear Friends,
I would like to know how to use Stored Procedures while creating blocks in Data Block Wizard in forms 6i application.
Please send me sample code of stored procedure.
Regards,
Khader.The Data Block Wizard is not for creating stored procedures. It will allow you to use a stored procedure in your form. See the help documentation for how to use the wizard.
Here's an example of a simple procedure. If you search the database forum or the web, you will find many examples.
CREATE OR REPLACE PROCEDURE procedure_name (value OUT NUMBER ) AS
BEGIN
SELECT COUNT(*) INTO value
FROM your_table;
END;
Message was edited by:
Mark Roberts -
HOW TO USE STORED PROCEDURES IN JASPERREPORTS(URJENT)
Hi,
i'm using jasperreports in struts based project. How to use stored procedures in jasperreports. pls send the solution urjent
Thanks in advance
rameshHi,
Refer the below link:
JDBC:
Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
Stored Procedures-
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
http://www.ics.com/support/docs/dx/1.5/tut6.html
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
http://www.ics.com/support/docs/dx/1.5/tut6.html
http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
http://www.sqlteam.com/article/stored-procedures-an-overview
HI in the message mapping structure u need to specify the different action and also u need to specify the procedure name.
refer the below link which has all the associated action
http://help.sap.com/saphelp_nw04s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
Chirag -
How to use stored procedure which returns result set in OBIEE
Hi,
I hav one stored procedure (one parameter) which returns a result set. Can we use this stored procedure in OBIEE? If so, how we hav to use.
I know we hav the Evaluate function but not sure whether I can use for my SP which returns result set. Is there any other way where I can use my SP?
Pls help me in solving this.
ThanksHi Radha,
If you want to cache the results in the Oracle BI Server, you should check that option. When you run a query the Oracle BI Server will get its results from the cache, based on the persistence time you define. If the cache is expired, the Oracle BI Server will go to the database to get the results.
If you want to use caching, you should enable caching in the nqsconfig.ini file.
Cheers,
Daan Bakboord -
How to use Stored Procedure in RPD
In the physical layer we have a option for procedure when we select a tables general tab.I created the procedure
but i am not able to retrieve values in the Dashboard.
Could anyone help me with this as how to use procedure.Oracle stored procedure don't return recordssets. You have to put the result of the stored procedure in a global temp table and reference the rpd to that table. the execution of the stored procedure can be triggerd form the "execute before query" part in the connection pool.
regards
John
http://obiee101.blogspot.com/ -
How to use stored procedure in crystal report for eclipse
Hi;
I am working on crystal report for eclipse 2.0 and trying to use stored procedure in report .It is created from Oracle but it is not showing any dependencies
CREATE OR REPLACE procedure ACT_DB.getCostTransferDetails
p_In_Contract_ID varchar2 DEFAULT '*',
p_In_Status_ID varchar2 DEFAULT '*',
p_In_COST_TRAN_DATE varchar2 DEFAULT '*',
p_In_DEPT_ID varchar2 DEFAULT '*',
p_In_PROJECT_ID varchar2 DEFAULT '*',
p_In_EMPLOYEE_ID varchar2 DEFAULT '*',
p_Out_CostTransfer_Cusor OUT COST_TRANSFER_PACKAGE.COST_TRANSFER_TYPE
AS
BEGIN
OPEN p_Out_CostTransfer_Cusor FOR
SELECT
header.cost_tran_id,
header.cost_tran_date,
header.total_credit_amount,
header.total_debit_amount,
header.transfer_status,
header.updated_by,
header.added_by,
header.trf_over_ninety_days,
header.business_unit_id,
header.equip_approval,
header.batch_desc,
details.opr_unit_id,
status.status_id,
details.fund_code_id,
details.prgm_code_id,
details.class_id,
details.activity_id,
details.product_id,
details.status_id,
details.transaction_amount,
details.jrnl_date,
details.adjust_prcnt,
details.adjust_amnt,
details.details_equip_approval,
details.detail_desc,
details.account_id,
details.project_id,
details.dept_id,
details.contract_id,
details.reason_code_id,
details.jrnl_id,
employee.f_name,
employee.l_name,
employee.employee_id,
project.project_id,
project.project_status,
--header.transfer_status,
contracts.contract_desc
FROM header, details, status, employee, department, project, contracts
WHERE (header.cost_tran_id = details.cost_tran_id)
AND (header.cost_tran_date = details.cost_tran_date)
AND (header.transfer_status = status.status_id)
AND (department.dept_id = details.dept_id)
AND (department.dept_id = employee.dept_id)
AND (project.project_id = details.project_id)
AND (contracts.contract_id = details.contract_id)
AND (details.Contract_ID = p_In_Contract_ID OR p_In_Contract_ID ='*' )
AND (header.TRANSFER_STATUS = p_In_Status_ID OR p_In_Status_ID ='*' )
AND (TO_CHAR(details.COST_TRAN_DATE, 'MM/DD/YYYY') = p_In_COST_TRAN_DATE OR p_In_COST_TRAN_DATE ='*' )
AND (details.DEPT_ID = p_In_DEPT_ID OR p_In_DEPT_ID ='*' )
AND (details.PROJECT_ID = p_In_PROJECT_ID OR p_In_PROJECT_ID ='*' )
AND (header.ADDED_BY = p_In_EMPLOYEE_ID OR '*'=p_In_EMPLOYEE_ID )
Can any another way to make procedure
Thanx
Regards ,
AmolHi Amol,
Are you able to execute your stored procedure from oracle?.
- If "Yes" then use the Crystal Report XIR2 Designer to create the report.
- Import this report in the Crystal Report For Eclipse Workbench.
- The latest version for Crystal Report For Eclipse is SP1.
Please let me know the results.
Thanks,
Neeraj -
How to use Stored Procedures with SQLServer2005 and WAS 6.x
Hi All
I've got a problem, during the call to a StoredProcedure in SQLServer i've get the next message:
Exception : com.microsoft.sqlserver.jdbc.SQLServerException: Fetch size cannot be negative
The stored procedure is working correctly if I run my process out of WAS 6.x but if I get a connection from the pool the process don't work.
Help please, thanks.Your procedure has a single OUT parameter ... and yet it appears you are trying to stuff something into it ... that is never going to work. Additionally everything else about your stored procedure would have gotten you a FAIL grade were you been in my beginning PL/SQL class.
The syntax, a cursor loop, is obsolete and has been for more than 10 years.
The formatting and use of case makes even the few lines written hard to read.
And either no commit ever takes place or you are trying to do incremental commits in origseq: Both of which are bad practice.
This code should use BULK COLLECT to collect all relevant records into an array and then pass the array to origseq ... no loops ... and end with a commit.
Demo here: http://www.morganslibrary.org/reference/array_processing.html -
How to use Stored Procedures in Sender JDBC Adapter.
Hi Experts,
we are having a lot of legacy application which are on .Net. basicaly using MS SQL & stuff. As a Integration scenario we have to triggered some events from JDBC to XI. How can i do this. Secondly there are multiple tables from which i will be selecting a record & sending it to XI for further processing the Receiver Side we are having SAP system.
How can i use a Stored procedure in XI Sender Adapter ?
Can anybody tell me step by step how to get the XSD of Stored procudere & used in XI. ?
I am new to XI. I have not yet configured any sceneario.
Can anybody guide me step by step how to do this.
I am only intersted in Sender Side configuration.
Regards,
UmeshHey,
check this in the JDBC Sender Adapter Configuration
Query SQL Statement -> Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs.
http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
JDBC adapter
/people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter
<b>Cheers,
*RAJ*
*REWARD POINTS IF FOUND USEFULL*</b> -
How to use stored procedures in TestStand
I am trying to run a stored procedure but always get the error:
Error executing substep 'Post'.
The following SQL command failed: 'EXEC dbo.sp_test...'
Native error code -2147217887 0x80040e21
Microsoft OLE DB Provider for SQL Server:
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.NI_jc,
> I am trying to run a stored procedure but always get the error:
>
> Error executing substep 'Post'.
> The following SQL command failed: 'EXEC dbo.sp_test...'
> Native error code -2147217887 0x80040e21
> Microsoft OLE DB Provider for SQL Server:
> Multiple-step OLE DB operation generated errors. Check each OLE DB
> status value, if available. No work was done.
In my dealings with TestStand and SQL, such errors are ~usually~ related to
either security permissions or the parameters passed to the stored
procedure.
Can you successfully run the stored procedure from SQL Query Analyzer using
the same username and password (and other connection info) that you use in
the DataLink used in TestStand?
If so, I would then look at the parameters you are passin
g to the stored
procedure. Verify you are passing the correct number and correct data types
for each parameter the stored proc expects.
If that all checks out, double check that you are using the correct
connection handle, etc.
Good luck,
Bob -
How to use stored procedures in postgresql
hiii,
if any body knows how to create a stored procedure in postgresql
please help meHi,
Refer the below link:
JDBC:
Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
Stored Procedures-
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
http://www.ics.com/support/docs/dx/1.5/tut6.html
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
http://www.ics.com/support/docs/dx/1.5/tut6.html
http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
http://www.sqlteam.com/article/stored-procedures-an-overview
HI in the message mapping structure u need to specify the different action and also u need to specify the procedure name.
refer the below link which has all the associated action
http://help.sap.com/saphelp_nw04s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
Chirag -
HOW TO USE STORED PROCEDURE IN JDEVELOPER - TOPLINK
-- I really have problem try to do that!!!..
I put the code of adf guide for toplink but have two errors:
StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("CHECK_VALID_POSTAL_CODE");
call.addNamedArgument("POSTAL_CODE");
call.addNamedArgumentValue("L5J1H5");
ValueReadQuery query = new ValueReadQuery();
query.setCall(call);
Number isValid = (Number) session.executeQuery(query);
error:
- call.addNamedArgumentValue("L5J1H5"); is not accepted
- session.executeQuery(query); there is no session var defined
Can someone tell me the correct form to call store procedure using a method for commandbutton??
Message was edited by:
user572789Hi Amol,
Are you able to execute your stored procedure from oracle?.
- If "Yes" then use the Crystal Report XIR2 Designer to create the report.
- Import this report in the Crystal Report For Eclipse Workbench.
- The latest version for Crystal Report For Eclipse is SP1.
Please let me know the results.
Thanks,
Neeraj -
How to use stored procedures in AJAX operations?
Hi,
First of all I hope this is the right place to post my question.
I am creating an application which involves AJAX style update of a specific page. I managed to make it work via the "classical JavaScript calling an On Demand Application Process then passing back result to JavaScript" way.
Despite everything works just fine the only annoyance is that I would like to call a Stored Procedure instead of an On Demand Application Process. But this is where I'm stuck.
I don't know whether the htmldb_Get() function inside the the JavaScript calling the On Demand Application Process can be used to call a Stored Procedure.
My motivation behind this are the follows:
- Stored Procedures can be edited by SQLDeveloper while On Demand Processes not (at least I could not find a way)
- The source code of an AJAX request/operation would me much more structured if it is made from smaller Stored Procedure parts instead of wiriting one "giant" On Demand Process.
Any suggestion is highly appreciated!
Thanks!
Zahoo
Edited by: user5516029 on Jan 19, 2009 1:20 AMHi,
Refer the below link:
JDBC:
Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
Stored Procedures-
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
http://www.ics.com/support/docs/dx/1.5/tut6.html
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
http://www.ics.com/support/docs/dx/1.5/tut6.html
http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
http://www.sqlteam.com/article/stored-procedures-an-overview
HI in the message mapping structure u need to specify the different action and also u need to specify the procedure name.
refer the below link which has all the associated action
http://help.sap.com/saphelp_nw04s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
Chirag
Maybe you are looking for
-
Trying to do clean install from USB after kernel problem
MacBook Pro 13" Mid 2010 - was running OS X v 10.9 - 2.4 GHz Intel Core 2 Duo processor Machine was running extremely slow, unable to do anything with it. When booted to safe mode, lag issue was not present. Booted to Disk Utility, left column showed
-
How do i get a printer to work?
Hello i am new to mac os i have used windows all my life so im not quite use to mac os yet so iv tried to set up the printer to work from my macbook pro but i cant get it to work. the printer is on a homenetwork connected to a windows computer which
-
Have an iPad 2 that's just 2 weeks old. Has been working fine until tonight when I went to turn down the volume...wouldn't turn down, will only turn up. Anyone else had this happen and suggestions to try and fix? Thanks
-
Printer uninstall loop cannot be corrected
I have recently reinstalled with the installation disk my HP officejet 4500 G510g-m printer. (I no longer needed it to function as a network printer and was plugging it directly into my HP Probook 4530s with a LAN connector cable.) The printer is w
-
I am brand new to Aperture. I have imported my iPhoto library over (keeping the files in their original location) and am confused about the best way to organize my new photos coming off my camera to the Aperture library. I don't really understand the