ODP.NET, Managed reading LONG column results in ORA-01009 - oracle

I'm trying to get the source of a view in my .net app.
To do this, I query DBA_VIEWS: it has a column TEXT with exactly what I need. The type is LONG.
If I do it using the Unmanaged driver, everything works as expected.
The same code with Managed driver results in ORA-01009: missing mandatory parameter.
Adding a transaction around the command and using breakpoint and "slow" steps sometimes results in the same code working.
ODP.NET version is 19, Oracle DB is 18c Express Edition. Strangely enough, the same code works just fine with Oracle Database 12c regardless of driver type.
Is there maybe some setting I need to change on the database or in code? I'm completely lost here.
Code I'm using for testing:
Imports System.Data.Common
Imports Oracle.ManagedDataAccess
'Imports Oracle.DataAccess
Module Views
Function CreateCommand(Connection As DbConnection) As System.Data.Common.DbCommand
Dim cmd As Data.Common.DbCommand = Connection.CreateCommand()
With CType(cmd, Client.OracleCommand)
.BindByName = True
.FetchSize = &H100000 '1 Mb
.InitialLONGFetchSize = -1 'the entire LONG or LONG RAW data is prefetched and stored in the fetch array.
.InitialLOBFetchSize = -1 'the entire LOB data is prefetched and stored in the fetch array.
End With
Return cmd
End Function
Sub query()
Try
Using DBConnection = New Client.OracleConnection("User ID=TESTUSER;Password=TESTPWD;Data Source=TESTDB;Pooling=True")
DBConnection.Open()
Using DBConnection.BeginTransaction()
Using cmdSQL = CType(CreateCommand(DBConnection), Client.OracleCommand)
cmdSQL.CommandText = "select TEXT from DBA_VIEWS where VIEW_NAME = :0"
Dim p = cmdSQL.CreateParameter()
p.ParameterName = "0"
p.Value = "TEST_VIEW"
cmdSQL.Parameters.Add(p)
Dim sw = Stopwatch.StartNew
Using rdr = cmdSQL.ExecuteReader
rdr.FetchSize = 2 ^ 20
While rdr.Read
Dim row(rdr.FieldCount - 1) As Object
rdr.GetProviderSpecificValues(row)
Dim x = row(0)
Console.WriteLine($"{x.ToString.Length} bytes")
End While
End Using
Console.WriteLine($"{sw.ElapsedMilliseconds} ms")
End Using
End Using
End Using
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
End Sub
End Module

You can use an anonymous block with output parameter and a call to ExecuteNonQuery. Your command text will be
"begin select TEXT into :0 from DBA_VIEWS where VIEW_NAME = :1; end;"
Add 2 parameters. Make sure that
' Parameter #1 has
p.Direction = ParameterDirection.Output
p.OracleDbType = OracleDbType.Long
p.Size = 1000000
And use command cmd.ExecuteNonQuery(). Then, when parameter is retrieved, just use its value
Dim txt As String = cmd.Parametersp[0].Value.ToString()

It's a pity, Oracle deprecated LONG data type for ages but LONG data is still used many times for internal data.
You could write a function and then get the data by calling the function:
create or replace function GetViewText(v in varchar2) return clob is
ret CLOB;
BEGIN
FOR aRow IN (SELECT TEXT FROM DBA_VIEWS WHERE VIEW_NAME = v) LOOP
ret := aRow.TEXT;
-- or ret := TO_CLOB(aRow.TEXT);
END LOOP;
RETURN ret;
END;

Yet another way from this answer is to (ab)use dbms_xmlgen.getxml.
We can either use it to query a single view's code (as in my original question)
with input as (
select
:0 as VIEW_NAME
from dual
)
SELECT
substr(
text_xml,
instr(text_xml, '<LONGCOL>') + length('<LONGCOL>'),
instr(text_xml, '</LONGCOL>', -1) - (instr(text_xml, '<LONGCOL>') + length('<LONGCOL>'))
) as TEXT
from
(
-- getxml can return malformed xml (which is good in this case)
-- while getxmltype can not.
select dbms_xmlgen.getxml(q'{
SELECT TEXT as LONGCOL
FROM SYS.DBA_VIEWS
WHERE VIEW_NAME = '}' || input.VIEW_NAME || q'{'
}') as text_xml
from input
)
or create our own DBA_VIEWS version.
create or replace view APP_SCHEMA.DBA_VIEWS
as
select
OWNER, VIEW_NAME, TEXT_LENGTH,
case
when (TEXT_VC is not null and TEXT_LENGTH <= 4000)
then to_clob(TEXT_VC)
when TEXT is NULL
then NULL
else (
SELECT
substr(
text_xml,
instr(text_xml, '<LONGCOL>') + length('<LONGCOL>'),
--instr(text_xml, '</LONGCOL>', -1) - (instr(text_xml, '<LONGCOL>') + length('<LONGCOL>'))
TEXT_LENGTH
) as TEXT
from
(
-- getxml can return malformed xml (which is good in this case)
-- while getxmltype can not.
select dbms_xmlgen.getxml(q'{
SELECT TEXT as LONGCOL
FROM SYS.DBA_VIEWS
WHERE OWNER = '}' || OWNER || q'{'
and VIEW_NAME = '}' || VIEW_NAME || q'{'
}') as text_xml
from dual
)
)
end as TEXT,
TEXT_VC, TYPE_TEXT_LENGTH, TYPE_TEXT, OID_TEXT_LENGTH, OID_TEXT, VIEW_TYPE_OWNER, VIEW_TYPE, SUPERVIEW_NAME, EDITIONING_VIEW, READ_ONLY, CONTAINER_DATA, BEQUEATH, ORIGIN_CON_ID, DEFAULT_COLLATION, CONTAINERS_DEFAULT, CONTAINER_MAP, EXTENDED_DATA_LINK, EXTENDED_DATA_LINK_MAP, HAS_SENSITIVE_COLUMN
from sys.dba_views
;

Related

SQLRPGLE & JSON_OBJECT CTE Statements -101 Error

This program compiles correctly, we are on V7R3 - but when running it receives an SQLCOD of -101 and an SQLSTATE code is 54011 which states: Too many columns were specified for a table, view, or table function. This is a very small JSON that is being created so I do not think that is the issue.
The RPGLE code:
dcl-s OutFile sqltype(dbclob_file);
xfil_tofile = '/ServiceID-REFCODJ.json';
Clear OutFile;
OutFile_Name = %TrimR(XFil_ToFile);
OutFile_NL = %Len(%TrimR(OutFile_Name));
OutFile_FO = IFSFileCreate;
OutFile_FO = IFSFileOverWrite;
exec sql
With elm (erpRef) as (select json_object
('ServiceID' VALUE trim(s.ServiceID),
'ERPReferenceID' VALUE trim(i.RefCod) )
FROM PADIMH I
INNER JOIN PADGUIDS G ON G.REFCOD = I.REFCOD
INNER JOIN PADSERV S ON S.GUID = G.GUID
WHERE G.XMLTYPE = 'Service')
, arr (arrDta) as (values json_array (
select erpRef from elm format json))
, erpReferences (refs) as ( select json_object ('erpReferences' :
arrDta Format json) from arr)
, headerData (hdrData) as (select json_object(
'InstanceName' : trim(Cntry) )
from padxmlhdr
where cntry = 'US')
VALUES (
select json_object('header' : hdrData format json,
'erpReferenceData' value refs format json)
from headerData, erpReferences )
INTO :OutFile;
Any help with this would be very much appreciated, this is our first attempt at creating JSON for sending and have not experienced this issue before.
Thanks,
John
I am sorry for the delay in getting back to this issue. It has been corrected, the issue was with the "values" statement.
This is the correct code needed to make it work correctly:
Select json_object('header' : hdrData format json,
'erpReferenceData' value refs format json)
INTO :OutFile
From headerData, erpReferences )

Query returning -> ORA-19011: Character string buffer too small

i'm running this query below, and oracle returning the following message: Query returning -> ORA-19011: Character string buffer too small
When i uncomment the last line, it works. I think thats why this return few results. how to solve this?
select substr(xmlagg(xmlelement (e, str||',')).extract ('//text()'),1,(Length(Trim(xmlagg (xmlelement (e, str||',')).extract ('//text()')))-2)) motivos
FROM (
select to_char(lo_valor) str
from editor_layout el,
editor_versao_documento ev,
editor_documento ed,
editor_layout_campo elc,
editor_campo ec,
editor_registro er,
editor_registro_campo erc,
pw_editor_clinico pec,
pw_documento_clinico pdc
where pec.cd_editor_registro = er.cd_registro
and pdc.cd_documento_clinico = pec.cd_documento_clinico
and ed.cd_documento = ev.cd_documento
and el.cd_versao_documento = ev.cd_versao_documento
and el.cd_layout = elc.cd_layout
and elc.cd_campo = ec.cd_campo
and elc.cd_campo = erc.cd_campo
and er.cd_registro = erc.cd_registro
and er.cd_layout = el.cd_layout
and ec.ds_identificador = 'nut_orientacoes_entregues_1'
AND To_Char(lo_valor) IS NOT null
--and Trunc(pdc.dh_documento) BETWEEN Trunc(SYSDATE-5) AND Trunc(SYSDATE)
)
The contents of the xmlagg(xmlelement ...) call returns a clob, and you are trying to stuff it into a varchar2 since you call substr for example. That will fail if the clob is too large.
The reason it will fail when you uncomment the last line is that outside that range, there are rows having the contents that is too long.

Fixing sql length error in progress 4gl 10.2B

I'm trying to use the openedge jdbc connector to pull data from an existing progress db but im running into column width issues.
Here is the error that is holding me up.
[DataDirect][OpenEdge JDBC Driver][OpenEdge] Column TabDisplayName in table PUB.Menu has value exceeding its max length or precision.
I've looked at many posts, each offering different advice, and here's what I've given a go this far:
Manually modify the SQL width via the data dictionary.
I ran a quick check on PUB.Menu.TabDisplayName to find a max value of 44 Characters
Set the width to x(50) to no avail and then x(100) out of a fix of irrational rage, again with no luck.
Use the SUBSTR() SQL Function to truncate the field -not optimum but better than nothing
I get weird results with this. It works fine in sqlexp but in a java environment its like the column is never selected.
Use the dbtool to automatically fix width problems with option #2
After selecting all tables and "areas" (not sure what those are...) and submitting the final option I am returned to the proenv cmdline as if nothing ever happened.
Modify the sql width programmatically via 4gl
This is the only option I found that I have yet to try.
I am a little reluctant to try this only because a manual modification failed. Also this is a live development environment(for me only) and Im trying to mess it up too terribly, although i am taking snaps regularly.
Running progress 10.2B on a unix machine.
Any comments and suggestions would be appreciated.
-Thanks
The dbtool option is the best. It is designed for this. From proenv you should see something like this:
proenv> dbtool s2k
DATABASE TOOLS MENU - 10.2B
---------------------------
1. SQL Width & Date Scan w/Report Option
2. SQL Width Scan w/Fix Option
3. Record Validation
4. Record Version Validation
5. Read or Validate Database Block(s)
6. Record Fixup
7. Schema Validation
9. Enable/Disable File Logging
Q. Quit
Choice: 2
: (0=single-user 1=self-service >1=#threads)? 1
Padding % above current max: 100
: (Table number or all)? all
: (Area number or all)? all
: (verbose level 0-3)? 0
Total records read: 31357
SQLWidth errors found: 0, Date errors found: 0
SQLWidth errors fixed: 0
If your db has a server up & running choose "1" at the connect: prompt. If not, choose "0".
Pick 100 for padding to double the width of fields.
Try it on a copy of the "sports" database if you are unsure. Use a higher level of verboseness if you want some insight into what it is doing.
It does not take very long to run on a small development database. (It is basically instantaneous on "sports".)
It is possible to create views with substring (field.name,1,maxlength) option and use PUB2.viewname instead pub.tablename
DROP VIEW PUB2."accounts";
CREATE VIEW PUB2."accounts" (
"ACC-TYPE",
"ACCOUNT-NAME",
ANALITIC,
ARCH,
COUNT1,
CURRENCY,
PLAN,
QUANTITY,
"RID-ANOBJECT",
"RID-APP",
TRANSIT )
AS select "acc-type",
SUBSTRING("account-name", 1, 130),
"analitic",
"arch",
"count1",
"currency",
"plan",
"quantity",
"rid-anobject",
"rid-app",
"transit"
FROM PUB."accounts";
COMMIT;
use sqlexp for automatic creation:
sqlexp account -H localhost -S ' + db-port + ' -user sysprogress -password sysprogress -infile recreateSQLviews.sql -outfile recreateSQLviews.log
here is code:
def var num-port as integer.
for first _Servers where _Servers._Server-Type = "Login" no-lock:
num-port = _Servers._Server-PortNum.
end.
if num-port < 0 then num-port = num-port + 65536.
if num-port = 0 then do:
message "Define -S parameter for Database" view-as alert-box.
RETURN.
end.
message num-port.
/* ttSQLWidth table: SQL WIDTH for all tables */
def var execstr as char.
def var rez-str as char.
def var db-port as char. /* -S port */
db-port = STRING(num-port).
DEFINE TEMP-TABLE ttSQLWidth NO-UNDO
FIELD tableName AS CHARACTER
FIELD tableNum AS INTEGER
FIELD fieldName AS CHARACTER
FIELD sqlWidth AS INTEGER
FIELD requireFix AS LOGICAL INIT FALSE
FIELD actualWidth AS INTEGER
FIELD newWidth AS INTEGER
INDEX tableNum tableNum
INDEX tableName tableName.
FOR EACH _File NO-LOCK WHERE _Tbl-Type = "T":
FOR EACH _Field OF _File WHERE _Field._Data-type = "character":
if _field._extent > 0 then next.
CREATE ttSQLWidth.
ASSIGN tableName = _File._File-name
tableNum = _File._File-num
fieldName = _Field._Field-name
sqlWidth = _Field._Width.
RELEASE ttSQLWidth.
END. /* FOR EACH _Field */
END. /* FOR EACH _File */
DEFINE VARIABLE bTab AS HANDLE NO-UNDO.
DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
DEFINE VARIABLE queryString AS CHARACTER NO-UNDO.
FOR EACH ttSQLWidth:
CREATE BUFFER bTab FOR TABLE tableName.
CREATE QUERY hQuery.
hQuery:ADD-BUFFER(bTab).
message tablename.
queryString = "FOR EACH " + tableName + " WHERE LENGTH(" + fieldName + ") >= " + STRING(sqlWidth) + " BY LENGTH(" + fieldName + ") DESC".
hQuery:QUERY-PREPARE(queryString).
hQuery:QUERY-OPEN().
IF hQuery:GET-NEXT() THEN DO:
ASSIGN actualWidth = LENGTH(bTab:BUFFER-FIELD(fieldName):BUFFER-VALUE)
requireFix = TRUE.
END. /* IF .. THEN DO */
hQuery:QUERY-CLOSE.
DELETE OBJECT hQuery.
bTab:BUFFER-RELEASE().
DELETE OBJECT bTab.
END. /* FOR EACH ttSQLWidth */
def var add-pr as integer initial 10. /* % from max */
def var maxWidth as integer initial 249. /* maxwidth */
FOR EACH ttSQLWidth WHERE ttSQLWidth.requireFix = TRUE:
ttSQLWidth.newWidth = TRUNCATE ( (ttSQLWidth.actualWidth + add-pr) / add-pr, 0 ) * add-pr.
ttSQLWidth.newWidth = INTEGER( ttSQLWidth.newWidth).
if ttSQLWidth.newWidth > maxWidth then ttSQLWidth.newWidth = maxWidth.
END.
/* sql script generation */
OUTPUT TO value("recreateSQLviews.sql").
def var lst-field as char.
FOR EACH ttSQLWidth WHERE BREAK BY ttSQLWidth.tableName:
IF FIRST-OF(ttSQLWidth.tableName)
THEN run MakeSQLViews(ttSQLWidth.tableName).
END.
OUTPUT CLOSE.
/* sql script execution */
execstr = 'sqlexp account -H localhost -S ' + db-port + ' -user sysprogress -password sysprogress -infile recreateSQLviews.sql -outfile recreateSQLviews.log'.
input through value(execstr).
repeat:
IMPORT UNFORMAT rez-str.
message rez-str.
end.
INPUT CLOSE.
RETURN.
PROCEDURE MakeSQLViews:
define input parameter tableName as character.
def var str_tmp as char.
def var str_tmp1 as char.
def var str as char initial "count,sum,double,row,date,level,area,number,primary".
def var fieldName as char.
def var fieldName1 as char.
FOR EACH _file WHERE _file._file-name = tableName AND
_file._file-num GT 0 AND _file._file-num LT 32000 NO-LOCK:
fieldName = "".
FOR EACH _Field OF _File NO-LOCK:
str_tmp = '"' + _Field._Field-name + '"'.
FOR FIRST ttSQLWidth where ttSQLWidth.tableName = _file._file-name and
ttSQLWidth.fieldName = _Field._Field-name and
ttSQLWidth.requireFix = TRUE:
str_tmp = 'SUBSTRING("' + _Field._Field-name + '", 1, ' + STRING(ttSQLWidth.newWidth) + ')'.
END.
fieldName = fieldName + (IF(fieldName = "") THEN ("") ELSE ("," + chr(10) + chr(9))) + str_tmp.
str_tmp1 = ( IF ( INDEX ( _Field._Field-name, "-" ) = 0 )
THEN ( _Field._Field-name )
ELSE ( '"' + _Field._Field-name + '"' )).
if LOOKUP ( _Field._Field-name, str, "," ) > 0 then str_tmp1 = '"' + _Field._Field-name + '"'.
fieldName1 = fieldName1 + (IF(fieldName1 = "") THEN ("") ELSE ("," + chr(10) + chr(9))) + UPPER(str_tmp1).
END. /* FOR EACH _Field */
PUT UNFORMATTED 'DROP VIEW PUB2."' + _file._file-name + '";' SKIP.
PUT UNFORMATTED 'CREATE VIEW PUB2."' + _file._file-name + '" ( ' + chr(10) chr(9) + fieldName1 + ' ) ' + chr(10) +
'AS select ' + fieldName + chr(10) +
'FROM PUB."' + _file._file-name + '";' SKIP.
PUT UNFORMATTED 'COMMIT;' SKIP(1).
END.
END.

TQuery Float field is implicitly rounded to integer when using ODBC

I'm querying 1 value from table. In db it's value is 48.8
When my app use BDE's native Oracle SQL Link driver, everything is Ok, it's still 48.8.
Then I make the app to use another BDE alias, which use ODBC data source (latest driver from Oracle). And now displayed value is 48.0
Details
The column is factW NUMBER(10, 3).
Test code:
var
q: TQuery;
begin
q := TQuery.Create( SELF );
try
q.DatabaseName := 'Realize';
q.SQL.Text := 'SELECT factW, TO_CHAR(factW) charW'
+'FROM bSertific WHERE id_sertific = :id';
q.ParamByName('id').AsInteger := dm1.Sertif1ID_SERTIFIC.AsInteger;
q.Open;
ShowMessage( ' factW = '
+ FloatToStrF(
q.FieldByName('factW').AsFloat,
ffFixed,
5, 3 ) // here 48.000
+ ' charW = ' + q.FieldByName('charW').AsString // here 48.8
);
finally
q.Free;
end;
end;
I hadn't find a proper solution. The workaround is to query the field as a string and convert it back and forth on the client side.

Passing huge XML from C#/.Net to Oracle Stored Procedure via CLOB parameter - ORA-01008: not all variables bound

Environment:
Server: Oracle 11.2g server on a 64-bit windows 2008
Client: Oracle 11g client on Windows XP SP3, ASP.Net 4.0, Visual Studio 2010, C#
Input size of XML ~ 1,206,500 characters (Calculated based on the maximum data that I would have).
Scenario:
The web application generates the XML that the oracle stored procedure uses to update a table in the database. Since the XML size is pretty large, the Stored Procedure Parameter type chosen is CLOB instead of LONG as LONG has a limitation of 32760 characters.
Problem:
Using CLOB as the parameter type throws up the error "ORA-01008: not all variables bound" for the same stored procedure code which works perfectly for the parameter type as LONG (and XML length < 32760)
C# Code for invoking stored procedure:
OracleCommand DbUpdateCommand = null;
OracleLob tempLOB = null;
DbUpdateCommand.CommandText = "declare xx clob; begin dbms_lob.createtemporary(xx, false, 0); :tempclob := xx; end;";
DbUpdateCommand.Parameters.Add(new OracleParameter("tempclob", OracleType.Clob)).Direction = ParameterDirection.Output;
DbUpdateCommand.ExecuteNonQuery();
//Assign the value to the LOB
tempLOB = (OracleLob)DbUpdateCommand.Parameters[0].Value;
tempLOB.BeginBatch(OracleLobOpenMode.ReadWrite);
//Convert the string to byte array to write to LOB
UnicodeEncoding encoding = new UnicodeEncoding();
byte[] renewalDetailXMLBytes = encoding.GetBytes(renewalDetailXML);
tempLOB.Write(renewalDetailXMLBytes, 0, renewalDetailXMLBytes.Length);
tempLOB.EndBatch();
DbUpdateCommand.CommandText = "P_WEB_PRDCR_RNEW_UPDT";
DbUpdateCommand.CommandType = System.Data.CommandType.StoredProcedure;
DbUpdateCommand.Parameters.Add("PN_KEY_AGNT_RNEW_HDR",
System.Data.OracleClient.OracleType.Number, 12).Value = agentRenewalHeader;
DbUpdateCommand.Parameters.Add("PN_KEY_CO",
System.Data.OracleClient.OracleType.Number, 12).Value = companyCode;
DbUpdateCommand.Parameters.Add("PC_RNWL_DETL_XML",
System.Data.OracleClient.OracleType.Clob).Value = tempLOB;
DbUpdateCommand.Parameters.Add("PS_USR_NM",
System.Data.OracleClient.OracleType.VarChar,255).Value = userName;
DbUpdateCommand.ExecuteNonQuery();
Oracle Stored Procedure Code:
CREATE OR REPLACE PROCEDURE DOIADMIN.P_WEB_PRDCR_RNEW_UPDT (
PN_KEY_AGNT_RNEW_HDR IN NUMBER,
PN_KEY_CO IN NUMBER,
PC_RNWL_DETL_XML IN CLOB,
PS_USR_NM IN VARCHAR2
)
AS
lx_rnew_detl_xml XMLTYPE;
lct_rnew_detl_cntx DBMS_XMLSAVE.ctxtype;
--Construct the complete xml for financial data
lx_rnew_detl_xml := XMLTYPE(PC_RNWL_DETL_XML);
--table to be updated with the xml
lct_rnew_detl_cntx := DBMS_XMLSAVE.newcontext('IL_AGNT_RNEW_DETL');
--Set the key column list
DBMS_XMLSAVE.SETKEYCOLUMN(lct_rnew_detl_cntx, 'KEY_AGNT_RNEW_HDR');
DBMS_XMLSAVE.SETKEYCOLUMN(lct_rnew_detl_cntx, 'KEY_CO');
DBMS_XMLSAVE.SETKEYCOLUMN(lct_rnew_detl_cntx, 'KEY_INDVDL_LIC');
--Set the udpate column
DBMS_XMLSAVE.SETUPDATECOLUMN(lct_rnew_detl_cntx, 'FLG_MARKED_FOR_CANCEL');
--update the table from the rows
ln_cntr := DBMS_XMLSAVE.UPDATEXML(lct_rnew_detl_cntx, lx_rnew_detl_xml.getCLOBVal());
DBMS_XMLSAVE.closecontext(lct_rnew_detl_cntx);
END p_web_prdcr_rnew_updt;
Anyone who has worked with passing large XML via CLOB parameter and converted that CLOB to XML in the stored procedure can please help? Any alternate approach to this problem would also be highly appreciated.
Thanks in advance.
Here is the C# code that fixed the issue. I was missing to clear the parameters before reusing the same command object.
C# Code
OracleCommand DbUpdateCommand = null;
OracleLob tempLOB = null;
DbUpdateCommand.CommandText = "declare xx clob; begin dbms_lob.createtemporary(xx, false, 0); :tempclob := xx; end;";
DbUpdateCommand.Parameters.Add(new OracleParameter("tempclob", OracleType.Clob)).Direction = ParameterDirection.Output;
DbUpdateCommand.ExecuteNonQuery();
//Assign the value to the LOB
tempLOB = (OracleLob)DbUpdateCommand.Parameters[0].Value;
tempLOB.BeginBatch(OracleLobOpenMode.ReadWrite);
//Convert the string to byte array to write to LOB
UnicodeEncoding encoding = new UnicodeEncoding();
byte[] renewalDetailXMLBytes = encoding.GetBytes(renewalDetailXML);
tempLOB.Write(renewalDetailXMLBytes, 0, renewalDetailXMLBytes.Length);
tempLOB.EndBatch();
DbUpdateCommand.CommandText = "P_WEB_PRDCR_RNEW_UPDT";
DbUpdateCommand.CommandType = System.Data.CommandType.StoredProcedure;
//Missing line - start
DbUpdateCommand.Parameters.Clear();
//Missing line - end
DbUpdateCommand.Parameters.Add("PN_KEY_AGNT_RNEW_HDR",
System.Data.OracleClient.OracleType.Number, 12).Value =
agentRenewalHeader;
DbUpdateCommand.Parameters.Add("PN_KEY_CO",
System.Data.OracleClient.OracleType.Number, 12).Value =
companyCode;
DbUpdateCommand.Parameters.Add("PC_RNWL_DETL_XML",
System.Data.OracleClient.OracleType.Clob).Value =
tempLOB;
DbUpdateCommand.Parameters.Add("PS_USR_NM",
System.Data.OracleClient.OracleType.VarChar,255).Value =
userName;
DbUpdateCommand.ExecuteNonQuery();

Resources