Wm Allen Smith
asked on
Deriving quarter from date field in Oracle
Hi,
I have a date field in query in Oracle and I am having trouble pulling out the quarter. Here is the code:
I'd like to represent the line
MAX(trunc(URA_DOC_ITEM.sta rt_date)) STARTDT as YYYYQ, but I cannot get it to work without an error.
I have used EXTRACT and TRUNC but to no avail. Any ideas?
-wasmithpfs
I have a date field in query in Oracle and I am having trouble pulling out the quarter. Here is the code:
Select --URA_DOC_ITEM.prod_num,
--URA_PROD.SKU,
URA_DOC_ITEM.CAT_OBJ_NAME, URA_DOC_ITEM.PROD_GRP_ID,
URA_DOC_ITEM.member_id_updated, URA_DOC_ITEM.date_updated,
fn.FLD_VALUE,
fd.FLD_VALUE,
URA_DOC.STRUCT_DOC_TYPE DOC_TYPE,
MAX(trunc(URA_DOC_ITEM.start_date)) STARTDT,
MAX(URA_DOC_ITEM.BASE_PRICE) URA,
max( amp.BASE_PRICE) as amp,
max( bp.BASE_PRICE) as BP,
max( amp.BASE_PRICE) - max( bp.BASE_PRICE) as CALCURA--,
--max( amp.BASE_PRICE) - max( bp.BASE_PRICE)/ CWAC.base_price as DISC
from mmasw_cnt.MN_STRUCTURED_DOC URA_DOC,
mmasw_cnt.MN_STRUCT_LINE_ITEM URA_DOC_ITEM,
MMASW_PRD.MN_ITEM URA_PROD,
mmasw_prd.mn_Cat_Map m
I'd like to represent the line
MAX(trunc(URA_DOC_ITEM.sta
I have used EXTRACT and TRUNC but to no avail. Any ideas?
-wasmithpfs
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to help.
Also wanted to post the documentation link containing all the masks you can use:
http://docs.oracle.com/database/122/SQLRF/Format-Models.htm#SQLRF00210
Also wanted to post the documentation link containing all the masks you can use:
http://docs.oracle.com/database/122/SQLRF/Format-Models.htm#SQLRF00210
ASKER