How to Bind Variables for PL/SQL Functions

Each time you run an Oracle query, the database re-queries the tables after it checks the cache. If you want to tell the database to immediately check the cache and run the same query each time, you use "binding" variables. This technique speeds up database performance, which also makes your desktop and Web applications faster.

Instructions

    • 1

      Click the Windows "Start" button and select "All Programs." Click "Oracle," then click "SQL*Plus" to open the command prompt.

    • 2

      Create the variable. The following code creates a binding variable for the database application:

      variable customerid number

      The code above creates the variable named "customerid."

    • 3

      Bind the variable to a value. The following code binds the data that you can use in your PL-SQL queries:

      exec :customerid := 55

      In the code above, the bound variable is assigned the number 55.

Related Searches:

References

Comments

Related Ads

Featured