Skip to main content

Hello, it is possible change objversion from this format: “20240109092851” to this: “09-01-2024 09:28:51”? I want add this as a CF

 

SELECT
  TO_CHAR(
    TO_DATE(
      TO_CHAR(d1.objversion, 'FM00000000000000'), 
      'YYYYMMDDHH24MISS'
    ),
    'DD-MM-YYYY HH24:MI:SS'
  ) AS datum_formatted
FROM table d1

This query is working in Oracle SQL, but in CF not

Thanks

It looks like that TO_CHAR is not working, so I used only TO_DATE: SELECT TO_DATE(d1.objversion, 'YYYYMMDDHH24MISS') AS date
FROM table d1, this is working, but it retrieves only date without hours, minutes and seconds → 20240109092851 09-01-24 only this


@Ed22 hello, 

the following works well for me : 

 

SELECT TO_CHAR(
         TO_DATE('20240109092851', 'YYYYMMDDHH24MISS'),
         'DD-MM-YYYY HH24:MI:SS'
       ) AS formatted_date
FROM dual;
 

 

-- From the Supplier Table

SELECT TO_CHAR(
         TO_DATE(objversion, 'YYYYMMDDHH24MISS'),
         'DD-MM-YYYY HH24:MI:SS'
       ) AS formatted_date
FROM supplier_info_general and rownum = 1;


Hi,

 

I tried the first one with CHAR, but it doesnt work 

I Used this SQL query: 

“SELECT TO_CHAR(
         TO_DATE(d1.objversion, 'YYYYMMDDHH24MISS'),
         'DD-MM-YYYY HH24:MI:SS'
       ) AS formatted_date
FROM TECHNICAL_DRAWING_REVISION d1
JOIN TECHNICAL_DRAWING d2
  ON d1.drawing_no = d2.drawing_no
WHERE d1.drawing_no = :drawing_no AND d1.drawing_revision_no = :drawing_revision_no

 

and it says that: “Not all blind variables have a corresponding argument. 


That would depend on the entity you’re using and the structure of its additional views

 

 


In Additional Views is nothing


@Ed22  could you create a case for IFS please?

 

here the solution without using the to_char

 

select LPAD(EXTRACT(DAY FROM TO_DATE(:objversion, 'YYYYMMDDHH24MISS')), 2, '0') || '-' ||
  LPAD(EXTRACT(MONTH FROM TO_DATE(:objversion, 'YYYYMMDDHH24MISS')), 2, '0') || '-' ||
  EXTRACT(YEAR FROM TO_DATE(:objversion, 'YYYYMMDDHH24MISS')) || ' ' ||
  LPAD(EXTRACT(HOUR FROM TO_TIMESTAMP(:objversion, 'YYYYMMDDHH24MISS')), 2, '0') || ':' ||
  LPAD(EXTRACT(MINUTE FROM TO_TIMESTAMP(:objversion, 'YYYYMMDDHH24MISS')), 2, '0') || ':' ||
  LPAD(EXTRACT(SECOND FROM TO_TIMESTAMP(:objversion, 'YYYYMMDDHH24MISS')), 2, '0')from dual

 

 

 


@Ed22 , if the provided solution did solve the problem, please flag it as a solution for your issue so other people could find it easily please.


Hello,

I tested this expression, and it works perfectly in my case:

 

TO_CHAR(TO_DATE(V.objversion, 'YYYYMMDDHH24MISS'), 'DD-MM-YYYY HH24:MI:SS')

It correctly converts the OBJVERSION value from YYYYMMDDHH24MISS format to DD-MM-YYYY HH24:MI:SS.
We have also validated this with screenshots and confirmed it’s displaying as expected in the Custom Field.

Regards,
Anil Kumar


@anilkumar24k , when using the expression type yes there is no issue.

But when using the select type, the v.objversion can not be retrieved when to_char(to_date(..