准备并执行SQL

时间:2017-05-15 11:10:17

标签: sql postgresql prepared-statement psql

当我运行以下

PREPARE fooplan (dataset text) AS
create or replace VIEW $dataset$_view as (
  select * from $dataset$ one where not exists(
     select* from $dataset$ two where
     ((one.x <= two.x and one.y <two.y) OR
     (one.x < two.x and one.y <=two.y))) ORDER BY y DESC, x DESC);

在psql中按Enter键,不会出现错误或成功语句。我觉得终端期待我添加一些不确定的东西? 任何人都可以看到缺少的东西吗?

1 个答案:

答案 0 :(得分:0)

您已创建准备好的陈述,然后必须执行:

EXECUTE fooplan('foobar');

有关它的更多信息here.