Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The given Oracle query inserts data into table by substituting variables. How I achieve the same in PostgreSQL?

INSERT INTO control_threshold (
    threshold_id, group_name, description, sql, low_value, high_value)
    threshold_seq.nextval, '&2', '&1',  TRIM('&5' || '&6' || '&7' || '&8' || '&9'),
    trim('&3'), trim('&4'));
share|improve this question
In reference to your deleted question: That deleted my answer as well, and I don't think your question was completely unfounded. There has been confusion before. I suggest you undelete it and edit in that your version of Postgres did not seem to support the type hstore. – Erwin Brandstetter Jul 14 '14 at 19:05

These variables are a feature of SQL*Plus.

psql, the equivalent program in the PostgreSQL world, also has variables.


\set variable 'value'


insert into mytable(mycolumn)
values (:variable);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.