I have two procedures in oracle which define a parameter differently, even though the underlying data is the same. In code we represent it as an integer.
procedure GetByNum(..., vRegionID in number, ...)
procedure GetByInt(...., vRegionID in integer, ...)
In java we always define the field as an Integer (and in db too)
public Integer getRegionID() {
return 100;
}
Is there a way to pass this (in java) integer to both procedures using the same OracleTypes.*? We use a custom base wrapper around org.springframework.jdbc.object.StoredProcedure to call both of them. Modifying the stored procedures is not allowed for right now, so all that is left is fixing up the java.
- Can you pass
getRegionIDasOracleTypes.NUMBERto thegetByIntproc? - Can you pass it as
OracleTypes.INTEGERtogetByNum, which expectsin number? - Another, magical way?
This might seem simple, but I assume i’m not allowed to mangle parameters like this. I hope thats not true!
Edit:
- Using
OracleTypes.INTEGERto pass toprocedure ... (param in number)worked - Don’t know if this is just environment specific though
Hoping for a definitive answer, so I can have them start using the new wrapper without worrying about an unforeseen issue.
INTEGERis a ANSI standard type, which Oracle describes as a subtype ofNUMBERasNUMBER(38). Therefore, anywhere that takes anINTEGERas a parameter should also accept aNUMBERso long as there are no fractional parts.