0

I am converting Oracle Syntax into Postgres

SELECT MSN_INT_ID,
       MO_INT_ID,
       'Y'   "AIRMOVE"
  FROM MISSION_OBJECTIVE
 WHERE MO_MSN_CLASS_CD = 'AMV'
 GROUP BY MSN_INT_ID,
          MO_INT_ID

This part is confusing me:

SELECT MSN_INT_ID,
       MO_INT_ID,
       'Y'   "AIRMOVE"

What is the 'Y' "AIRMOVE" doing?

3 Answers 3

1

The snippet 'Y' "AIRMOVE" introduces a computed column into the select-list named AIRMOVE whose value is always 'Y'.

Sign up to request clarification or add additional context in comments.

Comments

1

It's a computed column, using a statically defined value.

Comments

1

Part of the confusion may be coming from PostgreSQL 8.3 or earlier, where the "AS" keyword is not optional.

Change:

'Y'   "AIRMOVE"

To:

'Y' AS "AIRMOVE"

And it should work fine. The keyword is optional starting in version 8.4, although I advocate always including it to avoid issues exactly like this one.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.