10

I want to have query like below

select "RETRY" as code , name from process ;

then the results are

code |  name
_____________

RETRY  PX1
RETRY  PX1
RETRY  PX3
RETRY  PX4
RETRY  PX5

I want to add one string literal as column for all rows returned by select query. I am trying this in PostgreSQL, but getting the following error:

SQL Error [42703]: ERROR: column "RETRY" does not exist
  Position: 8

yny idea how to do this in a PostgreSQL select query?

Bravo
  • 8,589
  • 14
  • 48
  • 85

2 Answers2

7

double quote refers column name of that table thats why you are getting error you have to use single quote

select 'RETRY' as code , name from process ;
Zaynul Abadin Tuhin
  • 31,407
  • 5
  • 33
  • 63
3

String literals need to be enclosed in single quotes in SQL:

select 'RETRY' as code, name 
from process;