begin-end blocks in psql

Поиск
Список
Период
Сортировка
От Gauthier, Dave
Тема begin-end blocks in psql
Дата
Msg-id 0836165E8EE50F40A3DD8F0D87137267255FA6@azsmsx421.amr.corp.intel.com
обсуждение исходный текст
Ответы Re: begin-end blocks in psql
Список pgsql-general

How do you do a simple begin-end statement block inside of a psql session?

 

For Example, I want to...

 

-          begin

-             declare a variable x to be an integer.  Set it = 5

-             declare s to be a varchar(8).  Set it to “foo”

-             insert into mytable (theint,thestr) values (x.s);

-          end

 

I can do it in a formal declaration of a procedure, and then execute the procedure.  But is there a less formal way?

 

Thanks

-dave

 

 

 

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

Предыдущее
От: "Adam Rich"
Дата:
Сообщение: Re: MySQL to Postgres question
Следующее
От: "Adam Rich"
Дата:
Сообщение: Re: 8.3.0 upgrade