Posts

aaa

Oracle AI Database 26ai(23.26.4):BAR_CHART - A New Way to Visualize Data

Image
  Oracle introduces the BAR_CHART SQL function to make query results easier to read and understand. This function converts numeric or Boolean values into visual bars using characters. How Does BAR_CHART Work? The function uses a value to determine the length of a bar. You can also customize its scale, width, and display character. The general syntax is: BAR_CHART(value, maximum, minimum, width, symbol) The function accepts five arguments: value: The numeric or Boolean value to display as a bar.  maximum: The upper limit of the scale. Default: 100 for numeric values and 1 for Boolean values. minimum: The lower limit of the scale. Default: 0. width: The maximum bar length in characters. Default: 10 for numeric values and 1 for Boolean values. symbol: The character used to draw the bar.  Only the first argument is required. Displaying Tablespace Utilization One practical use of this function is monitoring tablespace utilization. For example: SQL> SELECT tablespace_...

PostgreSQL 19: Exporting Data in JSON Format Using COPY TO

  PostgreSQL provides the COPY command to efficiently transfer data between database tables and files or standard input/output streams. Traditionally, COPY supports formats such as TEXT , CSV , and BINARY . However, exporting relational data directly as JSON has often required additional SQL functions, such as row_to_json() or json_agg() . PostgreSQL 19 introduces a new capability: native JSON format support for COPY TO. With this enhancement, we can export table data or query results directly in JSON format without explicitly converting every row using JSON functions. In this article, I will demonstrate this feature using PostgreSQL 19 and compare the traditional approach with the new syntax. Preparing the Test Environment First, let's create a sample table named tbl_person. vahiddb = # CREATE TABLE tbl_person ( id INTEGER , first_name VARCHAR ( 50 ) , last_name VARCHAR ( 50 ) , department VARCHAR ( 50 ) , job_title VARCHAR ( 100 ) , ...