我想在 Sqlplus 中将日期作为绑定变量传递。我使用了此处提供的建议,但似乎声明的绑定变量作为 varchar2 传递?
variable my_date varchar2(30)
exec :my_date := '2013-10-01';
select sysdate ,:my_date from dual where sysdate > to_date(:my_date,'yyyy-mm-dd');
select sql_text, v.sql_id, name, value_string, datatype_string
from v$sql_bind_capture vbc
join v$sql v
using (hash_value)
where v.sql_id in ('8c5xc95vxc7yr', '6vn08798ax8bw', '61g3km3x621wt');
SQL_TEXT SQL_ID NAME VALUE_STRING DATATYPE_STRING
select sysdate ,:my_date from dual where sysdate > to_date(:my_date,:"SYS_B_0") 6vn08798ax8bw :MY_DATE VARCHAR2(32)
select sysdate ,:my_date from dual where sysdate > to_date(:my_date,:"SYS_B_0") 6vn08798ax8bw :MY_DATE VARCHAR2(32)
select sysdate ,:my_date from dual where sysdate > to_date(:my_date,:"SYS_B_0") 6vn08798ax8bw :SYS_B_0 yyyy-mm-dd VARCHAR2(32)
如何在Sqlplus中将日期变量作为绑定参数传递?
更新 我编写了 pl/sql 代码块来将日期变量作为绑定变量传递。绑定变量类型会影响执行计划吗?