1. Question about the stored procedure parameters in SQL database how can I use the stored procedure parameters in SQL database as both output variables and output variables? [SQL] viewplaincopy -- dropprocproc_test -- gocreateprocdbo. proc_test @ inint, @ out0000ut, @ in_out0000utputasselect @ out @ in +
1. Question a
Stored Procedures
?$conn =mssql_connect ("127.0.0.1", "User", "passwd");mssql_select_db ("MyDB");$stmt =mssql_init ("Pr_name", $conn);$a = 50001;Mssql_bind ($stmt, "RETVAL", $val, Sqlvarchar); Used to return the value of return-103 this class directly.Mssql_bind ($stmt, "@outvar", $b, sqlvarchar,true);//To return the output parameters defined in the stored procedureMssql_bind ($stmt, "@invar", $a, SQLINT4);$result = Mssql_execute ($stmt, true);//canno
CREATE PROCEDURE Proc_page_withtopmax(@pageIndex int,--Page index@pageSize int,--display number per page@pageCount int output,--total pages, output parameters@totalCount int output--Total number of bars)AsBeginSET NOCOUNT on;declare @sql nvarchar (1000)Set @sql = ' select top ' from Tb_testtable where (id> (select Max (ID) from (select Top ' +str ((@pageIndex-1) * @pageSize) + ' ID from tb_testtable ORDER b
Theory:
The following cmdobj. Is the defined sqlcommand object
1. Obtain the return value of the entire stored procedure function returned by the Return Statement in the stored procedure:
// Obtain the return value of the stored procedure, define a parameter, and specify that it is used to accept the return valueCmdobj.
Welcome to the Linux community forum and interact with 2 million technical staff to enter the simple example of the in and out parameters in the MySQL stored procedure: [html] mysqlDELIMITER $ mysqlUSEtest $ DatabasechangedmysqlDROPPROCEDUREIFEXISTS 'SP _ add' $ QueryOK, 0 rowsaffected (0.00sec) mysq
Welcome to the Linux community forum and interact with 2 million technical staff> enter the simple example o
Oracle Stored Procedure type:
1, in: The input type, that is, the application passes data into the Oracle stored procedure, this parameter is read-only parameter in the stored procedure, cannot modify the parameter of the type in the stored procedure;2, out: The output parameter, is in the stored
1. Use of parameter in (on behalf of input, meaning that your parameters will be passed to the process of storage)To avoid a semicolon (";") in the stored procedure In the concluding sentence, we use the delimiter to tell the MySQL interpreter whether the command is over./**Case function: Seeking 1-n andDeveloper: Xu ShouweiDate: 2016-08-13*/Delimiter $CREATE PROCEDURE
Reconstruction path Combined Query-passing parameters + Stored Procedure
In the previous article, we discussed a method for implementing composite queries. That is, at the U layer, we assembled the where clause of the select statement and assigned it to a string variable, upload to layer D and then form a complete SQL statement with the select clause. then execute the statement and return the query result.
MySQL stored procedure with the in and out parameters bitsCN.com
MySQL stored procedure with in and out parameters
The simplest example:
[html] mysql> DELIMITER $$ mysql> USE test $$ Database changed mysql> DROP PROCEDURE IF EXISTS `sp_add`$$ Query OK, 0 rows affected
One of the existing parameters is a date type of storage:Date ) as begin Dbms_outputput_line (To_char (T_var, ' YYYY ')); --dbms_output. put_line (T_var); End; The implementation code for the job is:begin Dbms_scheduler. create_job ( = ' FFFF ', = = ' Stored_procedure ', //Indicates that the job is executing a stored procedure type = ' "Schema
Reconstruction path Combined Query: Passing parameters + stored procedure, rebuilding Combined Query
In the previous article, we discussed a method for implementing composite queries. That is, at the U layer, we assembled the where clause of the select statement and assigned it to a string variable, upload to layer D and then form a complete SQL statement with the select clause. then execute the statement a
Using the self-contained function in PHP MSSQL
1. Initializing the stored procedure
$stmt = Mssql_init (' procedure name ');
2. Binding variables
Input parameters:
Mssql_bind ($stmt, ' @operate_flag ', $status, Sqlvarchar); Note that the third argument must be a variable, otherwise an error
Output parameters:
Mssql_bin
SELECT * FROM table;
SELECT * FROM table1;
Out $id;
As above: The stored procedure returns two result sets and one output parameter, how do you get both result sets and output parameters in PHP?
Reply to discussion (solution)
ReadSee Pdostatement::nextrowset method description
ReadSee Pdostatement::nextrowset method descriptionIf there are only multiple collections I know, but there are output
1. SQL database stored procedure parameters
How can I use parameters in the stored procedures of SQL database as both output variables and output variables?
[SQL] view plaincopy -- drop proc proc_test
-- Go
Create proc dbo. proc_test
@ In int,
@ Out int out,
@ In_out int output
As
Select @ out = @ in + @ in_out, -- 1 + 2 = 3
@ In_out = @ out + 1 -- 3 + 1 = 4
Go
D
Inchrepresent input, meaning that your parameters will be passed through the process. The basic can be understood as the parameter passed in the function, and if the argument is a variable, then the entire procedure process ends without affecting the external variable value./Case function: Seeking 1-n andDeveloper: Xu ShouweiDate: 2016-08-13/Delimiter $CREATE PROCEDURE
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.