PL/SQL parser - Phase 2 (MDEV-10764)

[MDEV-10590] sql_mode=ORACLE: Built-in package DBMS_OUTPUT Created: 2016-08-18  Updated: 2023-10-20

Status: Open
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: None
Fix Version/s: None

Type: Technical task Priority: Major
Reporter: Alexander Barkov Assignee: Unassigned
Resolution: Unresolved Votes: 4
Labels: Compatibility

Issue Links:
Blocks
is blocked by MDEV-10591 Oracle-style packages Closed

 Description   

Implement a built-in package DBMS_OUTPUT for sql_mode=ORACLE.
This feature is actively used by Oracle users, especially for debugging purposes.

The idea:

  • A stored routine can send debug messages using DBMS_OUTPUT methods, such as DBMS_OUTPUT.PUT_LINE(), which are collected in the package internal buffers.
  • The client program e.g. SQL*Plus retrieves the collected messages using methods such as DBMS_OUTPUT.GET_LINE()

SQL*Plus understands a special command SET SERVEROUTPUT ON; to enable displaying of the DBMS_OUTPUT messages after each statement executed.

Example:

DROP FUNCTION f1;
CREATE FUNCTION f1 (a INT) RETURN INT
AS
BEGIN
  DBMS_OUTPUT.PUT_LINE('a IS '||TO_CHAR(a));
  RETURN a;
END;
/
SET SERVEROUTPUT ON;
SELECT f1(10) FROM DUAL;

    F1(10)
----------
	10
 
a IS 10

Possible implementation using NOTEs

When we have MDEV-10591 implemented, we will be able just to create a package DBMS_OUTOUT with a procedure PUT_LINE('string') which will just send 'string' to the client as a NOTE. That would not be exactly the same how Oracle works, but very close, and useful for debugging purposes.


Generated at Thu Feb 08 07:43:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.