Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Month function in Script

Hi:

Full disclosure I'm not a QV developer, just playing one on TV.

Trying to load several fields from and Oracle DB and in the process create a new Month and Year field based upon a timestamp field that is coming in.

Currently have:

DETL: 

SQL SELECT

ID,

CREATE_DATE,

MONTH (CREATE_DATE) as CREATEMONTH;

And get:

ErrorSource: OraOLEDB, ErrorMsg: ORA-00904: "MONTH": invalid identifier

Can I do this or am I just doing somethign stupid?

Thanks in advance,

Jim

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

In principle you should be able to do this, but it is better if you use a preceding load:

Load

ID,

CREATE_DATE,

MONTH (CREATE_DATE) as CREATEMONTH;

SQL SELECT * FROM ...

HIC

View solution in original post

4 Replies
hic
Former Employee
Former Employee

In principle you should be able to do this, but it is better if you use a preceding load:

Load

ID,

CREATE_DATE,

MONTH (CREATE_DATE) as CREATEMONTH;

SQL SELECT * FROM ...

HIC

Not applicable
Author

This worked perfectly. Thanks for the quick reply.

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

You can use To_Char function too

To_Char(Date_Field,'MM') = 01

To_Char(Date_Field,'MON') = JAN

To_Char(Date_Field,'YY') = 03

To_Char(Date_Field,'YYYY') = 2003

Also you can go with preceding load as suggested by Henric Cronström.

Not applicable
Author

Sorry, Gysbert, accidentally deleted your post but it did work as well. All great options.