-
1.定义变量及类型
-
SQL>var n number;
-
-
2.给变量赋值
-
SQL>exec :n := 100;
-
-
3.使用变量
-
SQL>select count(*) from t1 where object_id=:n;
-
-
4.查询该SQL语句的子语句的地址
-
SQL>select sql_id,child_number,child_address from v$sql where sql_text like 'select count(*) from t1 where object_id=:n'
-
SQL_ID CHILD_NUMBER CHILD_ADDRESS
-
------------- ------------ ----------------
-
2u2tqjwbx7jqd 0 0000000099855070
-
-
5.查询绑定变量的max_length,也就是绑定变量的分级值
-
SQL>select address,bind_name,position,max_length from v$sql_bind_metadata where address='0000000099855070' order by position;
-
ADDRESS BIND_NAME POSITION MAX_LENGTH
-
---------------- ------------------------------ ---------- ----------
-
0000000099855070 N 1 22
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28878983/viewspace-2137347/
,如需转载,请注明出处,否则将追究法律责任。