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

[MDEV-10593] sql_mode=ORACLE: TYPE .. AS OBJECT: basic functionality Created: 2016-08-18  Updated: 2019-04-03

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-4912 Data type plugin API version 1 Closed
is blocked by MDEV-10914 ROW data type for stored routine vari... Closed
Relates
relates to MDEV-10592 sql_mode=ORACLE: TYPE .. TABLE OF for... Open

 Description   

Add support for basic functionality for TYPE .. OBJECT.

Under terms of this tasks we'll implement declaration of objects with members only. Objects with methods are out of scope of this task.

This task will however include implementations of simple constructors to initialize members

  var struct_a_b_t:= struct_a_b_t(1,2);

Example

Creating an object data type and a corresponding table type.

DROP TYPE struct_a_b_t;
CREATE TYPE struct_a_b_t AS OBJECT
(
  a INT,
  b INT 
);
/ 
DROP TYPE table_of_struct_a_b_t;
CREATE TYPE table_of_struct_a_b_t AS TABLE OF struct_a_b_t;
/

Using the new data types:

DROP FUNCTION f1;
CREATE FUNCTION f1 RETURN INT
AS
  tbl table_of_struct_a_b_t:= table_of_struct_a_b_t();
  rec struct_a_b_t:= struct_a_b_t(10,1);
  a INT;
BEGIN   
  tbl.extend;
  tbl(1) := rec;
  tbl.extend;   
  tbl(2) := struct_a_b_t(20,2);
  SELECT SUM(a+b) INTO a FROM TABLE(tbl);
  RETURN a;
END;
/   
SELECT f1() FROM DUAL;

      F1()
----------
	33

Dropping the data types:

DROP TYPE table_of_struct_a_b_t;
DROP TYPE struct_a_b_t;



 Comments   
Comment by Elena Stepanova [ 2017-04-23 ]

Should probably be 10.3

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