Using Parameterized Arrays in Stored Procedure
I tried following code to pass array value to stored procedure but its giving error, as I am new to this procedure, please advise what am I missing ?
Best Regards,
Luqman
My code is as below.
CREATE TYPE num_array AS table of number;
create or replace procedure give_me_an_array
( p_array in num_array )
as
begin
for i in 1 .. p_array.count
loop
dbms_output.put_line( p_array(i) );
end loop;
end give_me_an_array;
declare
mdata num_array;
begin
mdata(1) := 1234;
mdata(2) := 10;
give_me_an_array(mdata);
end;
Hi Satya,
Now I got it, thanks,
Can you please advise, if I use the same stored procedure for EMP Table and use my array values to retrieve the selected EMPNo
I tried following but I could not succeed.
When I compile the stored procedure, error occurs:
"inconsistent datatypes: expected NUMBER got NUM_ARRAY"
for example:
CREATE TYPE NUM_ARRAY AS TABLE OF NUMBER;
Create or Replace Package TB_Data
Is Type CV_Type Is REF CURSOR;
END TB_DATA;
Create or Replace Stored Procedure give_me_an_array
(CV IN OUT TB_DATA.CV_TYPE,
MEmpNo In Num_Array)
Is
Begin
Open CV for
Select * from EMP
Where Empno in MEmpNo;
End myProc;
declare
mdata num_array:=num_array(7839,7844);
begin
give_me_an_array(mdata);
end;
Best Regards,
Luqman
Similar Messages
-
StoredProcedureCall with IN OUT Parameters order in Stored Procedure
Refer to the Toplink documentID:Note 224269.1 - Using IN, OUT and INOUT parameters with StoreProcedureCall. This document can be download from OracleMetaLink:
http://www.oracle.com/support/metalink/index.html
I followed the sample code in this document to write a test case for one of complicated PL/SQL codes. The test case showed wrong results for IN/OUT and OUT parameters.
At the end of the document above, I found this paragraph
" Check the ordering of the arguments to make sure that they are in the following sequence:
All 'IN' parameters, All 'OUT' parameters and then all 'INOUT' parameters.
Your stored procedure must be set up the same way, since this is how values will be passed to it. This is the way in which TopLink stored procedure calls have been designed and implemented. "
The order of our PL/SQL codes is IN, IN/OUT and OUT. We are not allowed to change our PL/SQL codes because they are currently used in production environment. We do not want to create another versions of PL/SQL codes to comply with IN, OUT, IN/OUT parameter order mentioned above.
Do you have any work around solution?
Dennis Nguyen
LA County Sheriff ITI tried a simple example using named parameters and it worked in 9.0.4:
CREATE OR REPLACE PROCEDURE
"TEST_904"."STOREDPROCEDURE_INOUT_OUT_IN" (
P_INOUT IN OUT NUMBER,
P_OUT OUT NUMBER,
P_IN NUMBER) AS
BEGIN
P_OUT := P_INOUT;
P_INOUT := P_IN;
END;
public void storedProcedureOutInoutInTest() {
System.out.println("storedProcedureOutInoutInTest");
StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("STOREDPROCEDURE_INOUT_OUT_IN");
call.addNamedArgument("P_IN");
call.addNamedOutputArgument("P_OUT", "P_OUT", Integer.class);
call.addNamedInOutputArgument("P_INOUT", "P_INOUT", "P_INOUT", Integer.class);
call.setUsesBinding(true);
DataReadQuery query = new DataReadQuery();
query.setCall(call);
query.addArgument("P_IN");
query.addArgument("P_INOUT");
Vector args = new Vector(2);
args.add(new Integer(1));
args.add(new Integer(2));
Object result = session.executeQuery(query, args);
Map map = (Map)((Vector)result).firstElement();
Integer result_p_inout = (Integer)map.get("P_INOUT");
Integer result_p_out = (Integer)map.get("P_OUT");
System.out.println("P_INOUT = " + result_p_inout);
System.out.println("P_OUT = " + result_p_out);
}Result:
P_INOUT = 1
P_OUT = 2 -
Using Copy statement in Stored procedure
The following statement works in sqlplus session:
copy from comment/password@servername append amcomment_temp using
select * from amcomment
where commentid in(1,2,3,4)
I want to use this in a stored procedure. There is a long datatype in this table. The
procedure will not compile. Have tried execute immediate and compiler rejects this statement also.'COPY' is a SQL*Plus command, not PL/SQL. This is why the PL/SQL compiler throws it out.
-
How to use order by in stored procedure base block?
How to use order by in stored procedure base block? I need to change order by dynamically
Use SET_BLOCK_PROPERTY('BLOCK_NAME',ORDER_BY,'COLUMN_NAME1, COLUMN_NAME2');
-
Using VIEW inside a stored procedure
Hi,
So I have a View designed in one file that validates someone who is authorized.
Then I have a stored procedure to display authorized stationeries created before a given date. Its takes a parameter @CreatedOn.
How can I use VIEW in my stored procedure so I can display all the authorized which are set 1 before a given date?
My VIEW:
ALTER VIEW vw_AuthorizedStationeries AS
SELECT Authorized
FROM dbo.Stationeries
WHERE Authorized = 1
And my stored procedure:
CREATE PROCEDURE usp_stationeries (@CreatedOn datetime)ASBEGINSELECTFROMENDGO
Thanks!Try something like below, You need to replace CreatedDate column with appropriate date column in your table.
1. Alter the view to get the required date:
ALTER VIEW vw_AuthorizedStationeries AS
SELECT Authorized, CreatedDate
FROM dbo.Stationeries
WHERE Authorized = 1
2. Alter SP:
CREATE PROCEDURE usp_stationeries (@CreatedOn datetime)
AS
BEGIN
SELECT Authorized
FROM vw_AuthorizedStationeries
WHERE CreatedDate <= @CreatedOn
END
GO
OR
You can pull required information directly from your table:
CREATE PROCEDURE usp_stationeries (@CreatedOn datetime)
AS
BEGIN
SELECT Authorized
FROM dbo.Stationeries
WHERE CreatedDate <= @CreatedOn and Authorized = 1
END
GO
If this post answers your query, please click "Mark As Answer" or "Vote as Helpful". -
Using temporary tables in stored procedures
Suppose that I have created a temporary table in a stored procedure using an "EXECUTE IMMEDIATE" statement. When I compile the procedure, that table is not created yet, so the compiler says that the table does not exist.
What is the way of using temporary tables in stored procedures?It's a good practice to avoid using DDL statements being executed from stored procedures. "Truncate Table" via dynamic SQL from stored procedure is a different story and is useful in DSS environments.
But if you insist on "creating" tables using Dynamic SQL from Stored Procedures then you must also embed your DML statements in Dynamic SQL to avoid compilation errors.
Example:
Create or Replace Procedure Proc_TestDynamicSQL is
Begin
Execute Immediate 'Create table myTable as select * from user_tables' ;
Execute Immediate 'Update myTable set table_name = ''Test'' ' ; --two single quotes before and after the string "Test"
End;
In this case, Oracle wouldn't care about the table references during compilation. -
Can rs.last() be used after calling the stored procedure?
Can rs.last() be used after calling the stored procedure? If yes what should be the CURSOR types?
Can rs.last() be used after calling the stored
procedure? If yes what should be the CURSOR types?That would depend on the driver/database.
And as I said in your other post it is far more efficient to count records by just returning a count rather than a complete collection regardless of how you get to the end. -
Use database inside a stored procedure
Hi guys, a stupid question: I'm working with several database and sometimes I'm afraid to run an alter or a create something in the wrong database, bear in mind that several database have the same tables. Sometime happens to run a query oin the db A
instead in the db B. So, the question: If I create a procedure like this,
create procedure creatingPillar as
use USA
begin
IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'pillarretail') AND type in (N'U'))
DROP TABLE PillarRetail
create table PillarRetail (anid int , ancore varchar(20), period dec(18,6), settlem datetime2,
settlementper int, asf dec(18,6),astlf dec (18,6), tot dec (18,6) )
insert into PillarRetail select anid, ancore, Period, settlem, settlementper,
asf, astlf, tot from createsemipillar2011
insert into PillarRetail select select anid, ancore, Period, settlem, settlementper,
asf, astlf, tot createsemipillar
end
but I'm wondering if is useless to put the use USA in the stored procedure by the moment that I'm creating the procedure in USA. I mean, having the SP in the USA db even if I run the procedure from another db it should run in USA. Just a stupid question
I know but I got this doubt...
ThanksYou may try as below:
create proc as below: (This will create the proc in USA database.
use USA
Go
create procedure dbo.creatingPillar as
begin
IF EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'pillarretail') AND type in (N'U'))
DROP TABLE PillarRetail
create table PillarRetail (anid int , ancore varchar(20), period dec(18,6), settlem datetime2,
settlementper int, asf dec(18,6),astlf dec (18,6), tot dec (18,6) )
insert into PillarRetail select anid, ancore, Period, settlem, settlementper,
asf, astlf, tot from createsemipillar2011
insert into PillarRetail select select anid, ancore, Period, settlem, settlementper,
asf, astlf, tot createsemipillar
end
Then you can call as below:
Exec USA.dbo.creatingPillar -
Using VARRAYs as parameters to a Stored Procedure
I'm trying to pass a VARRAY as an IN/OUT parameter into a simple stored procedure by doing the following ..
call.addNamedInOutputArgument(.., .., .., oracle.sql.ARRAY.class);
I'm using a DataReadQuery. I set the call in the query, bind all parameters and add the IN/OUT argument to the query (i.e. query.addArgument(<name>)). Then I create an oracle.sql.ArrayDescriptor to describe the ARRAY.
ArrayDescriptor ad = ArrayDescriptor.createDescriptor(<name of VARRAY>, <connection>);
The VARRAY is of size 1 whose type is INTEGER. I create an ARRAY of Integer objects.
Integer fields[1] = new Integer[1];
fields[0] = new Integer(2);
ARRAY a = new ARRAY(ad, <connection>, fields);
I create a Vector of parameters and add the ARRAY to it. Then I execute the query ..
Object result = session.executeQuery(<query>, <Vector>);
When I execute the query I keep getting an ORA-06550: wrong number or types of arguments in call to <stored procedure>. Any help would be appreciated. Thanks. -Michael-The workaround above using JDBC directly to call store procedures using VARRAY types is still probably your best solution.
In TopLink 10.1.3 there is a new API on StoredProcedureCall that allows passing the JDBC type code which should allow binding of VARRAY output parameters.
addNamedInOutputArgument(String procedureParameterName, String inArgumentFieldName, String outArgumentFieldName, int type, String typeName) { -
Trying to pass array to stored procedure in a loop using bind variable
All,
I'm having trouble figuring out if I can do the following:
I have a stored procedure as follows:
create procedure enque_f826_utility_q (inpayload IN f826_utility_payload, msgid out RAW) is
enqopt dbms_aq.enqueue_options_t;
mprop dbms_aq.message_properties_t;
begin
dbms_aq.enqueue(queue_name=>'f826_utility_queue',
enqueue_options=>enqopt,
message_properties=>mprop,
payload=>inpayload,
msgid=>msgid);
end;
The above compiles cleanly.
The first parameter "inpayload" a database type something like the following:
create or replace type f826_utility_payload as object
2 (
3 YEAR NUMBER(4,0),
4 MONTH NUMBER(2,0),
83 MUSTHAVE CHAR(1)
84 );
I'd like to call the stored procedure enque_f826_utility_q in a loop passing to it
each time, new values in the inpayload parameter.
My questions are:
First, I'm not sure in php, how to construct the first parameter which is a database type.
Can I just make an associative array variable with the keys of the array the same as the columns of the database type shown above and then pass that array to the stored procedure?
Second, is it possible to parse a statement that calls the enque_f826_utility_q procedure using bind variables and then execute the call to the stored procedure in a loop passing new bind variables each time?
I've tried something like the following but it's not working:
$conn = oci_pconnect (....);
$stmt = "select * from f826_utility";
$stid = oci_parse($conn, $sqlstmt);
$r = oci_execute($stid, OCI_DEFAULT);
$row = array();
$msgid = "";
$enqstmt = "call enque_f826_utility_q(:RID,:MID)";
$enqstid = oci_parse($conn, $sqlstmt);
oci_bind_by_name($enqstid, ":RID", $row); /* line 57 */
oci_bind_by_name($enqstid, ":MID", $msgid);
while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC))
++$rowcnt;
if (! oci_execute($enqstid)) /* line 65 */
echo "Error";
exit;
When I run this, I get the following:
PHP Notice: Array to string conversion in C:\Temp\enqueue_f826_utility.php on l
ine 57
Entering loop to process records from F826_UTIITY table
PHP Notice: Array to string conversion in C:\Temp\enqueue_f826_utility.php on l
ine 65
PHP Warning: oci_execute(): ORA-06553: PLS-306: wrong number or types of argume
nts in call to 'ENQUE_F826_UTILITY_Q' in C:\Temp\enqueue_f826_utility.php on lin
e 65
PHP Notice: Undefined variable: msgnum in C:\Temp\enqueue_f826_utility.php on l
ine 68
Error during oci_execute of statement select * from F826_UTILITY
Exiting!Thanks for the reply.
I took a look at this article. What it appears to describe is
a calling a stored procedure that takes a collection type which is an array.
Does anyone from Oracle know if I can pass other database type definitions to a stored procedure from PHP?
I have a type defined in my database similar to the following which is not
an array but a record of various fields. This type corresponds to a payload
of an advanced queue payload type. I have a stored procedure which will take as it's input, a payload type of this structure and then enqueue it to a queue.
So I want to be able to pass a database type similar to the following type definition from within PHP. Can anyone from Oracle verify whether or not this is possible?
create or replace type f826_utility_payload as object
YEAR NUMBER(4,0),
MONTH NUMBER(2,0),
UTILITY_ID NUMBER(10,0),
SUBMIT_FAIL_BY VARCHAR2(30),
MUSTHAVE CHAR(1)
); -
I have the need to save dynamically generated ApEx items via AJAX. I am using APEX_ITEM API to generate the items. At run-time, I have no idea how many of items will be generated on the page, but I know that they will all have discreet and distinct "name" attributes, i.e. f01, f02, f03, etc. As a basic example, if I have to generate a select list, I know that the "p_idx" parameter of the APEX_ITEM call is say "3", so all select lists that get generated will have a "name" attribute in the DOM of "f03", all text items will be "f01", etc.
I want to save this data to the database via AJAX. It is typical to call the standard htmldb_Get javascript function for use of an on-demand process, but I am interested in using the rarely-called-upon "procedure" and queryString" options of that javascript function so that I can build the queryString on the fly based on what is on the DOM when the tries to save the data they entered into these APEX_ITEM-generated items. Does anyone have any good examples of how to use the "procedure" and "queryString" parameters of the htmldb_Get javascript function?
I have found a smattering of some blogs, posts, etc. online related to this, but mostly just people regurgitating the documentation. I found this post (https://forums.oracle.com/thread/2549237) which had a glimpse of hope to be able to pass an array (which is something I will need) as a parameter, but would like someone to sanity check this before I go down that road.
Shane.
ApEx 4.2.1Shane
Since you mention you are on APEX 4.2 I would recommend using apex.server.process which is the documented replacement of the officially undocumented htmldb_Get.
In the documentation it is set that the first parameter is the ajaxidentifier but it actually is the process name.
The data object would be something like
var lData ={f01 : get_value_array('f01')}
Where get_value_array is
function get_value_array(pColumnName) {
var l_values =[];
apex.jQuery('[name="'+pColumnName+'"]').each(
function(){
var l_value;
l_value = apex.item(this.id).getValue();
l_values.push(l_value);
return l_values
For a working example see this demo.
Nicolette -
Passing DATE parameters to Oracle Stored Procedures using ADO
Does anyone know how can I pass a date parameter to an Oracle
Stored Procedure? The IN parameter of the procedure is of type
DATE and the ADO parameter is of type DBDate (I've tried Date
and DBTimeStamp,too). The execution freezes at "Cmd.Execute".
Can anyone suggest a solution?
Thanx for any tipsAs far as I know the documentation on CR & stored procedures says that the REF CURSOR has to be a strongly bound one.
Could you go into a little more detail? Do you mean I should put a multi-valued parameter into a REF CURSOR? Can you post some code snippets here? -
Passing Variable Number of Parameters to Cobol Stored Procedure
Hi. I have a web front end that needs to access several different tables via Cobol stored procedures. It seems simple enough to call the stored procedures straight away (DAO Pattern perhaps?) but my boss is insistent on having an intermediate Cobol program that decides which table to access. I think he at a bigger picture than I can see.
The problem lies in the number of parameters that need to be passed to the stored procedures; some need 3, others needs 5, a few need 4. The only two solutions that I can think of are to pass EVERYTHING (we're talking 50 parameters or so) to the intermediate stored procedure and then pulling only what is needed from that data set to access the desired table. Solution number two involves passing everything to a temp table and then pulling what is needed from it. The former solution seems a little cleaner but still involves passing a lot of parameters. If Cobol could handle some sort of dynamic memory allocation (Vector) there seems to be a possible solution there. Though, as far as I know, that isn't possible.
Any ideas are much appreciated.
Thanks in advance,
ChrisHi Saurabh,
The method in which stored procedures are called on form submit is something as follows.
Let us take your scenario of a form which has multiple checkboxes and a submit button. On clicking the submit button, this form data is submitted using either get or post. The form's submit action invokes a procedure.
The HTML form code will look something like this..
htp.formOpen( curl => 'URL /myProcedure',
cmethod => 'post' );
htp.formCheckbox( cname => 'myCheckbox'
cvalue => 'A');
htp.formCheckbox( cname => 'myCheckbox'
cvalue => 'B');
htp.formCheckbox( cname => 'myCheckbox'
cvalue => 'C');
htp.formSubmit( cname => 'myButton',
cvalue => 'OK');
Now, whenever the submit button is clicked, all these form values are passed to our stored procedure 'myProcedure'.
"myProcedure" looks something like this.
procedure myProcedure
myCheckbox IN sys.owa_util.vc_arr,
myButton IN VARCHAR2
is
begin
end myProcedure;
The point to be noted here is that the name of the variable being passed in the procedure is the same as the name of the HTML element being created in the HTML form. So, there is a direct mapping between the elements in the HTML form and the procedure parameters.
Another noteworthy point is that since you have multiple checkboxes in your HTML form, it is impractical to name all the checkboxes differently and then pass those many parameters to your procedure (Imagine a scenario where there are a hundred check-boxes in an HTML form!). So portal allows you to give the same name (cname) to all the checkboxes in your HTML form, and if multiple checkboxes are checked, it will return all the checkbox values in an array (Note the usage of "myCheckbox IN sys.owa_util.vc_arr" in myProcedure).
You can check out this link for more information.
Re: retrieving data from fields
Thanks,
Ashish. -
Get OUTPUT and RETURN parameters from a stored procedure
I have a stored procedure (MS SQL Server 2008 R2) like the following example.
Using Database Connectivity I can get the OUTPUT parameters but I can't get de RECORDSET DATA and de RETURN value.
Does anybody knows how to do that?
CREATE PROCEDURE [dbo].[TS_Teste] (@T057_S_NOMEMAQUINA VARCHAR(20), @STATUS INT OUTPUT, @ERRO NVARCHAR(500) OUTPUT)
AS
BEGIN
DECLARE @TABLE TABLE(CODIGO INT, DESCRICAO VARCHAR(30))
INSERT INTO @TABLE VALUES (51, 'A')
INSERT INTO @TABLE VALUES (52, 'B')
INSERT INTO @TABLE VALUES (53, 'C')
SELECT * FROM @TABLE
SET @STATUS = 1
SET @ERRO = 'Nenhum erro!'
RETURN 0
END
Solved!
Go to Solution.
Attachments:
SQL SP Return.vi 29 KBI finaly found what was wrong... It was necessary an only aditional line in the stored procedure. It should be like that:
CREATE PROCEDURE [dbo].[TS_Teste] (@T057_S_NOMEMAQUINA VARCHAR(20), @STATUS INT OUTPUT, @ERRO NVARCHAR(500) OUTPUT)
AS
BEGIN
SET NOCOUNT ON; -- NEW LINE!!!
DECLARE @TABLE TABLE(CODIGO INT, DESCRICAO VARCHAR(30))
INSERT INTO @TABLE VALUES (51, 'A')
INSERT INTO @TABLE VALUES (52, 'B')
INSERT INTO @TABLE VALUES (53, 'C')
SELECT * FROM @TABLE
SET @STATUS = 1
SET @ERRO = 'Nenhum erro!'
RETURN 0
END -
ERROR WHILE INSERTING BLOBS AS PARAMETERS OF EXISTING STORED PROCEDURE
I have 2 simple tables to keep large application data (as XMLDOCUMENT in one table and BLOB in another):
SQL> desc bindata_tbl;
Name Null? Type
BDATA_ID NOT NULL NUMBER(10)
BDATA NOT NULL BLOB
SQL> desc metadata_tbl;
Name Null? Type
MDATA_ID NOT NULL NUMBER(10)
MDATA NOT NULL SYS.XMLTYPE
and stored preocedure to input new data into those tables:
"SP_TEST_BIN_META_DATA"
i_MetaData in METADATA_TBL.MDATA%TYPE,
i_BinData in BINDATA_TBL.BDATA%TYPE
as
begin
if i_MetaData is not null then
insert into METADATA_TBL (MDATA_ID, MDATA)
values (METADATA_SEQ.nextval, i_MetaData);
end if;
if i_BinData is not null then
insert into BINDATA_TBL (BDATA_ID, BDATA)
values (BINDATA_SEQ.nextval, i_BinData);
end if;
COMMIT;
-- Handle exceptions
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
RAISE;
end;
I communicate with database from .Net application using "Oracle.DataAccess 10.1.0.200 (Runtime version v1.0.3705)" component.
Following procesure is a [simplified] examlple of the code I use, which demonstrates the errors while inserting XMLDOCUMENT and BLOB values simultaneously.
In my application those should be quite big objects (~200 K XML and ~5-25M binary image data), but following sample keeps failing even with very small-sized objects:
Line Number
1 private void PureTest()
2 {
3 OracleConnection conn = null;
4 OracleTransaction tx = null;
5 OracleCommand command = null;
6
7 try
8 {
9 // Open connection
10 string strConn = "Data Source=AthenaWf; User ID=AthenaWf; Password=Poseidon";
11 conn = new OracleConnection( strConn );
12 conn.Open();
13
14 // Begin transaction (not sure if really needed)
15 tx = conn.BeginTransaction();
16
17 // Create command
18 string strSql = "SP_TEST_BIN_META_DATA";
19 command = new OracleCommand();
20 command.Connection = conn;
21 command.CommandText = strSql;
22 command.CommandType = CommandType.StoredProcedure;
23
24 // Create parameters
25 // 1) XmlType parameter
26 string strXml = "<?xml version=\"1.0\"?><configuration testValue=\"123456789\"/>";
27 XmlDocument xmlDoc = new XmlDocument();
28 xmlDoc.LoadXml( strXml );
29 OracleXmlType oraXml = new OracleXmlType( conn, xmlDoc );
30 //oraXml = null;
31 //
32 OracleParameter xmlPrm = new OracleParameter();
33 xmlPrm.ParameterName = "i_MetaData";
34 xmlPrm.Direction = ParameterDirection.Input;
35 xmlPrm.OracleDbType = OracleDbType.XmlType;
36 xmlPrm.Value = oraXml;
37 command.Parameters.Add( xmlPrm );
38
39 // 2) Blob type
40 byte[] buf = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
41 OracleBlob oraBlob = new OracleBlob( conn, true );
42 //oraBlob.Write( buf, 0, buf.Length );
43 oraBlob = null;
44 //
45 OracleParameter blobPrm = new OracleParameter();
46 blobPrm.ParameterName = "i_BinData";
47 blobPrm.Direction = ParameterDirection.Input;
48 blobPrm.OracleDbType = OracleDbType.Blob;
49 blobPrm.Value = oraBlob;
50 command.Parameters.Add( blobPrm );
51
52
53 // Execute command finally
54 command.ExecuteNonQuery();
55 tx.Commit();
56 }
57 catch( Exception ex )
58 {
59 // Clean-up
60 if( command != null )
61 {
62 command.Dispose();
63 }
64 if( tx != null )
65 {
66 tx.Dispose();
67 }
68 if( conn != null )
69 {
70 conn.Dispose();
71 }
72
73 // Display error message
74 MessageBox.Show( ex.Message, "Error" );
75 }
76 }
If I try insert only XMLDOCUMENT object (lines 30, 42 are commented out, 43 IS NOT) - everything is OK.
If I try to insert only BLOB object (lines 30, 42 are NOT COMMENTED OUT, line 43 is commented out) - everything is OK again.
If I try to insert them both having some values (lines 30, 43 are commented out, 42 is not commented out) - it fails right on "command.ExecuteNonQuery();" (line 54)
with the following exception:
"ORA-21500: internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%]".
Even when I nullify oraBlob before assigning it to OracleParameter value (line 30 is commented out, line 42 and 43 are not) I have the same exception.
XMLDOCUMENT and DLOB data logically are very coupled objects (in my application), so I really want to insert them simultaneously in one stored procedure in transactional way.
Is it bug of drivers, server, .net environment, or I miss something in implementation?
PS. In some articles on Oracle web and in MSDN site I found a mention about necessity of wrapping all write/update operations in a transaction, while working with temporary LOBs. I use it here, but it does not look like changing anything.Hello,
I tested your code with the 10.1.0.4.0 ODP and 10.1.0.4.0 Client and it worked fine.
Can you please apply the 10.1.0.4.0 patches for both ODP and client to see if this resolves the issue for you.
Here is the output from the same execution of the ODP application you provided as a testcase. These rows were inserted at the same time when I executed the application and passed the data as parameters to the SP you provided.
Results of Testing with 10.1.0.4.0
==========================
SQL> select count(*) from BINDATA_TBL
2 ;
COUNT(*)
1
SQL> select count(*) from METADATA_TBL;
COUNT(*)
1
SQL> select dbms_lob.getlength(bdata) from BINDATA_TBL;
DBMS_LOB.GETLENGTH(BDATA)
10
SQL> select mdata from METADATA_TBL;
MDATA
<?xml version="1.0"?><configuration testValue="123456789" />
Maybe you are looking for
-
1)Now I use Lightrom 5.7 how to upgrade to 6 or CC? 2) What is the difference between 6 and CC version? 3) When I used lightromm 3, I could see in EXIF the distance in meters till the object I took, in the later virsions that function disappeared, it
-
Macbook Pro 15 Late 11 extreme fans noise when using external monitor
Dear Apple, recently I bought Macbook Pro 15 Late 11. I really love it's speed and new OS X Lion, BUT this Macbook really noisy when I use external monitor and keyboard. I work on external monitor all the time. I don't care about how hot my Macbook i
-
Blurry text on HP w2207 external display?
I just hooked up my 15" MBP to a new HP w2207 LCD and I'm concerned that text is not as sharp as it appears on the (lower-res) notebook display. I fear this may be a dumb question, but I'll ask it anyway: Is this just a fact of life with a larger scr
-
Multiple language spelling checking
Hello everyone I am writing to ask an advice on how to enable multiple language spelling checking. What i mean is that when i write in russian, Pages automatically checks my spelling but when I write in english it just underlines every single word. S
-
Can anyone help? I downloaded photoshop elements trial and got a error message to download support advisor