Function to update null value : Utility Function « Stored Procedure Function « Oracle PL / SQL






Function to update null value

  
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>

   
  








Related examples in the same category

1.Your own month add method
2.Raise power function
3.Raise pay level
4.Validate date value format
5.Function to count tab
6.Calculate average grade
7.Temperature package: convert Celsius to Fahrenheit back, forth