是否有PL / SQL函数或通用技术引用非限定标识符(例如mytable
)以用于动态构造的SQL查询?如何部分或完全限定标识符(a.b@c
)?
考虑这个人为的例子:
CREATE PROCEDURE by_the_numbers(COL_NAME VARCHAR, INTVAL INTEGER) IS
...
BEGIN
-- COL_NAME is interpolated into SQL string
-- INTVAL gets bound to :1
stmt := 'SELECT * FROM tbl WHERE ' || COL_NAME || ' = :1';
...
END
...我们不想在COL_NAME
中允许初始SQL注入(例如,值为'1 = 1或1')。
答案 0 :(得分:3)
有dbms_assert:http://www.oracle-base.com/articles/10g/dbms_assert_10gR2.php用于阻止sql注入。