Send null value to oracle stored procedure

DannyT

New member
Joined
Mar 27, 2005
Messages
2
Programming Experience
3-5
want to execute an oracle stored procedure sending parameters based on some vb.net form object values, which, if they are Nothing or "" (empty strings) then send the value Null to the procedure.

executing the procedure from oracle works fine using null for parameters, and executing the procedure from vb.net WITH valid values for parameters works fine, the problem is when i try to send a null value or exclude the parameter from VB i get the error:

An unhandled exception of type 'System.Exception' occurred in system.data.oracleclient.dll

Additional information: Parameter 'i_order_no': No size set for variable length data type: String.

That is using DBNull or DBNull.value as the parameter.

Any help much appreciated
 

DannyT

New member
Joined
Mar 27, 2005
Messages
2
Programming Experience
3-5
It was actually the dbnull.value i needed to use, however i'd originally used it in a bodged up IF statement.

Thanks for your suggestion
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
You'll probably find that dbnull.value = "NULL" as NULL is the value for SQL. But either way, as long as it works right... :)
 

Soofi

Member
Joined
Nov 15, 2005
Messages
7
Location
Karachi, Pakistan
Programming Experience
10+
sending null to a numeric parameter

Hi,

I have an oracle procedure, that accept number type parameter, this parameter never receives 0 value, either parameter value > 0 or it will be null, in oracle environment.

how can i send null value to this parameter instead of 0, if the value > 0 then this not any issue. but the problem arises when i send it a 0 value.

oracle procedure returns me "ERR" string when i send 0, however if i am somehow arrange to send the value null, the procedure returns "OK" string.

also i m unable to edit the procedure.

can anybody help me in this regard.

Thanks in advance.
 

Soofi

Member
Joined
Nov 15, 2005
Messages
7
Location
Karachi, Pakistan
Programming Experience
10+
Found solution

I do practice a lot for solution and finally i got it.

I use DBNull.Value to send null to oracle procedure number type parameter and this works.
 
Top Bottom