Monday, October 26, 2020

Convert date to UTC TimeZone in Oracle

SELECT SYSDATE,
       SYSTIMESTAMP,
       CURRENT_DATE,
       CURRENT_TIMESTAMP,
       TO_CHAR (SYSTIMESTAMP AT TIME ZONE 'UTC', 'YYYY/MM/DD HH24:MI:SS TZD')
          DT_AS_UTC,
       TO_CHAR (SYSTIMESTAMP AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS')
          DT_AS_UTC,
       TO_CHAR (SYS_EXTRACT_UTC (SYSTIMESTAMP), 'yyyy-mm-dd"T"hh24:mi:ss"Z"')
          DT_AS_UTC
  FROM DUAL;


 

Monday, October 12, 2020

Data Validation in SQL Server

DROP TABLE if exists #temp1,#temp2;


SELECT empno, HASHBYTES ('SHA2_256', CONCAT ([ename]

      ,[hiredate]

      ,[job]

      ,[deptno]

      ,CONVERT(DECIMAL(32,6),[sal])

      )) HashByte

      INTO #temp1

  FROM [prod].[scott].[EMP];


SELECT empno, HASHBYTES ('SHA2_256', CONCAT ([ename]

      ,[hiredate]

      ,[job]

      ,[deptno]

      ,CONVERT(DECIMAL(32,6),[sal])

      )) HashByte

      INTO #temp2

  FROM [stage].[scott].[EMP];



CREATE clustered INDEX IX ON #temp2  (empno);


CREATE clustered INDEX IX1 ON #temp1  (empno);


-- Data Validation


SELECT top 10  *  FROM #temp1 t1

  WHERE  not EXISTS (SELECT 1 FROM #temp2 t2 where t1.empno=t2.empno and t1.HashByte=t2.HashByte )


-- Sample Record


SELECT 'prod'

   [empno] 

      ,[ename]

      ,[hiredate]

      ,[job]

      ,[deptno]

      ,CONVERT(DECIMAL(32,6),[sal])

FROM [prod].[scott].[EMP]

WHERE [empno] = 7863

UNION ALL

SELECT 'stage'

   [empno] 

      ,[ename]

      ,[hiredate]

      ,[job]

      ,[deptno]

      ,CONVERT(DECIMAL(32,6),[sal])

FROM [stage].[scott].[EMP]

WHERE [empno] = 7863;

  

Delete Row Button to all records of Interactive Report in Oracle Apex

 1. add 'Delete' Del column to Report Query 2. Set the Following Properties for the DEL Column Type: Link Heading: Delete Targ...