存储过程提供错误的输出

时间:2015-06-01 09:44:17

标签: sql stored-procedures

我希望flimname'角斗士'不是输出中的其他电影名称

alter proc spfilmcriteria(@Minlength as int,@maxlength as int,@title as varchar)
as
begin
select filmname,filmreleasedate,filmruntimeminutes
from tblFilm
where filmruntimeminutes > @Minlength and filmruntimeminutes< @maxlength and FilmName like  '%' + @title + '%'
order by filmruntimeminutes asc
end

exec spfilmcriteria 150,160,'gladiator'

输出:

filmname    filmreleasedate                              filmruntimeminutes
Gladiator   2000-05-12 00:00:00.000                           155
Harry Potter and the Goblet of Fire 2005-11-18 00:00:00.000   157
American Gangster   2007-11-16 00:00:00.000                   157

3 个答案:

答案 0 :(得分:2)

您有错误:

@title as varchar

@title as varchar(1)默认为gladiator

因此,您实际上不是g,而是class Node { Object id; List<Node> children; Node parent; public Node(Object id) { this.id = id; children = new LinkedList<>(); } }

答案 1 :(得分:1)

@title as varchar     

应该是@title as varchar(max)或您在数据库中存储的任何长度

答案 2 :(得分:0)

G::UndefinedColumn: ERROR:  column "conjoncture_index_id" referenced in foreign key constraint does not exist
: ALTER TABLE "reports" ADD CONSTRAINT "fk_rails_c25ad9a112"
FOREIGN KEY ("conjoncture_index_id")
  REFERENCES "conjoncture_indices" ("id")