26 January, 2025

23ai New Feature : Partition HIGH_VALUE in JSON format

 A quick demonstration of the new HIGH_VALUE_JSON column in the USER_TAB_PARTITIONS view in 23ai :


[oracle@localhost Hemant]$ sqlplus hemant/hemant@freepdb1

SQL*Plus: Release 23.0.0.0.0 - for Oracle Cloud and Engineered Systems on Sun Jan 26 10:07:09 2025
Version 23.6.0.24.10

Copyright (c) 1982, 2024, Oracle.  All rights reserved.

Last Successful login time: Sun Jan 26 2025 10:05:18 +00:00

Connected to:
Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.6.0.24.10

SQL> @demo_part_high_value.sql
SQL> set pages600 linesize 132
SQL> set long 10000
SQL>
SQL> spool demo_part_high_value
SQL>
SQL> -- 23ai has two new columns in the USER_TAB_PARTTIIONS view
SQL> -- HIGH_VALUE_CLOB and     HIGH_VALUE_JSON
SQL> --- unlike HIGH_VALUE which is a LONG, these two can be used programmatically
SQL> -- here I show HIGH_VALUE_JSON along with the HIGH_VALUE
SQL>
SQL> set pages600 linesize 132
SQL> set long 10000
SQL> col partition_name format a8 hea 'P_Name'
SQL> col high_value format a56 trunc hea 'High_Value_LONG' trunc
SQL> col high_value_json format a48 hea 'High_Value_JSON'
SQL>
SQL>
SQL> drop table hkc_test_intvl;

Table dropped.

SQL>
SQL> create table hkc_test_intvl
  2  (date_column date,
  3  data_column varchar2(50))
  4  partition by range (date_column)
  5  interval (numtoyminterval(1,'MONTH'))
  6  (partition P_1 values less than (to_date('01-FEB-2024','DD-MON-YYYY')))
  7  /

Table created.

SQL>
SQL>
SQL> insert into hkc_Test_intvl
  2  values (to_date('15-AUG-2024','DD-MON-YYYY'), 'August Row')
  3  /

1 row created.

SQL>
SQL>
SQL> insert into hkc_test_intvl
  2  values (to_date('15-OCT-2024','DD-MON-YYYY'),'October Row')
  3  /

1 row created.

SQL>
SQL> insert into hkc_test_intvl
  2  values (to_date('15-DEC-2024','DD-MON-YYYY'),'December Row')
  3  /

1 row created.

SQL>
SQL> select partition_name, high_value,  high_value_json
  2  from user_tab_partitions
  3  where table_name = 'HKC_TEST_INTVL'
  4  /

P_Name   High_Value_LONG                                          High_Value_JSON
-------- -------------------------------------------------------- ------------------------------------------------
P_1      TO_DATE(' 2024-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS' {"high_value":"2024-02-01T00:00:00"}
SYS_P447 TO_DATE(' 2024-09-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS' {"high_value":"2024-09-01T00:00:00"}
SYS_P448 TO_DATE(' 2024-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS' {"high_value":"2024-11-01T00:00:00"}
SYS_P449 TO_DATE(' 2025-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS' {"high_value":"2025-01-01T00:00:00"}

SQL>
SQL>
SQL> spool off


Earlier, HIGH_VALUE was presented as a LONG.
23ai adds two columns to the USER_TAB_PARTITIONS data dictionary view :
HIGH_VALUE_CLOB
and 
HIGH_VALUE_JSON

These make it easier to query the data dictionary, for example, for Partition Life Cycle management.

No comments: