Stored procedures with view in tabular form
Dears,
i use apex 4.2 and database xe 11g , i have create tabular depend on view and i use stored procedures in process after computation and validation , the problem that view not update
this tabular form query
select
"ROWID",
"DOC_DET_ID",
"DOC_ID",
"MOV_QNTY",
BATCH_DET,
"ITEM_NAME",
"UOM_NAME",
"SIZE_NAME",
"COLOR_NAME",
"STOREG_BRCHAS_BATCHINTERNN",
"EXPR_DATE",
"PROD_DATE",
AVL_QNTY,
storage_code,
"LOCATION_CODE"
from "#OWNER#"."STORAGE_MOV_DET_VIEW"
WHERE DOC_ID =:P117_DOC_IDthis a process that i use stored procedure in it
DECLARE
V_OLD NUMBER:=0;
BEGIN
FOR i IN 1 .. apex_application.g_f02.COUNT LOOP
IF apex_application.g_f02 (i) IS NOT NULL THEN
SELECT MOV_QNTY INTO V_OLD
FROM STORAGE_MOV_DET
WHERE DOC_DET_ID =apex_application.g_f02 (i);
IF apex_application.g_f13 (i) > V_OLD THEN
V_OLD :=apex_application.g_f13 (i)- V_OLD;
END IF;
ELSE
V_OLD :=apex_application.g_f13 (i);
END IF;
if V_OLD <> 0 then
GET_EXTRACT_PARENT_ITEM(apex_application.g_f04 (i) ,
:P117_STORAGE_CODE ,
apex_application.g_f12 (i) ,
V_OLD);
end if;
END LOOP;
END;when i use update this error i found
Current version of data in database has changed since user initiated update process. current row version identifier = "A80CEBCFF06062F98D920BC75CB415AE" application row version identifier = "BCBA67120A87213D64EE059E10F3B15C" (Row 1)please help
Do you still have the Apply MRU process running? I assume you do because otherwise you wouldn't receive the error message. Is the process you are talking about running before the Apply MRU process? It seems it does. Try chaning the execution sequence and run this process after the automatic MRU process.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.apress.com/9781430235125
http://apex.oracle.com/pls/apex/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
-------------------------------------------------------------------
Similar Messages
-
How to handle Stored Procedure and Views
Dear All
While dealing with Oracle database related scenario. I came across Stored Procedures and Views. Which are complex in nature. Using SAP XI how we can handle them ?
Is JDBC adaptor is capable of that.? Can you help me Data type structure for oracle.
How max occur play important role in that. How to identify root and item level structure for oracle
I am dealing with stored procedures while inserting data. and using views i need to get data from oracle database.
What is the syntax of query we use to put while using JDBC adaptor?
Please help and provide bit detail information over this so that i can execute scenario
Thanks
Gaurav1) jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:sid
2)Occurence==> o,1, >1 , Unbounded
Occurrence=> ready to accept 0 / 1 / more than 1/ multiple record (for source) and how it will be passed to target.
http://help.sap.com/saphelp_erp2004/helpdata/en/b6/0b733cb7d61952e10000000a11405a/frameset.htm
3)
<StatementName5>
<storedProcedureName action= EXECUTE>
<table>realStoredProcedureeName</table>
<param1 [isInput=true] [isOutput=true] type=SQLDatatype>val1</param1>
</storedProcedureName >
</StatementName5>
refer
http://help.sap.com/saphelp_nw04/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm -
Stored Procedure with Input & output parameter as XML
Hi
I have a requirement wherein i need to have a stored procedure with accepts huge XML from Java and the SP has to process all the records in the XML and return XML output with some messages in it.
Currenty, I have a stored procedure to process the xml stored in Oracle Database.
I am using the following SQL statement to read the data from the XML column.
select xmltest1.id,xmltest1.name
from xmltest,
XMLTABLE(
XMLNamespaces(default 'syncpsna/schemas'),
'/XMLTestRequest/insert/row'
PASSING xmltest.data_xml
COLUMNS
"ID" number(10) PATH 'id',
"NAME" varchar2(50) PATH 'name') xmltest1
where xmltest.id = 2;I want to execute similary queries to fetch data from the XML Passed as an input parameter from JAVA.
if i could get some examples of reading the XML and sending the xml back to the calling program.
RegardsHi,
if i could get some examples of reading the XML and sending the xml back to the calling program.What kind of process do you want to perform on the input XML?
You said "reading", but for what purpose? Storing data in the database, or just transform the XML into another form?
Anyway, you'll probably need a function, something like :
create or replace function processXML (inputXML in xmltype)
return xmltype
is
outputXML xmltype;
begin
-- process inputXML here, and construct outputXML
return outputXML;
end;Back in Java, you can use the oracle.xdb.XMLType class to map the XMLType SQL datatype to a Java object and manipulate it. -
Stored Procedure vs Views, Please clearify.
Hi Gents,
I am working on client side as a crystal report developer, the client has several applications linked to each other by some means and each application has its own database. They have created a common database called Reporting Layer, the database consists of only stored procedures, that is the stored procedures are collecting data from all the databases and making up a dataset. Now I need to develop reports using these stored procedures. Consider these stored procedures as tables for now.
If you have got the basics, here is my concern about using stored procedures for the reports.
Example : Say I need to refer 3 stored procedures for my report to get the required data then I need to call or attach all the three stored procedures with crystal and link them properly to get the required data. The question here is, say I need only 2 columns from each stored procedure then I simply drag the columns needed and drop on the reports...!!!
So if I had a view instead of a stored procedure then I could refer 3 views in the command object or might have written a stored procedure to return the results containing only the columns the report is ment for.
Select v1.a, v1.b, v2.a, v2.b, v3.a, v3.b from v1,v2,v3 where v1.id = v2.id and v1.id = v3.id
or
Select v1.a, v1.b, v2.a, v2.b, v3.a, v3.b from v1 inner join v2 on v1.id = v2.id inner join v3 on v1.id = v3.id
I want to explain this to my client and ask them to convert all the stored procedures to views, please suggest what can I tell them ? And if you think that the method my client has opted that is of stored procedures is better than views then please explain in this scenario.
Thanks
-AzharHi Azhar,
Not sure if you are in the right place, you would likely get a better description if you post your question to the Forums for which ever DB server you are using. They likely have more detailed info on the efficiencies of each.
For Crystal Reports one possble scenario with using multiple Stored Proceedures (SP) is that each SP would or should be in it's on subreport. Unless you can link them, this will cause the SP to run each time that section is hit. Worst Example is if you put the subreport in the detail section for every record returned the subreport would run. If in the group header for each Group header condition met the subreport would run.
Using them in a Command Object would work but not that efficient and would be better if you used one SP to get the data or use a database to save all the data into as you suggested and report directly off of it.
As for the amount of data the SP returns CR may only ask for the fields used, depends on a few conditions, or it may have to get all of the data and filter out just the fields used in the report. Could be a big delay waiting for the SP to run and/or client side data filtering.
As for Views all the data collection is done server side, same as an SP, but only one view would be required. Or you may want to create specific SP's for use in the reports and not use Command Objects but simply drop the SP into the Database Wizard as the data source. This way all data collection is done server side which is much more efficient and CR at filtering data.
CR does not care if you use Views or SP's, we are simply sending the SQL to the server and waiting for the results. Which one is more efficient is more for that DB forum to answer.
Hope this helps
Don -
How to change stored procedure with Table Valued Parameter
I am not sure how to change the normal stored procedure with Table Value Parameter.Do I have to create a separate Table or do I have to create a datatype. Can you please help me with this
ALTER PROCEDURE [dbo].[uspInsertorUpdateINF]
@dp_id char(32),
@dv_id char(32),
@em_number char(12),
@email varchar(50),
@emergency_relation char(32),
@option1 char(16),
@status char(20),
@em_id char(35),
@em_title varchar(64),
@date_hired datetime
AS
BEGIN
SET NOCOUNT ON;
MERGE [dbo].[em] AS [Targ]
USING (VALUES (@dp_id, @dv_id , @em_number, @email, @emergency_relation, @option1, @status, @em_id, @em_title, @date_hired))
AS [Sourc] (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired)
ON [Targ].em_id = [Sourc].em_id
WHEN MATCHED THEN
UPDATE
SET dp_id = [Sourc].dp_id,
dv_id = [Sourc].dv_id,
em_number = [Sourc].em_number,
email = [Sourc].email,
emergency_relation = [Sourc].emergency_relation,
option1 = [Sourc].option1,
status = [Sourc].status,
em_title = [Sourc].em_title,
date_hired = [Sourc].date_hired
WHEN NOT MATCHED BY TARGET THEN
INSERT (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title,date_hired)
VALUES ([Sourc].dp_id, [Sourc].dv_id, [Sourc].em_number, [Sourc].email, [Sourc].emergency_relation, [Sourc].option1, [Sourc].status, [Sourc].em_id, [Sourc].em_title, [Sourc].date_hired);
END;It's not clear how you would change the procedure. But assuming that you want to replace the existing scalar parameters with tabular input, this is how you would do it. You first create a table type:
CREATE TYPE Insertor_type AS TABLE
(dp_id char(32),
dv_id char(32),
em_number char(12),
email varchar(50),
emergency_relation char(32),
option1 char(16),
status char(20),
em_id char(35),
em_title varchar(64),
date_hired datetime)
Then you change the procedure header:
ALTER PROCEDURE [dbo].[uspInsertorUpdateINF] @tvp Insertor_type READONLY AS
And finally you change the USING clause:
USING (SELECT dp_id, dv_id , em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired
FROM @tvp) AS [Sourc] ON [Targ].em_id = [Sourc].em_id
The rest is fine as it is.
Erland Sommarskog, SQL Server MVP, [email protected] -
Calling stored procedures with parameters with the Database Connectivi​ty Toolkit
Hi all,
I am new to the forum and am having difficulty finding a solution to a particular problem I am having regarding using the LabVIEW Database Connectivity Toolkit on a project I am currently working on at my job. I have a database in which I have tables and stored procedures with parameters. Some of these stored procedures have input, output, and return parameters.
I have been trying to follow this example but to no avail: http://digital.ni.com/public.nsf/allkb/07FD130746083E0686257300006326C4?OpenDocument
One such stored procedure I am working on implementing is named "dbo.getAllowablePNs", which executes "SELECT * from DeviceType" (DeviceType is the table). In this case, it does not require an input parameter, it has an output parameter that generates the table [cluster], and has a return parameter which returns an integer value (execution status code) to show if an error occurred. The DeviceType table has 3 columns; ID (PK, int, not null), PN (nvarchar(15), null), and NumMACAddresses (int, null). I have gone over many examples and have talking to NI support to try to implement this and similar stored procedures in LabVIEW but have not been successful. I am able to connect to the database with the Open Connection VI without error, but am running into some confusion following this step. I am then trying to use the Create Parameterized Query VI to call the stored procedure and set the parameters. I assume I would then use the Set Parameter Value VI for each parameter that is wired into the parameters input on the previous Parameterized Query VI? I am also having some confusion during and following these steps as well. I would greatly appreciate any advice or suggestions anyone might have in regards to this situation as I am not a SQL expert. Also, I would be happy to provide any more information that would be helpful.
Regards,
Jon
Solved!
Go to Solution.Also, I don't know if this would be helpful but here is the actual stored procedure in SQL:
CREATEPROCEDURE [dbo].[getLastSequenceNumber]
@p1 nvarchar(10)='WO-00000'
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SETNOCOUNTON;
-- Insert statements for procedure here
selectmax(SequenceNumber)from Devices where WorkOrderNumber= @p1
END
GO -
Using stored procedures with a timestamp parameter with Delphi and ADO
Dear Oracle experts,
I have a problem concerning using a stored procedure with Delphi.
I try to use a stored procedure which hast two input parameters ( a integer and a timestamp).
The timestamp parameter is my problem since I would like to use the "to_timestamp"
Oracle-function to create the timestamp parameter to be inserted into my procedure.
If I insert the to_timestamp statement as a adodatetime I have to perform the conversion to the oracle timestamp in my application.
If I want to use the to_timestamp statement I have to use the ftstring datatype but in that case I get an error because I use a string as input for my procedure were it awaits a timestamp.
So the problem seems to be that the function call "to_timestamp" is not interpreted if it is transferred through my ADO component.
Do you know how to use a procedure with Delphi (ADO) with a function as input parameter ?
Best regards,
Daniel Wetzler
P.S. :
This is the Delphi code to use my Procedure.
FactsTempDS:=TADODataset.Create(nil);
Sproc1 := TAdoStoredProc.Create(nil);
Sproc1.Connection := TDBConnection(strlistConnectionstrings.objects[iConnectionIndex]).Connection;
Sproc1.ProcedureName := 'ECSPACKAGE.PROCFINDINITIALSWITCHSTATE';
Sproc1.Parameters.CreateParameter ('SwitchID',ftInteger,pdinput,0,0);
//Sproc1.Parameters.CreateParameter ('StartTime',ftdatetime,pdinput,50,0);
Sproc1.Parameters.CreateParameter ('StartTime',ftString,pdinput,50,0);
Sproc1.Parameters.Findparam('SwitchID').value:=SwitchID;
Sproc1.Parameters.FindParam('StartTime').Value:= 'to_timestamp(''2005/12/30 19:36:21'', ''YYYY/MM/DD HH:MI:SS'')';
Sproc1.CursorType := ctKeyset;
Sproc1.ExecuteOptions:=[];
Sproc1.Open;
Sproc1.Connection := nil;
FactsTempDS.Recordset:= sproc1.Recordset;
if FactsTempDS.RecordCount=0
then raise Exception.Create('No line switch variable found for switch '+IntToStr(SwitchID)+' before starttime. Check BDE dump filter.')I have my entity manager setup in a singleton.
I'm finding it's costly to generate the emf, but if I don't close the em (enitity manager) and emf (entity manager factory) my open cursor count climbs until I exceed the max number of open cursors on the database (11g RAC)
I'm committing the connection, and uow, and closing the em at the end of each call.
But until I close the emf, the open cursors aren't released.
TransactionhistoryPkg tranPkg = new TransactionhistoryPkg(conn); //Class created over database package via JPublisher
tranPkg.transactionhistoryInsSp(insertTrans.getCardId()); // executes db package
tranPkg.closeConnection();
conn.commit();
uow.commit();
uow.getAccessor().decrementCallCount();
em.close();
Am I missing something really obvious here??
btw - I found this link helpful in troubleshooting the max cursors issue: https://support.bea.com/application_content/product_portlets/support_patterns/wls/InvestigatingORA-1000MaximumOpenCursorsExceededPattern.html -
Calling a stored procedure with a CLOB as input parameter
Hello,
I was unsuccessfully trying to call a stored procedure with a clob as input parameter from my C++ application using occi.
Anyone got a working example to look at?
I already checked the thread Invalid OCI handle when creating a Blob which didn't help.
The problem seems to be that I don't have a lob locator to write my data (xml file) to. I tried creating a temporary clob using the sys.dbms_lob package which only resulted in a major headache on my part...
I would appreciate any help.
Kind regards
Horst
my environment:
Visual Studio 2008, C++ application
Oracle 11gTo start using a blob you have to insert it into the database and then get it back. Sounds weird but that is how it is. Here is a very simple program to do this:
#include<occi.h>
#include <iostream>
using namespace oracle::occi;
using namespace std;
int main()
try
Environment *env = Environment::createEnvironment(Environment::OBJECT);
Connection *conn = env->createConnection("hr","hr","");
string stmt1 = "insert into blob_tab values (:1) ";
string stmt2 = "select col1 from blob_tab";
Blob blob(conn);
blob.setEmpty(conn);
Statement *stmtObj = conn->createStatement(stmt1);
stmtObj->setBlob(1,blob);
stmtObj->executeUpdate();
conn->commit();
Blob blob1(conn);
Statement *stmtObj2 = conn->createStatement(stmt2);
ResultSet *rs = stmtObj2->executeQuery();
while(rs->next())
blob1 = rs->getBlob(1);
string stmt3 = "begin my_proc(:1) ;end;";
Statement *stmtObj3 = conn->createStatement(stmt3);
stmtObj3->setBlob(1,blob1);
stmtObj3->executeUpdate();
catch (SQLException e)
cout << e.getMessage();
/* The tables and procedure are primitive but ok for demo
create table blob_tab(col1 blob);
create or replace procedure my_proc(arg in blob)
as
begin
-- just a putline here. you can do other more meaningful operations with the blob here
dbms_output.put_line('hello');
end;
}Hope this helps.
Thanks,
Sumit -
Calling a Stored Procedure with output parameters from Query Templates
This is same problem which Shalaka Khandekar logged earlier. This new thread gives the complete description about our problem. Please go through this problem and suggest us a feasible solution.
We encountered a problem while calling a stored procedure from MII Query Template as follows-
1. Stored Procedure is defined in a package. Procedure takes the below inputs and outputs.
a) Input1 - CLOB
b) Input2 - CLOB
c) Input3 - CLOB
d) Output1 - CLOB
e) Output2 - CLOB
f) Output3 - Varchar2
2. There are two ways to get the output back.
a) Using a Stored Procedure by declaring necessary OUT parameters.
b) Using a Function which returns a single value.
3. Consider we are using method 2-a. To call a Stored Procedure with OUT parameters from the Query Template we need to declare variables of
corresponding types and pass them to the Stored Procedure along with the necessary input parameters.
4. This method is not a solution to get output because we cannot declare variables of some type(CLOB, Varchar2) in Query Template.
5. Even though we are successful (step 4) in declaring the OUT variables in Query Template and passed it successfully to the procedure, but our procedure contains outputs which are of type CLOB. It means we are going to get data which is more than VARCHAR2 length which query template cannot return(Limit is 32767
characters)
6. So the method 2-a is ruled out.
7. Now consider method 2-b. Function returns only one value, but we have 3 different OUT values. Assume that we have appended them using a separator. This value is going to be more than 32767 characters which is again a problem with the query template(refer to point 5). So option 2-b is also ruled out.
Apart from above mentioned methods there is a work around. It is to create a temporary table in the database with above 3 OUT parameters along with a session specific column. We insert the output which we got from the procedure to the temporary table and use it further. As soon the usage of the data is completed we delete the current session specific data. So indirectly we call the table as a Session Table. This solution increases unnecessary load on the database.
Thanks in Advance.
RajeshRajesh,
please check if this following proposal could serve you.
Define the Query with mode FixedQueryWithOutput. In the package define a ref cursor as IN OUT parameter. To get your 3 values back, open the cursor in your procedure like "Select val1, val2, val3 from dual". Then the values should get into your query.
Here is an example how this could be defined.
Package:
type return_cur IS ref CURSOR;
Procedure:
PROCEDURE myProc(myReturnCur IN OUT return_cur) ...
OPEN myReturnCur FOR SELECT val1, val2, val3 FROM dual;
Query:
DECLARE
MYRETURNCUR myPackage.return_cur;
BEGIN
myPackage.myProc(
MYRETURNCUR => ?
END;
Good luck.
Michael -
T-sql 2008 r2 place results from calling a stored procedure with parameters into a temp table
I would like to know if the following sql can be used to obtain specific columns from calling a stored procedure with parameters:
/* Create TempTable */
CREATE TABLE #tempTable
(MyDate SMALLDATETIME,
IntValue INT)
GO
/* Run SP and Insert Value in TempTable */
INSERT INTO #tempTable
(MyDate,
IntValue)
EXEC TestSP @parm1, @parm2
If the above does not work or there is a better way to accomplish this goal, please let me know how to change the sql?declare @result varchar(100), @dSQL nvarchar(MAX)
set @dSQL = 'exec @res = TestSP '''+@parm1+''','' '''+@parm2+' '' '
print @dSQL
EXECUTE sp_executesql @dSQL, N'@res varchar(100) OUTPUT', @res = @result OUTPUT
select @result
A complicated way of saying
EXEC @ret = TestSP @parm1, @parm2
SELECT @ret
And not only compliacated, it introduces a window for SQL injection.
Erland Sommarskog, SQL Server MVP, [email protected] -
Oracle Stored Procedure with out parameter
Good morning,
Is it possible to use an Oracle stored procedure with out parameters in MII ?
If yes, what is the manipulation to see the values of parameters Out?
Thank youMichael,
This is the MII query template :
DECLARE
STRCOMPTERENDU NVARCHAR2(200);
BEGIN
STRCOMPTERENDU := NULL;
XMII.SP_VALIDATEPROCESSORDERSLIST2 ( STRCOMPTERENDU => [Param.1] );
COMMIT;
END;
and the stocked procedure code
CREATE OR REPLACE PROCEDURE XMII.SP_ValidateProcessOrdersList2(strCompteRendu OUT nVarchar2) IS
tmpVar NUMBER;
debugmode INT;
strClauseSql varchar(2048);
strListPOactif varchar(1024);
dtmTimeStamp DATE;
NAME: SP_ValidateProcessOrdersList
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 18/06/2008 1. Created this procedure.
NOTES:
Automatically available Auto Replace Keywords:
Object Name: SP_ValidateProcessOrdersList
Sysdate: 18/06/2008
Date and Time: 18/06/2008, 18:45:32, and 18/06/2008 18:45:32
Username: (set in TOAD Options, Procedure Editor)
Table Name: (set in the "New PL/SQL Object" dialog)
BEGIN
tmpVar := 0;
debugmode := 0;
-- lecture date systeme pour time stamp
select sysdate into dtmTimeStamp from dual;
if debugmode = 1 then
DBMS_OUTPUT.put_line('SP_ValidateProcessOrdersList');
end if;
-- insertion du bloc dans le log
insert into LOG_ORDER
(DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
values
(dtmTimeStamp,'SP_ValidateProcessOrdersList',ID_LOG_ORDER.nextval);
Commit;
if debugmode = 1 then
DBMS_OUTPUT.put_line('insertion LOG OK');
end if;
strCompteRendu := '0123456-896;0123456-897';
commit;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
ROLLBACK;
-- insertion du bloc dans le log
insert into LOG_ORDER
(DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
values
(dtmTimeStamp,' ',ID_LOG_ORDER.nextval);
COMMIT;
-- Consider logging the error and then re-raise
RAISE;
END SP_ValidateProcessOrdersList2;
Thanks for your help
Alexandre -
Call stored procedure with OUT parameter
Hello,
I have created a short-lived process. Within this process I am using the "FOUNDATION > JDBC > Call Stored Procedure" operation to call an Oracle procedure. This procedure has 3 parameters, 2 IN and 1 OUT parameter.
The procedure is being executed correctly. Both IN parameters receive the correct values but I am unable to get the OUT parameter's value in my process.
Rewriting the procedure as a function gives me an ORA-01460 since one of the parameters contains XML (>32K) so this is not option...
Has someone been able to call a stored procedure with an OUT parameter?
Regards,
NicoObject is Foundation, Execute Script
This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
conn = ds.getConnection();
stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
rs = stmt.executeQuery();
rs.next();
patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
} finally {
try {
rs.close();
} catch (Exception rse) {}
try {
stmt.close();
} catch (Exception sse) {}
try {
conn.close();
} catch (Exception cse) {} -
Calling a stored procedure with RAW and SYS_REFCURSOR
How do you call a stored procedure with the following input and output parameters?
create or replace PROCEDURE test
v_col1 IN NUMBER DEFAULT NULL ,
v_col2 IN VARCHAR2 DEFAULT NULL ,
v_col3 IN RAW DEFAULT NULL ,
v_vol4 IN DATE DEFAULT NULL,
cv_1 IN OUT SYS_REFCURSOR
OPEN cv_1 FOR
SELECT
lv_tmp1 aaaa ,
lv_tmp2 bbbb,
lv_tmp3 cccc
FROM DUAL ;
END;
Edited by: 925963 on Apr 6, 2012 10:50 AMDid you try just declaring the vars?
untested
declare
myCur SYS_REFCURSOR;
myRaw RAW(4);
BEGIN
test (0, 0, myRaw, sysdate, myCur);
END; -
Calling Oracle Stored procedure with OUT parameter from ODI
Hi,
I called an oracle stored procedure with following anonymous block in the ODI procedure.
Declare
Status varchar2(10);
Begin
OTM.DeleteTarget('E_KPI_TARGET_VALUE', Status);
End;
I want to capture the OUT parameter STATUS value in a project level variable.
And based on its va;lue I would like to choose between 2 interfaces in my package.
Please help me in doing this.Hi,
For that kind of situation I commoly use:
1) one step with:
create or replace package <%=odiRef.getSchemaName("W")%>.pck_var
Status varchar2(10);
end;
* transaction 9, for instance
2) step
Begin
OTM.DeleteTarget('E_KPI_TARGET_VALUE', <%=odiRef.getSchemaName("W")%>.pck_var.Status);
End;
* transaction 9
3) then, at an ODI variable, use a refresh like:
select <%=odiRef.getSchemaName("W")%>.pck_var.Status from dual
at same logical shema where the package was created.
Does it make sense to you? -
Calling stored procedure with output parameters in a different schema
I have a simple stored procedure with two parameters:
PROCEDURE Test1(
pOutRecords OUT tCursorRef,
pIdNumber IN NUMBER);
where tCursorRef is REF CURSOR.
(This procedure is part of a package with REF CURSOR declared in there)
And I have two database schemas: AppOwner and AppUser.
The above stored procedure is owned by AppOwner, but I have to execute this stored procedure from AppUser schema. I have created a private synonym and granted the neccessary privileges for AppUser schema to execute the package in the AppUser schema.
When I ran the above procedure from VB using ADO and OraOLEDB.Oracle.1 driver, I got the following error when connecting to the AppUser schema:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEST1'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
but when I was connecting to the AppOwner schema, everything is running correctly without errors.
Also, when I switch to the microsoft MSDAORA.1 driver, I can execute the above procedure without any problems even when connecting to the AppUser schema.
I got this error only when I am trying to execute a stored procedure with an output parameter. All other procedures with only input parameters have no problems at all.
Do you know the reason for that? Thanks!If anyone has figured this one out let me know. I'm getting the same problem. Only in my case I've tried both the "OraOLEDB.Oracle" provider and the "MSDAORA" provider and I get an error either way. Also my procedure has 2 in parameters and 1 out parameter. At least now I know I'm not the only one with this issue. :)
'*** the Oracle procedure ***
Create sp_getconfiguration(mygroup in varchar2, myparameter in varchar2, myvalue out varchar2)
AS
rec_config tblconfiguration.configvalue%type;
cursor cur_config is select configvalue from tblconfiguration where configgroup = mygroup and configparameter = myparameter;
begin
open cur_config;
fetch cur_config into rec_config;
close cur_config;
myvalue := rec_config;
end;
'** the ado code ****
dim dbconn as new adodb.connection
dim oCmd as new adodb.connection
dim ors as new adodb.recordset
dbconn.provider = "MSDAORA" 'or dbconn.provider = "OraOLEDB.Oracle"
dbconn.open "Data Source=dahdah;User ID=didi;Password=humdy;PLSQLRSet=1;"
set ocmd.activeconnection = dbconn
cmd.commandtext = "{call fogle.sp_getconfiguration(?,?)}"
'i've also tried creating a public synonym called getconfiguration and just refering to procedure by that.
' "{call getconfiguration(?, ?)}"
' "{call getconfiguration(?,?, {resultset 1, myvalue})}"
'and numerous numerous other combinations
set oPrm = cmd.createparameter("MYGROUP", advarchar, adparaminput, 50, strGrouptoPassIn$)
cmd.parameters.append oPrm
set oPrm = cmd.createParameter("MYPARAMETER", advarchar, adParamInput, 50, strParameterToPassIn$)
cmdParameters.append oPrm
set rs = cmd.execute
Maybe you are looking for
-
How to send a ttl signal with a good exactitude less than 10ms?
i have a pci 6013 (8 input channel) and pci 6711 (4 outpout channel).Then i need to send a ttl signal to a camera ccd to take a photo when a waveform sinus is equal at zero (rising), but when i send this TTl signal with dasylab using generator pulse
-
Quicktime 7.2 "Unexpectedly Quits" (crashes) - trying to capture
There is something up with the quicktime software not communicating with the Firewire device. Quicktime 7.2 unexpectedly quits after I try to either: make a new recording, or goto preferences/recording Suggestions? Help! -Much appreciated. JSAP
-
Ok, it seems that my photo gallery and video gallery decided to delete themselves. Is there a way to recover them perhaps from a trash can or deleted file? I have a Android
-
We are receving a column values (example: Product Description) which is in a chinese language. Those rows has to be converted in to a English and load it in database custom table. Any possibilities? Thanks & Regards, Balakirshna
-
I have Table Columns ID NUMBER1 NUMBER2 1A 20 1A 21 1B 22 1B 23 1C 24 1C 25 I need a Query like below ID NUMBER1||NUMBER2 1A 20-21 1B 22-23 1C 23-24 Any help is appreciated Thanks