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;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。