Re: Conditional Statement

Поиск
Список
Период
Сортировка
От Marshall Spight
Тема Re: Conditional Statement
Дата
Msg-id a64cep$24ht$1@jupiter.hub.org
обсуждение исходный текст
Ответ на Conditional Statement  (Samik Raychauhduri <samik@cae.wisc.edu>)
Список pgsql-general
"Samik Raychauhduri" <samik@cae.wisc.edu> wrote in message news:3C82CA4C.6030205@cae.wisc.edu...
> I am trying to write a piece of SQL code, which will first check if a
> table exist, drop it and then recreate it. I didn't see any 'IF' syntax
> in pgsql. Is there any other alternative? I tried to use 'case'
> structure, but didn't succeed.

The way you do that is to say:

drop table foo
create table foo ...


That's all you need. Nothing fancy. The 'drop table' will print a message
if the table didn't exist already, but it doesn't matter.


Marshall




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

Предыдущее
От: Ymir
Дата:
Сообщение: Arrays
Следующее
От: rrozboril@goldmann.sk (Robert)
Дата:
Сообщение: Stored procedure in PostgreSQL