A scripting language provided by pgAdmin to interact with a PostgreSQL database
Questions tagged [pgscript]
3 questions
1
vote
0 answers
How to make declaration in PGAdmin III (version : 1.22.1)
My question might sound silly, but here's the problem.
I just want to declare this in a pgscript:
DECLARE @I, @J, @T, @G;
according to this, but I get this error:
ERROR: syntax error at or near "@"
LINE 1: DECLARE @I, @J, @T, @G;
What am I…

Dino C
- 307
- 3
- 15
1
vote
0 answers
Accessing array of string in pgScript
My pgScript script cannot read values from an array of string. This is my script.
DECLARE @my_array;
DECLARE @i;
SET @my_array = '{"element 1", "element 2",
"element 3", "element 4", "element 5", "element 6",
"element 7"}';
SET @i = 1;
PRINT…

user7069441
- 11
- 1
0
votes
1 answer
INSERT INTO table if exists or else CREATE TABLE
I have a pgscript that runs in a loop.
SET @id = 1;
BEGIN
WHILE @id <= 10
/*
CREATE TABLE tbl_name AS
SELECT * FROM main_tbl
WHERE id = @id
;
INSERT INTO tbl_name
SELECT * FROM main_tbl
WHERE id = @id
*/
SET @id = @id + 1;
END
For the first…

Garfield
- 143
- 11