Date type parameters do not work package procedure
a cordial greeting to the whole community, in advance thank you very much for your precious time
a general way I have the following, a package in which I have a main procedure which I recible three parameters: a start date, a final, and a number of client
to use the dates I enter as parameter to query yields no records, but if I assign the date internally in the procedure, if it sheds records, the strange thing is that both the data and the parameters that are identical internally assigned even in its length and I checked, the truth and I stay out of ideas thank you very much for your time attaching the code
for now I'm just using the second query forget the first
------call to procedure-----
DECLARE
errcode VARCHAR2(200);
errbuf VARCHAR2(200);
BEGIN
xxxxx.pkg.xxxinitial_end(errcode ,errbuf
,'2013/08/19 00:00:00'
,'2013/08/23 00:00:00','456456456546');
END;
-----------------------------------------------------------------procedure---------------------------------------------------------------------
PROCEDURExxxinitial_end (ERRCODE OUT VARCHAR2
, ERRBUFF OUT VARCHAR2
, p_initial_date IN VARCHAR2
, p_end_date IN VARCHAR2
, customer IN VARCHAR2)IS
l_encoding_line VARCHAR2(240);
cur_without_customer SYS_REFCURSOR;
cur_with_customer SYS_REFCURSOR;
initial_date DATE;
end_date DATE;
initial_date2 DATE;
end_date2 DATE;
BEGIN
l_encoding_line := '<?xml version="1.0" encoding=' || '"iso-8859-1"' ||
' ?>' || chr(10) || '<XXOCS_TOTAL_VENTAS_SINEXP>';
initial_date := to_date(p_initial_date, 'YYYY/MM/DD HH24:MI:SS');-----------------input parameters NOT WORKING
end_date := to_date(p_end_date, 'YYYY/MM/DD HH24:MI:SS');-------------------input parameters
initial_date2:=to_date('2013/08/19 00:00:00', 'YYYY/MM/DD HH24:MI:SS');---------------------default values
end_date2:=to_date('2013/08/23 00:00:00', 'YYYY/MM/DD HH24:MI:SS');---------------------default values WORKING FINE
IF customer IS NULL THEN
-- OPEN cur_without_customer;
DBMS_OUTPUT.PUT_LINE('se ejecuto el primero');
-------------------------cursor -----------------------------------
OPEN cur_without_customer FOR
SELECT rct.customer_trx_id
,rctl.customer_trx_line_id
,hp.party_name ---cliente
,hca.account_number ----N° Cliente
,rctl.line_number -----item
,rctt.name---descripcion transaccion
,rct.trx_number -----numero
,rctt.type ------tipo de transaccion
,hp.party_id--control solamente
,rct.trx_date------Fecha de emisión Comprobante de Venta
,rct.attribute1 ---No. de autorización del Comprobante de Venta
,mp.attribute9||rct.trx_number N_Comprobante---No. de Comprobante de Venta
,rct.attribute4-----Unidad Estratégica de Negocio
,mp.attribute9---- N° de establecimiento
,rctl.description-----Descripción (Tipo de Combustible)
,rctl.quantity_invoiced---Cantidad Vendida en galones
,rctl.unit_selling_price---Precio de venta unitario
--,rctl.taxable_amount-------Valor Base Imponible --restriccion
--,rctl.extended_amount---valor iva 12%
-- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_trx_types_all rctt,
mtl_parameters mp
-- mtl_system_items_b msi,
-- zx_lines zl
--ra_batch_sources_all rbs
WHERE
--rct.trx_date BETWEEN initial_date AND end_date --parametros de fecha
rct.trx_date BETWEEN to_date('2013/08/19 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*initial_date*/ AND to_date('2013/08/23 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*end_date*/
AND rct.sold_to_customer_id = hca.cust_account_id
AND hca.party_id = hp.party_id
AND rct.customer_trx_id=rctl.customer_trx_id
--AND rctl.inventory_item_id=msi.inventory_item_id
AND mp.organization_id=rctl.warehouse_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id;
print_output(fnd_file.output, l_encoding_line);
get_xml(cur_without_customer, 'G_REGISTER', 'CABECERA', ERRCODE);
IF ERRCODE = 1 THEN
ERRBUFF := 'El reporte no arrojo datos para los parametros ingresados';
ERRCODE := 2;
RETURN;
ELSIF ERRCODE = 2 THEN
ERRBUFF := SQLERRM;
RETURN;
END IF;
print_output(fnd_file.output, '</XXOCS_TOTAL_VENTAS_SINEXP>');
ELSE
-- OPEN cur_with_customer;
DBMS_OUTPUT.PUT_LINE('se ejecuto el segundo');
-----------------------cursor 2---------------------------
DBMS_OUTPUT.PUT_LINE('customer ' || customer);
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS '||length(p_initial_date));
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS '||length(p_end_date));
DBMS_OUTPUT.PUT_LINE('customer ' || customer);
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS quemados '|| length(initial_date2));
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS quemados '|| length(end_date2));
DBMS_OUTPUT.PUT_LINE('customer ' || customer);
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS convertidso '|| length(initial_date));
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS convertidos '|| length(end_date));
OPEN cur_with_customer FOR
SELECT rct.customer_trx_id
,rctl.customer_trx_line_id
,hp.party_name ---cliente
,hca.account_number ----N° Cliente
,rctl.line_number-----item
,rctt.name---descripcion transaccion
,rct.trx_number -----numero
,rctt.type ------tipo de transaccion
,hp.party_id---control solamente
,rct.trx_date------Fecha de emisión Comprobante de Venta
,rct.attribute1 ---No. de autorización del Comprobante de Venta
,mp.attribute9||rct.trx_number N_Comprobante--No. de Comprobante de Venta
,rct.attribute4------ Unidad Estratégica de Negocio
,mp.attribute9---------N° de establecimiento
,rctl.description---------Descripción (Tipo de Combustible)
,rctl.quantity_invoiced----Cantidad Vendida en galones
,rctl.unit_selling_price ---Precio de venta unitario
-- ,rctl.taxable_amount-------Valor Base Imponible --restriccion
-- ,rctl.extended_amount---valor iva 12%
-- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_trx_types_all rctt,
mtl_parameters mp
-- mtl_system_items_b msi,
--zx_lines zl
WHERE hca.account_number=customer
AND hca.party_id=hp.party_id
AND hca.cust_account_id=rct.sold_to_customer_id
AND rct.customer_trx_id=rctl.customer_trx_id
-- AND rctl.inventory_item_id=msi.inventory_item_id
AND mp.organization_id=rctl.warehouse_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id
AND rownum = 1
AND rct.trx_date BETWEEN initial_date AND end_date;<------------when I assign these parameters( initial_date AND end_date )--are the insert by parameter initial_date2 AND end_date2 defualt
DBMS_OUTPUT.PUT_LINE('customer ' || customer);
DBMS_OUTPUT.PUT_LINE('fe inicial ' || initial_date);
DBMS_OUTPUT.PUT_LINE('fe final ' ||end_date);
print_output(fnd_file.output, l_encoding_line);
get_xml(cur_with_customer, 'G_REGISTER', 'CABECERA', ERRCODE);
IF ERRCODE = 1 THEN
ERRBUFF := 'El reporte no arrojo datos para los parametros ingresados';
ERRCODE := 2;
RETURN;
ELSIF ERRCODE = 2 THEN
ERRBUFF := SQLERRM;
RETURN;
END IF;
print_output(fnd_file.output, '</XXOCS_TOTAL_VENTAS_SINEXP>');
END IF;
EXCEPTION
WHEN OTHERS THEN
print_output(fnd_file.log, 'Error Ventas sin Exportaciones:' || SQLERRM);
ERRCODE := 2;
ERRBUFF := SQLERRM;
-- Initialization
END xxxinitial_end;
Welcome. As a note, this question has nothing to do with PL/SQL XML programming and everything to do with SQL and PL/SQL
That said, the simple test case I setup, because I don't have all your tables, works just fine.
declare
l_errcode VARCHAR2(300);
l_errbuff VARCHAR2(300);
PROCEDURE xxxinitial_end (ERRCODE OUT VARCHAR2
, ERRBUFF OUT VARCHAR2
, p_initial_date IN VARCHAR2 -- why not a date?
, p_end_date IN VARCHAR2 -- why not a date?
, customer IN VARCHAR2)
IS
initial_date DATE;
end_date DATE;
l_value VARCHAR2(10);
BEGIN
initial_date := to_date(p_initial_date, 'YYYY/MM/DD HH24:MI:SS');
end_date := to_date(p_end_date, 'YYYY/MM/DD HH24:MI:SS');
-- Not trapping the No Data Found on purpose
SELECT 'hit'
INTO l_value
FROM dual
WHERE SYSDATE BETWEEN initial_date AND end_date;
END xxxinitial_end;
begin
-- Test statements here
xxxinitial_end(l_errcode, l_errbuff
,'2013/08/19 00:00:00'
,'2013/10/19 00:00:00'
,null);
end;
As a comment above says, if you are dealing with dates, why not use a DATE parameter in the procedure and avoid the conversion in your code.
Also, you can simplify your code a bit by using a third sys_refcursor and setting one of the opened cursors to it. This allows you to pull out the common logic following the OPEN and only have one copy of it.
PROCEDURE xxxinitial_end (ERRCODE OUT VARCHAR2
, ERRBUFF OUT VARCHAR2
, p_initial_date IN VARCHAR2 -- why not a date?
, p_end_date IN VARCHAR2 -- why not a date?
, customer IN VARCHAR2)
IS
l_encoding_line VARCHAR2(240);
cur_without_customer SYS_REFCURSOR;
cur_with_customer SYS_REFCURSOR;
cur_comm SYS_REFCURSOR;
initial_date DATE;
end_date DATE;
BEGIN
l_encoding_line := '<?xml version="1.0" encoding=' || '"iso-8859-1"' ||
' ?>' || chr(10) || '<XXOCS_TOTAL_VENTAS_SINEXP>';
initial_date := to_date(p_initial_date, 'YYYY/MM/DD HH24:MI:SS');-----------------input parameters NOT WORKING
end_date := to_date(p_end_date, 'YYYY/MM/DD HH24:MI:SS');-------------------input parameters
IF customer IS NULL THEN
-------------------------cursor -----------------------------------
OPEN cur_without_customer FOR
SELECT rct.customer_trx_id
,rctl.customer_trx_line_id
,hp.party_name ---cliente
,hca.account_number ----N° Cliente
,rctl.line_number -----item
,rctt.name---descripcion transaccion
,rct.trx_number -----numero
,rctt.type ------tipo de transaccion
,hp.party_id--control solamente
,rct.trx_date------Fecha de emisión Comprobante de Venta
,rct.attribute1 ---No. de autorización del Comprobante de Venta
,mp.attribute9||rct.trx_number N_Comprobante---No. de Comprobante de Venta
,rct.attribute4-----Unidad Estratégica de Negocio
,mp.attribute9---- N° de establecimiento
,rctl.description-----Descripción (Tipo de Combustible)
,rctl.quantity_invoiced---Cantidad Vendida en galones
,rctl.unit_selling_price---Precio de venta unitario
--,rctl.taxable_amount-------Valor Base Imponible --restriccion
--,rctl.extended_amount---valor iva 12%
-- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_trx_types_all rctt,
mtl_parameters mp
-- mtl_system_items_b msi,
-- zx_lines zl
--ra_batch_sources_all rbs
WHERE
--rct.trx_date BETWEEN initial_date AND end_date --parametros de fecha
rct.trx_date BETWEEN to_date('2013/08/19 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*initial_date*/ AND to_date('2013/08/23 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*end_date*/
AND rct.sold_to_customer_id = hca.cust_account_id
AND hca.party_id = hp.party_id
AND rct.customer_trx_id=rctl.customer_trx_id
--AND rctl.inventory_item_id=msi.inventory_item_id
AND mp.organization_id=rctl.warehouse_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id;
cur_comm := cur_without_customer;
ELSE
-----------------------cursor 2---------------------------
OPEN cur_with_customer FOR
SELECT rct.customer_trx_id
,rctl.customer_trx_line_id
,hp.party_name ---cliente
,hca.account_number ----N° Cliente
,rctl.line_number-----item
,rctt.name---descripcion transaccion
,rct.trx_number -----numero
,rctt.type ------tipo de transaccion
,hp.party_id---control solamente
,rct.trx_date------Fecha de emisión Comprobante de Venta
,rct.attribute1 ---No. de autorización del Comprobante de Venta
,mp.attribute9||rct.trx_number N_Comprobante--No. de Comprobante de Venta
,rct.attribute4------ Unidad Estratégica de Negocio
,mp.attribute9---------N° de establecimiento
,rctl.description---------Descripción (Tipo de Combustible)
,rctl.quantity_invoiced----Cantidad Vendida en galones
,rctl.unit_selling_price ---Precio de venta unitario
-- ,rctl.taxable_amount-------Valor Base Imponible --restriccion
-- ,rctl.extended_amount---valor iva 12%
-- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_trx_types_all rctt,
mtl_parameters mp
-- mtl_system_items_b msi,
--zx_lines zl
WHERE hca.account_number=customer
AND hca.party_id=hp.party_id
AND hca.cust_account_id=rct.sold_to_customer_id
AND rct.customer_trx_id=rctl.customer_trx_id
-- AND rctl.inventory_item_id=msi.inventory_item_id
AND mp.organization_id=rctl.warehouse_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id
AND rownum = 1
AND rct.trx_date BETWEEN initial_date AND end_date;<------------when I assign these parameters( initial_date AND end_date )--are the insert by parameter initial_date2 AND end_date2 defualt
cur_comm := cur_with_customer;
END IF;
print_output(fnd_file.output, l_encoding_line);
get_xml(cur_comm, 'G_REGISTER', 'CABECERA', ERRCODE);
CLOSE cur_comm;
IF ERRCODE = 1 THEN
ERRBUFF := 'El reporte no arrojo datos para los parametros ingresados';
ERRCODE := 2;
RETURN;
ELSIF ERRCODE = 2 THEN
ERRBUFF := SQLERRM;
RETURN;
END IF;
EXCEPTION
WHEN OTHERS THEN
print_output(fnd_file.log, 'Error Ventas sin Exportaciones:' || SQLERRM);
ERRCODE := 2;
ERRBUFF := SQLERRM;
-- Initialization
END xxxinitial_end;
Similar Messages
-
Hi all,
While viewing report in SSRS 2008 i am getting an error like this
Warning 1 [rsInvalidExpressionDataType] The Value expression used in textrun ‘Textbox21.Paragraphs[0].TextRuns[0]’ returned a data type that is not valid.
sotred procedure
ALTER
Procedure [dbo].[spGetSupervisor]
@START_DATE
datetime,
@END_DATE
datetime,
@CenterID
varchar(4000),
@TITLE
varchar(100)
=
NULL
as
Select
Distinct L1_ID SupID,
L1_Name SupName
from
REF_DB.info v
inner
join dbo.fn_MVParam(@CenterID
+
P
v
.CenterID
= p.Column1
where
v.startdate
<= @END_DATE
and v.enddate
>= @START_DATE
and
(v.title
IN
(@TITLE)
or @title
is
order
by Name
Here is the expression in Report textbox
=Parameters!CenterID.Label
Please
help me
Thanks
in advance
Jyo
null)
ONHi Jyo1105,
Thanks for your question. Based on my research and experiences, the issue may be caused by you set the @CenterID
is a multiple values parameter.
If in this condition, you couldn’t use the expression of
Parameters!CenterID.Value directly, you
should use a join() function on the parameter to merge the whole values, or add a sequence number behind the expression to use a specific value, just like this:
=join(Parameters! CenterID.Value) or
=Parameters! CenterID.Value(0)
If your issue still exsits, please feel free to let me know.
Thanks,
Sharp Wang
Best Regards. Sharp Wang -
Cannot move any files into trash to delete them. I get a Trash warning box saying "The Finder cannot complete the operation because some data in 'file name' could not be read or written.(Error code - 36)".Macbook has so much data it is almost not working.
I have tried reseting to factory settings by removing battery and holding down the power switch for more than 5 sec but this does nothing.
Any ideas would be greatly appreciated as I think with so much unwanted data on the desktop and other places the whole os will crash very soon.
Thanks, RickThe hard drive may be dying anyway, or the directory damaged because it is so full. You should never let the hard drive get over 85% full.
A -36 error is a read/write error.
All you did with the power is reset the SMC. Does nothing to reset everything to factory settings.
Do you have your original 10.4 installer discs for the MacBook?
Is your data backed up? -
File type associations is not working in the App-V 4.6 SP3
Hello,
I found issue, that file type associations is not working in App-V 4.6 SP3. When I try to open associated file with double click I receive next window:
Translate: This action is only valid for products that are currently installed.
I have checked associations in App-V Console and in OSD file, everything looks like OK.
Maybe someone has some ideas?
Could you please share them with me?
Thank you in advance.Is this only happening on one client machine? If so can you completely clear the application and re-stream\cache it again?
If that fails, you could try to create the FTA locally on the client
PLEASE MARK ANY ANSWERS TO HELP OTHERS Blog:
rorymon.com Twitter: @Rorymon -
Text keeps disappearing when I select it to make type at all / make changes / edit. Type tool is not working. I am running CS6 on a Macbook Pro Retina (which I am hating!) 10.9.4 - wish I'd never upgraded.
Photoshop General DiscussionThe RAM needs specs as shown below.
Maximum Memory
16 GB (Actual) 8 GB (Apple)
Memory Slots
2 - 204-pin PC-10600 (1333 MHz) DDR3 SO-DIMM -
Update query not working thru procedure
Hi
I need to update one table column based on another table column.
thru sql statement it is working, but same statement is not working thru stored procedure.
update target_table a set a.col2 = (select col2 from source_table b where a.id = b.id);
Above statement is working thru sql statement ,but it is not working thru procedure.
So Please on this.
Regards,
Venkatpost the code for the procedure. Kindly use before and after the procedure statement!
-
The date and time is not working after setting it to current date and goes back to may,26 2011
the date and time is not working after setting it to current date and goes back to may,26 2011; 2 PM . I bought my ipod tocuh 4th gen on july 18th
On the iPod, make sure your Calendar is set to Gregorian (Settings > General > International > Calendar). Also make sure your date and time on your computer is correct as well as the Time Zones on both.
-
[svn] 4377: Bug: BLZ-292 - Data Push sample does not work in BlazeDS Turnkey
Revision: 4377<br />Author: [email protected]<br />Date: 2008-12-22 16:16:25 -0800 (Mon, 22 Dec 2008)<br /><br />Log Message:<br />-----------<br />Bug: BLZ-292 - Data Push sample does not work in BlazeDS Turnkey<br />QA: Yes<br />Doc: No<br />Checkintests Pass: Yes<br /><br />Details:<br />* Regression due to some refactoring of user-agent handling that was failing to set up defaults if no explicit <properties> were defined for the <channel-definition>. This meant that for IE, no kick-start bytes were being pushed down the streaming connection at setup time...<br /><br />Ticket Links:<br />------------<br /> http://bugs.adobe.com/jira/browse/BLZ-292<br /><br />Modified Paths:<br />--------------<br /> blazeds/trunk/modules/core/src/flex/messaging/endpoints/BasePollingHTTPEndpoint.java<br /> blazeds/trunk/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPEndpoint.java<br /> blazeds/trunk/modules/core/src/flex/messaging/util/UserAgentManager.java
Hi,
Thanks for your feedback!
This feature has been going through a lot of changes with the BlazeDS and Flash Builder builds.
We request you to pick up the BETA2 build of Flash Builder and BlazeDS 4.0.0.10654, hopefully you should see things working fine.
Kindly let us know if you still encounter problems.
Thanks,
Balaji
http://balajisridhar.wordpress.com -
ZSAPLINK for Object type = CLAS is not working
Dear Experts,
ZSAPLINK for Object type = CLAS is not working. On executing by selecting Export Object to Slinkee with Object type = CLAS and class name, It is giving the dump which is shown in below snapshots. Pls guide me how to resolve this error.
Thanks
KHFrom the screenshot, It seems that the object _renderer did not point to any memory location.
You can verify this by putting a breakpoint in method IF_IXML~CREATE_RENDERER of class CL_IXML
If the return value RVAL is initial, this mean there something wrong with the kernel module abkm_iXML_CreateRenderer. If it is, you will have to check with your Basis team to apply some kernel patches.
Hope it helps. Cheers! -
Use of segment, data-type or segment not supported in this position
A message sent to adapter "FILE" on send port "SendPort1" with URI "D:\Shared Files\Coparn\%MessageID%.xml" is suspended.
Error details: Unable to read the stream produced by the pipeline.
Details: Error: 1 (Segment level error)
SegmentID: TDT
Position in TS: 2
15: Use of segment, data-type or segment not supported in this position.
Im getting the error while trying to generate COPARN EDI file using BizTalk.
When I checked all the elements are occurring in the correct positions with accepted values only. Kindly assist.
Regards, Vivin.There seems problem with your Pipeline component ,I would suggest to debug the Pipeline component to verify the exact issue you are facing.
There is similiar thread for thsi issue which can provide you the guidance .
http://social.msdn.microsoft.com/Forums/en-US/f80c870c-a4f9-4d65-9d3c-d43d7f060557/biztalk-console-error-message-unable-to-read-the-stream-produced-by-the-pipeline?forum=biztalkediandas2
Thanks
Abhishek -
input type="file" multiple / not working in IE 10.
< input type="file" multiple /> not working in IE 10.
I am trying to use the HTML 5 multi-file upload capability in a MVC 4 app.
The control allows me to select multiple files when running under localhost but does not work when trying it from the web server.
Is there some web server configuration I need to do? Web server is running IIS 7.Please post ASP.NET questions in the ASP.NET forums (http://forums.asp.net ).
-
Hey, I wanna download Lion for free, so i need UP-TO-DATE , but it do not works , please help
I think you misunderstood the guy. The up-to-date program isn't working for a lot of people. I'm eligible for the free upgrade but it fails to recognise my serial. From what I've read, this is affecting a lot of people who purchased their computers online. Apple seems to be fixing the issue though, so my advice would be to keep trying. Alternatively, click on the manual verificaton link so they can check your order for you and send the redemption code after they do.
-
Binding parameters does not work properly
Hi,
I've installed the ODT with ODA (ODTwithODAC1110720) in my Windows developer enviroment.
I've a .NET 2008 project, using the Oracle.DataAccess library, v2.0.50727.
I need to call a PL/SQL function developed in Oracle 11.1.0.6.
This is the c# function I wrote to insert (throught that PL/SQL function) a record:
public static string InsertContact(OracleConnection conn, string in_id_user, string in_i_type_contact, string in_priority, string iv_contact, string iv_note)
StringBuilder sbSQL = new StringBuilder();
sbSQL.Append("declare ");
sbSQL.Append(" id_contact number; ");
sbSQL.Append("begin ");
sbSQL.Append(" :id_contact := pk_contact.insert_record( ");
sbSQL.Append(" :in_id_user");
sbSQL.Append(" ,:in_i_type_contact");
sbSQL.Append(" ,:in_priority");
sbSQL.Append(" ,:iv_contact");
sbSQL.Append(" ,:iv_note");
sbSQL.Append(" ); ");
sbSQL.Append("end;");
Oracle.DataAccess.Client.OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = sbSQL.ToString();
cmd.Parameters.Add("in_id_user", OracleDbType.Int32).Value = "265";
cmd.Parameters.Add("in_i_type_contact", OracleDbType.Int32).Value = "1";
cmd.Parameters.Add("in_priority", OracleDbType.Int32).Value = Convert.DBNull;
cmd.Parameters.Add("iv_contact", OracleDbType.Int32).Value = "348";
cmd.Parameters.Add("iv_note", OracleDbType.Varchar2).Value = Convert.DBNull;
cmd.Parameters.Add("id_contact", OracleDbType.Int32, ParameterDirection.ReturnValue);
cmd.ExecuteScalar();
// Return the new id_user
return cmd.Parameters["id_contact"].Value.ToString();
This was working fine when I used the System.Data.OracleClient library (I was using DbType instead of OracleDbType, and Number instead of Int32, and Varchar instead of Varchar2).
Now it seems that the parameters are not bound, the PL/SQL functionreceives all NULL.
What am I doing wrong?
Thanks in advance,
SamuelHi,
You didnt provide the interface of the PLSQL procedure, but it looks like you're having a problem because the ReturnValue parameter is currently appended last, and needs to come first. ODP defaults to Bind By Position, so the parameters ned to be added in the order declared in the statement. There's also a cmd.BindByName property you can set to true if you want to change the default behavior.
Also, not that it's illegal or anyting, but you dont really need to go through the trouble of creating your own anonymous block to call the proc. You could just set
cmd.CommandText = "pk_contact.insert_record"
cmd.CommandType = CommandType.StoredProcedureand then apend the parameters in the right order(again, returnvalue gets added first).
Hope it helps,
Greg
Edited by: gdarling on Jul 7, 2010 9:16 AM
Note also that the ODP forum would be more appropriate for future ODP questions, and is located at ODP.NET -
Create Type as Object not working in linux oracle 11g
Pleae refer to the following simple create type as object statement.
CREATE OR REPLACE TYPE EC_VIEWABLETYPES as object ( CASE_TYPE_ID NUMBER)
It is working in oracle 11g and windows server 2008 environment.
But it is not working in oracle 11g with linux environment.
I am executing this statement as dynamic sql as follows
CREATE OR REPLACE PROCEDURE TEMP_SP
AS
BEGIN
DECLARE vcType VARCHAR2(30);
BEGIN
SELECT OBJECT_TYPE into vcType FROM USER_OBJECTS
WHERE OBJECT_NAME='EC_VIEWABLETYPES' AND OBJECT_TYPE='TYPE';
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXECUTE IMMEDIATE 'CREATE OR REPLACE TYPE EC_VIEWABLETYPES as object ( CASE_TYPE_ID NUMBER) ';
COMMIT;
RETURN;
END;
END;
exec TEMP_SP
please let me know what i am missing ?And error is:ORA-00600: internal error code, arguments: [kothc_uc_md5:lxerr], [], [], [], [], [], [], [], [], [], [], []
ORA-06512: at "ATIPAGENT.TEMP_SP", line 10
ORA-01403: no data found
ORA-06512: at line 1
..Query:exec TEMP_SP...Previous Query:CREATE OR REPLACE PROCEDURE TEMP_SP AS BEGIN DECLARE vcType VARCHAR2(30); BEGIN
SELECT OBJECT_TYPE into vcType FROM USER_OBJECTS
WHERE OBJECT_NAME='EC_VIEWABLETYPES' AND OBJECT_TYPE='TYPE'; EXCEPTION WHEN NO_DATA_FOUND THEN
EXECUTE IMMEDIATE 'CREATE OR REPLACE TYPE EC_VIEWABLETYPES as object ( CASE_TYPE_ID NUMBER) ';
COMMIT;
RETURN;
END;
END; -
Value in data type p filed not displayed properly
Hi,
One of my programs downloads a file to UNIX server,
here the data which i am downloading, one of the fields is of type P (it is of domain type DEC).
The field displays very strangecharactershen i view it in UNIX server.
I am using OPEN DATASET in binary mode statement.
Please helpHi Kumar,
i am using unicode database,
but i can not change the data type of the internal table as it is decalred as follows
data:begin of itab
include structure hrdataset.
data:end of itab.
writing down all the fields individually inside the program will be very tedious
otherwise ihave o write like as follows,
data:begin of itab
field1 type hradataset-field1
fieldn type hrdataset-fieldn
end of itab.
Is there a work around available?
Maybe you are looking for
-
Hi, I need to convert one key figure into other one with the following formula. if the month is JANUARY keyfigure1 / 31, if is february keyfigure1 / (28 or 29, depends of the year). How can I do that? how can I obtain the days of the month in a fox f
-
Just did an Upgrade to 4.4.4 on my Apple TV and Netflix and NHL are gone?
I have an NHL subscription and it was working on my Apple TV but I did a recent Software Upgrade to 4.4.4 and HNL along with Netflix is gone? I retried the upgrade and it has the same problem.
-
select * from tablename ------always running,but get nothing select top 1 * from tablename -------get result quickly select top 2 * from tablename -------get result quickly select top 14259 * from tablename ------
-
I am using NI PXI 8108 Embedded controller which is Windows 7 professional configured.When it is powered ON starting it shows following error, "This error can be caused by unplugging a removable storage device such as an external USB drive while the
-
Selection/Filter Criteria restriction in reports?
Hi, We have a requirement to restrict customer master data list by signed on user (sales rep - navi attr of customer) how will you restrict master data in query filter variable? we have implemented data level security for reps (sales rep is a naviga