here is my situation:
I am able to call a SQL SERVER stored procedure from a JAVA SERVLET (the servlet handles the data received by an http request, creates the sql statement, connect to DB and execute the statement), Everithing was good with any of basic values formats (Datetime,varchar,int ecc ecc) but now i have to call a stored procedure that accept a "temporary" TABLE VARIABLE. this table has to be fullfilled with the values of an Array of JSON OBJECT. How can i create this temporary TABLE VARIABLE??
suppose my JSONARRAY to be:
[
{
"name" : "gio",
"surname : "venice",
"age":"28 years"
},
{
"name" : "frek",
"surname : "joshua",
"age":"21 years"
},
.....
]
i would like to have a table variable with these 3 columns(name,surname,age) and as much rows as the JSONARRAY length AND that variable has to be passed as aparameter like this:
String variable1 = "blabla";
Int variable2 = 3;
TableVariable tablevariable = "tablevariable_that_i_donno_how_to_build"
String query = "{call storedprocedureblablalba(?,?,?)}";
CallableStatement cstmt = connection.prepareCall(query);
cstmt.setString(1,variable1);
cstmt.setString(2,variable2);
cstmt.setString(3,tablevariable );
Thanks for any kind of help!!!