There are a number of different Oracle and SQL Server locations.
Personal deepest experience is that the stored procedure returns the result set, and the direct select query in SQL Server is OK, Oracle is not.
Here, we use the simplest example to illustrate the example of a stored procedure returning a result set.
CREATE OR REPLACE PROCEDUREStored Procedure name (field nameinch VARCHAR2,L_result out TYPES. Rq_ref_cursor--the method name inside the package) isStr_sqlvarchar2(8000) := "'; beginStr_sql:='SELECT * from Tabelname where id='||Field name;
OpenL_result forStr_sql;
ENDRegion_linkage;
Create package (not required)
CREATE OR REPLACE as isCURSOR; END;
Creating a package is not necessary, adding the REF CURSOR directly after the OUT keyword of the stored procedure can also
In addition, the general method of calling stored procedures in C # is added
PublicDataTable Insertt_builditem (stringregion_id) {DataSet DS=NewDataSet (); Try { stringsql ="Stored Procedure name"; OracleConnection Con= This. _sqlcon; OracleCommand cmd=Neworaclecommand (sql, con); Cmd.commandtype=CommandType.StoredProcedure; The declaration is a stored procedure cmd. Parameters.Add ("Incoming parameter name", Oracletype.nvarchar). Value =region_id; Cmd. Parameters.Add ("the name of the cursor returned", OracleType.Cursor). Direction =ParameterDirection.Output; OracleDataAdapter AD=NewOracleDataAdapter (CMD); Ad. Fill (DS,"Report_build"); } Catch(Exception e) {Throwe; } returnDs. tables[0]; }
Related documents
Oracle Video Tutorial: Http://oracle.so138.com/video
Oracle Beginner's Tutorial: http://www.cnblogs.com/linjiqin/category/349944.html