cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Null value to JDBC stored procedure

Former Member
0 Kudos

Hi All,

i have a requirement like i need to pass the Null Value as input to stored procedure if that field diesnt exist.

Let me explain clearly.

I have a scenario SAP-PI-DB, suupose i have 10 fileds as input to SP,the requirement from the DB is they want PI to pass all the fileds as input eventhough if any field doent exist,i need to send a null value if any field doesnt exist.

Suppose i have a field Name which is mapped to EMname in SAP,if this doesnt exist in SAP,i need to send a NULL(not string,jdbc null value) value for this field to SP.

Please let me know if any more info is required.

Thanks,

Hemanth.

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

You have to create an "empty string" as target.

You can use function mapwithdefault, that faunction create an element when it is missing in source.

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

You can easily handle this in mapping, use 'mapWithDefault' node function & put the default value as null.

When the source field is missing in the source payload, the default value (null) will be given to the target.

-Supriya.

Former Member
0 Kudos

Hi Hemanth,

You can pass the following values (which means DB null value)

For Oracle DB - DbNull.Value

For MSSQL Server - System.DBNull.Value

as input parameters to the SP that your are calling on the Receiver Side.

OR else,

"Interpreation of empty string value as null" can also be tried as suggested by all.

I hope this helps.

Regards, Gaurav.

Edited by: Kumar Gaurav on Oct 11, 2010 1:19 PM

Former Member
0 Kudos

hI,

Use "Interpreation of empty string value as null" in ur JDBC receiver channel.

http://help.sap.com/saphelp_nw70/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm

Thanks

Amit

Former Member
0 Kudos

Hi Hemanth,

See option of your Receiver Communication Channel, in tab "Processing" and option "Interpretation of empty String values" = NULL value or Empty value.

Maybe that will resolve your issue.

Regards.

Mickael.

Former Member
0 Kudos

Hi Hemanth,

I think you can make this work with a Java UDF function. I suppose the hex value of a JDBC null value would be '00', so you could create a UDF function which outputs this value.

kr,

Peter Glas