4

I'm trying to call MSSQL stored procedure functions in my Laravel project, the procedures with only input parameters work well, but functions with input and output parameters have issues.

when I call the function with only its input parameters to get the BILL_NUMBER like the below code.

$username="admin";
 $currency_id=1;   
 $results = DB::select( "EXEC stored_procedure_function ?, ?", 
       array($username, $currency_id)
    );

I get this error SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Procedure or function 'stored_procedure_function ' expects parameter '@BILL_NUMBER', which was not supplied.

and also when I add the input and output parameters

 $username="admin";
 $currency_id=1;   
 $results = DB::select( "EXEC stored_procedure_function ?, ? , @BILL_NUMBER", 
       array($username, $currency_id)
    );

i get this error SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Must declare the scalar variable "@BILL_NUMBER".

0 Answers0