getdate()函数和sysdate()
sqlserver中用getdate()获取当前时间,在Mysql和达梦中则是用sysdate()获取当前时间。
sysdate() 日期时间函数跟 now() 类似,不同之处在于:now() 在执行开始时值就得到了, sysdate() 在函数执行时动态得到值。
*在进行变量赋值时,在sql中赋值为getdate(),在达梦中则是要赋值为sysdate(),否则变量会一直更新取得当前时间。
达梦建立存储过程可以直接在 存储过程名(参数1,参数2 defalut 默认值,…,参数n)设置参数,也可以在存储过程执行体declare 定义变量并赋值。
declare
v_date timestamp :=sysdate;
begin
select xx from xxx where time=v_date;
end;