Creating and using a stored procedure

About this task

As a high-level summary, follow these steps to create and use a stored procedure. These steps are described in more detail in Create and manage stored procedures

Procedure

  1. Design the stored procedure logic and operation.
  2. Define the stored procedure object by using the CREATE [OR REPLACE] PROCEDURE command.
  3. Run or execute the procedure from the SQL command prompt.
    Tip: If you are observing expression_tree_walker errors while you are running stored procedures, set spi_simplify_expr=false at a session level to skip the SPI layer simplification, and run the stored procedure.
    set spi_simplify_expr =false; YOUR STORED PROECDURE

Results

As with other objects, the Netezza Performance Server admin user can create, list, and execute stored procedures by default. The admin user can also grant other users permission to create, list, and execute stored procedures on the Netezza Performance Server system.