oracle中,25-09-14怎么转换成日期格式:yyyy-mm-dd,已经试过to_char()和to_date(),都报错;FUNCTION get_order_date(p_segment1 IN VARCHAR2, p_organization_code IN VARCHAR2) RETURN VARCHAR2 IS RESULT VARCHAR2(1000); BEGIN FOR cur I

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 12:07:59
oracle中,25-09-14怎么转换成日期格式:yyyy-mm-dd,已经试过to_char()和to_date(),都报错;FUNCTIONget_order_date(p_segment1IN

oracle中,25-09-14怎么转换成日期格式:yyyy-mm-dd,已经试过to_char()和to_date(),都报错;FUNCTION get_order_date(p_segment1 IN VARCHAR2, p_organization_code IN VARCHAR2) RETURN VARCHAR2 IS RESULT VARCHAR2(1000); BEGIN FOR cur I
oracle中,25-09-14怎么转换成日期格式:yyyy-mm-dd,已经试过to_char()和to_date(),都报错;
FUNCTION get_order_date(p_segment1 IN VARCHAR2, p_organization_code IN VARCHAR2) RETURN VARCHAR2 IS
RESULT VARCHAR2(1000);
BEGIN
FOR cur IN (SELECT to_date(to_char(oola.schedule_ship_date, 'yyyy-mm-dd'), 'yyyy-mm-dd') schedule_ship_date
FROM oe_order_headers_all ooha,
oe_order_lines_all oola,
mtl_system_items_b msib,
mtl_system_items_tl msit,
mtl_parameters mp
WHERE ooha.header_id = oola.header_id
AND oola.inventory_item_id = msib.inventory_item_id
AND oola.ship_from_org_id = msib.organization_id
AND msib.inventory_item_id = msit.inventory_item_id
AND msib.organization_id = msit.organization_id
AND msit.language = userenv('LANG')
AND oola.ship_from_org_id = mp.organization_id
AND oola.flow_status_code = 'AWAITING_SHIPPING' --销售订单行状态为:Awaiting_Shipping的明细
AND msib.segment1 = p_segment1
AND mp.organization_code = p_organization_code
AND (ooha.order_source_id IS NULL OR ooha.order_source_id 10)) LOOP
log('RESULT : ' || RESULT);
RESULT := RESULT ||cur.schedule_ship_date || ',
';
END LOOP;
RESULT := rtrim(RESULT, ',');
RETURN(RESULT);
END get_order_date;
输入的格式现在是25-09-14这种,我想让它输出2014-09-25

oracle中,25-09-14怎么转换成日期格式:yyyy-mm-dd,已经试过to_char()和to_date(),都报错;FUNCTION get_order_date(p_segment1 IN VARCHAR2, p_organization_code IN VARCHAR2) RETURN VARCHAR2 IS RESULT VARCHAR2(1000); BEGIN FOR cur I
to_date('25-09-14','dd-mm-yy') 可以转换成日期类型,输出可以用 to_char再格式化.