T-sql的写法:
USE AdventureWorks;
GO
CREATE PROCEDURE FindEmployee @EmpLname varchar(20)
AS
SELECT @EmpLname = RTRIM(@EmpLname) + '%';
SELECT c.Firstname,c.Lastname,a.City
FROM Person.Contact c JOIN Person.Address a ON c.ContactID = a.AddressID
WHERE c.Lastname liKE @EmpLname;
GO
EXEC FindEmployee @EmpLname = 'barb';
PL/sql的写法:
create or replace procedure query_By_Key
(
p_key1 in varchar2,
p_key2 in varchar2,
p_cursor out JN_table.JN_Ctable
)*
as
str_sql varchar2(500):=' select * from tableA' ||
' where pname like :v_key1 and pname like :v_key2 ' ;
begin
open p_cursor for str_sql using '%' || p_key1|| '%','%'|| p_key2||'%';
end query_By_Key;
以上是内存溢出为你收集整理的oracle 存储过程模糊查询的两种写法全部内容,希望文章能够帮你解决oracle 存储过程模糊查询的两种写法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)