SQL>
SQL> CREATE OR REPLACE FUNCTION updNVal (
2 tab IN VARCHAR2,
3 col IN VARCHAR2,
4 val IN NUMBER,
5 whr IN VARCHAR2 := NULL,
6 sch IN VARCHAR2 := NULL)
7 RETURN INTEGER
8 IS
9 BEGIN
10 EXECUTE IMMEDIATE
11 'UPDATE ' || NVL (sch, USER) || '.' || tab ||
12 ' SET ' || col || ' = :the_value
13 WHERE ' || NVL (whr, '1=1')
14 USING val;
15 RETURN SQL%ROWCOUNT;
16 END;
17 /
Function created.
SQL>
|