Re: Function Syntax involving pipes and ' marks?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Function Syntax involving pipes and ' marks?
Дата
Msg-id 20080910005847.GH4223@alvh.no-ip.org
обсуждение исходный текст
Ответ на Function Syntax involving pipes and ' marks?  ("Ruben Gouveia" <rubes7202@gmail.com>)
Список pgsql-sql
Ruben Gouveia escribió:
> No matter how many times i try, i can't seem to get the write amount of '
> marks around the date parameters in my v_where declaration. What am i doing
> wrong here?

Apparently you're not aware that you can nest the $$ quote marks.  You
could just use $a$ to assign to the varchar, and use ' inside that
string to get the literal '.  Of course, you could use also $b$ instead
of a plain single quote.

That is,    v_where varchar(256) := $a$ where m.jb_date < $a$||p_date + integer '1'||                            $a$
andm.jb_date >='$a$ ||p_date|| $a$'$a$;
 

or (harder to read)
    v_where varchar(256) := $a$ where m.jb_date < $a$||p_date + integer '1'||                            $a$ and
m.jb_date>=$b$  $a$ ||p_date|| $a$ $b$ $a$;
 


-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


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

Предыдущее
От: "Ruben Gouveia"
Дата:
Сообщение: Function Syntax involving pipes and ' marks?
Следующее
От: "Kota, Prasoona"
Дата:
Сообщение: FW: Help- post gress sql error