Skip to main content

I am trying to insert the history row to customer order while inserting the date is converting wrong. I tried many ways but still the same. How should I write?

 

SELECT client_sys.attr_value_to_date(to_date(SYSDATE)) FROM dual

SELECT client_sys.attr_value_to_date(to_date(SYSDATE, 'dd/mm/yy HH:MI:SS')) FROM dual

 

 

 

I am trying to insert the history row to customer order while inserting the date is converting wrong. I tried many ways but still the same. How should I write?

 

SELECT client_sys.attr_value_to_date(to_date(SYSDATE)) FROM dual

SELECT client_sys.attr_value_to_date(to_date(SYSDATE, 'dd/mm/yy HH:MI:SS')) FROM dual

 

 

 

 

Hi Hasan,

Can you post example code you are trying, may be it will be helpful to see the error.


@dsj Hi

 

You can see bellow

 

 

 


@dsj Hi

 

You can see bellow

 

 

 

Try this

 

to_char(SYSDATE, 'YYYY-MM-DD-HH24.MI.SS')

 

 


@dsj Thank you very much :slight_smile:


CLIENT_SYS has overloads for each data type, so if you build the attr_ string using the out-of-the-box tooling, you don’t have to worry as much about the data types.

 

DECLARE
info_ VARCHAR2(32767);
objid_ customer_order_history.objid%TYPE;
objversion_ customer_order_history.objversion%TYPE;
attr_ VARCHAR2(32767);
order_no_ customer_order_history.order_no%TYPE;
date_entered_ customer_order_history.date_entered%TYPE;
userid_ customer_order_history.userid%TYPE;
message_text_ customer_order_history.message_text%TYPE;
hist_state_ customer_order_history.hist_state%TYPE;
BEGIN
order_no_ := 'A319931';
date_entered_ := SYSDATE;
userid_ := fnd_session_api.get_fnd_user;
message_text_ := 'Hello World!';
hist_state_ := customer_order_api.get_objstate(order_no_);

client_sys.clear_attr(attr_);
client_sys.add_to_attr('ORDER_NO', order_no_, attr_);
client_sys.add_to_attr('DATE_ENTERED', date_entered_, attr_);
client_sys.add_to_attr('USERID', userid_, attr_);
client_sys.add_to_attr('MESSAGE_TEXT', message_text_, attr_);
client_sys.add_to_attr('HIST_STATE', hist_state_, attr_);
customer_order_history_api.new__(info_, objid_, objversion_, attr_, 'DO');
END;
/

 


@durette I know this version of loading the Attr_ but I did not try for this example. Thank you.