/ Published in: SQL

In the examples so far we have declared variables as a separate object using one of PL/SQL’s standard datatypes. Normally a PL/SQL variable is closely tied to a database object and uses the same datatype. For example, if the variable will hold the book title from the book table , the variable definition must be of the exact same type and size as the table column. But what happens when the DBA changes the book table so that book_title is defined as a varchar2(60) instead of a varchar2(40)? It’s important to program in such a way that when the tables are changed, the PL/SQL code does not always need to be changed
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
-- Oracle has provided a method to declare a variable using the database object the data is based on. To execute this use the %type declaration. v_auth_name author.author_last_name%TYPE; -- You can also create records using the %rowtype declaration. r_auth author%rowtype;
URL: http://www.rampant-books.com/t_easyoracle_pl_sql_variable_declaration_db_objects.htm
Comments
