简体   繁体   中英

Number of parameters in the SQL stored procedure Groovy

In my groovy code I have to call a SQL stored procedure with a large number of parameters ( 70 ).

new Sql(dataSource_myDataSource).call("{call Sp_StoredProcedure(?, ?, ?, ?, ...) }",
            [
                cmd.blankid,  
                session?.user.sdk,
                cmd.one,
                cmd.two,
                //and so on

            ])  

Question: Is there any way to avoid filling the Sp_StoredProcedure( ) with 70 question marks?

-- Thanks, Qubit

You can always construct the query:

sql_query = "<prefix>"
sql_query += "?, " * 69
sql_query += "?)<suffix>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM