Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would normally declare a variable in the following manner...

DECLARE @myVariable Text
SET @myVariable = 'pages'

SELECT
@myVariable
FROM
coredata

How would this change in PostgreSQL (...pgAdmin III) query?
Posted

1 solution

Hi,

Have a look here:
http://stackoverflow.com/a/1491329[^]
There is no such feature in PostgreSQL. You can do it only in pl/PgSQL (or other pl/*), but not in plain SQL.
 
Share this answer
 
Comments
Runner55Code 8-May-13 12:45pm    
For a beginner (...in PostgreSQL) the http://stackoverflow.com/a/1491329[^] solution is a bit confusing.
Thomas Daniels 8-May-13 12:47pm    
Yes, but it answers your question.
Runner55Code 8-May-13 13:05pm    
Ok, I'll work on it...but PostgreSQL seems to have made something relatively simple - complex.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900