Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Oracle error – "Pending": invalid identifier

i’m creating a query with typeorm with oracle.

I’m using this in a select, because the status can be null.

'NVL(Details.status, "Pending") AS "PostulationDetail_status"'

I have used this before but using 0, because i was working with numbers. I decided to test with strings and i got surprised. i get this error on console

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

[Nest] 620  - 18-11-2021 12:20:29   ERROR [ExceptionsHandler] ORA-00904: "Pending": invalid identifier
QueryFailedError: ORA-00904: "Pending": invalid identifier

I don’t know how to write the query so it is valid. Does anyone had an experience like this ?

>Solution :

You want to use single quotes around string literals and either no quotes (the preferable, case-insensitive option) or double quotes (case-sensitive) around identifiers:

NVL(Details.status, 'Pending') AS "PostulationDetail_status"

If you use double quotes:

NVL(Details.status, "Pending") AS "PostulationDetail_status"

Then you are saying to return the DETAILS.STATUS value (this identifier is case-insensitive) or, if that is NULL then, use the value of the Pending column (this identifier is case-sensitive) and alias the value as PostulationDetail_status (again, case-sensitive).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading