Search Postgresql Archives

begin-end blocks in psql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

 

 

 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux