lightdb 创建函数或存储过程参数类型是date时支持oracle.date类型

本文介绍了LightDB24.1版本对Oracle数据库中date类型的兼容性改进,包括创建、修改和调用存储过程和函数时,如何处理从Oracle移植过来的使用date类型的SQL语句,以及提供相关包和函数示例及执行结果。
摘要由CSDN通过智能技术生成

lightdb 创建函数或存储过程参数类型是date时兼容oracle的date类型

背景

在业务产品中,存在 oracle 移植过来的 sql 语句。它们在创建存储过程或函数时使用date类型。在使用时传入oracle的date类型。lightdb 24.1 版本对此进行了支持。

支持的语法场景

  1. CREATE 函数或存储过程
  2. DROP 函数或存储过程
  3. ALTER 函数或存储过程
  4. 支持包里的函数或存储过程
  5. COMMENT ON 函数或存储过程
  6. GRANT 函数或存储过程
  7. REVOKE 函数或存储过程
  8. SECURITY LABEL 函数或存储过程

包使用示例

create or replace package pack is
	procedure ptest(x date);
	function ftest(x date) return date;
end;
/

create or replace package body pack is
	procedure ptest(x date) as
tmp varchar(20);
	begin
		tmp := 'hello world';
DBMS_OUTPUT.PUT_LINE('tmp: ' || tmp);

	end;

	function ftest(x date) return date as
tmp varchar(20);

	begin
		tmp := 'hello world';
DBMS_OUTPUT.PUT_LINE('tmp: ' || tmp);

		return x;
	end;
end;
/

\df pack.ptest
\df pack.ftest

call pack.ptest(sysdate);
select pack.ftest(sysdate);

执行结果

在这里插入图片描述

存储过程使用示例

create or replace procedure ptest(x date) AS
begin
	DBMS_OUTPUT.PUT_LINE('tmp: ' || x);
end;
/

call ptest(sysdate);

执行结果

在这里插入图片描述

函数使用示例

create or replace function ftest(x date)  return date AS
begin
	DBMS_OUTPUT.PUT_LINE('tmp: ' || x);
	return x;
end;
/

select ftest(sysdate);

执行结果

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值