Problem with parameterised CASE UPDATE

Поиск
Список
Период
Сортировка
От Mike Martin
Тема Problem with parameterised CASE UPDATE
Дата
Msg-id CAOwYNKaRNDMSCE1w6CxnyqDXzqoqTqjdmqne8wFCkhX2D=YJEw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Problem with parameterised CASE UPDATE  (Steve Midgley <science@misuse.org>)
Re: Problem with parameterised CASE UPDATE  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-sql
Hi
I have the following query

PREPARE chk AS
UPDATE transcodes_detail td
SET
sortid=CASE WHEN $1 = 6 THEN $2::numeric ELSE td.sortid END
WHERE detailid=$3
execute chk (7,'1c',73)

It fails as ERROR: invalid input syntax for type numeric: "1c"
It seems to check all parameters before it tests whether parameter 1 equates to 6 (in this instance).

Is there a way round this

thanks in advance

В списке pgsql-sql по дате отправления:

Предыдущее
От: Mark Bannister
Дата:
Сообщение: Recursive CTE with a function
Следующее
От: Steve Midgley
Дата:
Сообщение: Re: Problem with parameterised CASE UPDATE